2011-05-15

ZFS On Linux - Notes to Self / (aka forget mdadm, this is easier!)

Set up repositories:

deb http://ppa.launchpad.net/dajhorn/zfs/ubuntu natty main
deb-src http://ppa.launchpad.net/dajhorn/zfs/ubuntu natty main
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1EE8660B

Fix "Samba sharing is not supported.":

apt-get install nfs-kernel-server

Create pool:

# zpool create chasm raidz /dev/sda /dev/sdb /dev/sdc /dev/sdd
# zpool list

NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
chasm  1.81T   303K  1.81T     0%  1.00x  ONLINE  -

Create filesystem and set options:

# zfs create chasm/data
# zfs set atime=off chasm
# zfs set mountpoint=/srv/pub chasm/data
# zfs list

NAME         USED  AVAIL  REFER  MOUNTPOINT
chasm        215K  1.33T  41.9K  /chasm
chasm/data  67.3K  1.33T  67.3K  /srv/pub

Set up share with no real security but a decent slice of space:

# vi /etc/samba/smb.conf

[media]
path = /srv/pub/media
comment = Various media.
valid users = greyproc smbadmin uninvited
write list = greyproc smbadmin
read list = uninvited
available = yes
browseable = yes
writable = no
guest ok = no
printable = no
locking = no
strict locking = no

And verify:

$ smbclient -L localhost -U greyproc

Enter greyproc's password:
Domain=[Khazadum] OS=[Unix] Server=[Samba 3.5.8]

        Sharename       Type      Comment
        ---------       ----      -------
        ...
        media           Disk      Various media.
        ...
        IPC$            IPC       IPC Service (Here Be Dragons (Frostfall 3.5.8))

Reference:

https://launchpad.net/~dajhorn/+archive/zfs
http://groups.google.com/group/kqstor-zfs-discuss/browse_thread/thread/c4cd225c45530964?tvc=2
http://zfsonlinux.org/

2011-03-07

VIM: Press ENTER or type command to continue

After searching much longer than reasonable for such a stupid thing, my solution for dealing with the less than ideal vim behavior of prompting me like a slobbering dog to press enter or type a command to continue is:

:ab maker make<CR>

The <CR> should be typed exactly like that.  Now I can use :maker to make, and while the shell out window is less than ideal, it flicks by quickly enough as to only be an issue for epileptics.  Also, unlike with a redirect to /dev/null, output properly ends up in the quickfix (:copen) window.

All this does is manually hit <enter> for me after a compile.

Vim really needs an option to set which states, "I don't care about information in the output buffer; don't bug me with it."

Here is another (in my opinion less clean) solution:
http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts

2011-02-11

Speculations About Staples' Coupons.

This past Black Friday, Staples had a Western Digital Elements 2TB External Hard Drive for $134.99... with $65 off, making it $69.99, with free shipping.
To sweeten the deal, there was a 50 pack of DVD-R for $7.99; granted, Kodak, but it's good enough to keep coffee stains off one's desk.
Add 'em together, and that's $77.98.  Apply a $25 off $75 coupon, and that makes the complete order $52.98.  Good times?

I had four such orders, having bought 3 coupon codes in addition to one that was mailed to me.  All 4 orders went through; however, this being Staples, a day later, I got a nice notice that they'd oversold their inventory; basically, advertised items, allowed people to buy them, and then, "Oops, sorry!"  (Well, mostly; they still would have sold me just the media for... $20.23.  Normal price, plus shipping, and no coupon applied since it was under $75)

It goes without saying I was somewhat ... "bummed"; I mean, selling items they couldn't actually present (realize checkout was completed) seems like a bad business move, if not fraudulent; I think it's enough to sour me from bothering with purchasing from Staples ever again, in fact.

But, trying to make lemon pepper marinade out of the pungent lemons, I looked at the (non-refundable... ) Staples coupons, and noticed they seem to be created thusly:

5 digit coupon code + 10 digit "Staples Rewards" account number + 1 digit checksum (Luhn alogrithm).

So, in theory, if you knew a 5 digit code for a non-expired coupon, you could simply apply that to your Staples Reward Card account number, and potentially have a valid coupon.  I wonder if that's what the people who sell the coupons are doing?

It turns out it's really just this simple, but only when [unknown].

Ancedotal evidence suggests for any given account, one can use 2 coupons of [x] off [y].  My accounts are geographically similar, but have a large gap (4XXXXXXXXX vs 6XXXXXXXXX) between them. Another account, geographically on one of the coasts and in the CCCCCCCCCC range, at one point had the exact same expiration date and 5 digit code, but doesn't appear valid right now with a 47128 coupon (or any of the others).

Since the large gap between numbers (assigned based on when someone signed up for a Reward card?) doesn't seem relevant, I'm leaning towards various coupons being applicable only to certain areas at a given time.

It's also possible the codes are distributed randomly or allocated some other way.

Since it can get tedious doing the Luhn calculations by hand, the Interwebs come to the rescue: http://www.ee.unb.ca/cgi-bin/tervo/luhn.pl

Here is a list of my observed data (obscuring private accounts... non-obscured ones were publicly posted to Fatwallet's forum.)

$25 off $100 EXP 09/27/10 86427 BBBBBBBBBB -
$10 off $40  EXP 11/01/10 18053 AAAAAAAAAA -
$10 off $40  EXP 11/01/10 18053 CCCCCCCCCC -
$25 off $75  EXP 11/30/10 75749 DDDDDDDDDD -
$25 off $75  EXP 11/30/10 75749 EEEEEEEEEE -
$25 off $75  EXP 11/30/10 75749 FFFFFFFFFF -
$25 off $75  EXP 11/30/10 47937 GGGGGGGGGG -
$25 off $75  EXP 11/30/10 47937 HHHHHHHHHH -
$25 off $75  EXP 11/30/10 47937 IIIIIIIIII -
$25 off $75  EXP 11/30/10 47937 JJJJJJJJJJ -
$25 off $75  EXP 11/01/10 57057 AAAAAAAAAA -
$25 off $75  EXP 11/01/10 57057 CCCCCCCCCC -
$25 off $75  EXP 11/01/10 60933 CCCCCCCCCC -
$25 off $100 EXP 12/13/10 81670 AAAAAAAAAA -
$25 off $100 EXP 12/13/10 94744 CCCCCCCCCC -
$25 off $100 EXP 12/27/10 49704 AAAAAAAAAA -
$25 off $100 EXP 12/27/10 60788 CCCCCCCCCC -
$25 off $100 EXP 01/15/11 95928 CCCCCCCCCC -
$25 off $100 EXP 01/15/11 95928 4080118658 0
$25 off $100 EXP 01/16/11 47128 6410756537 6
$25 off $100 EXP 01/16/11 47128 6410756461 9
$25 off $100 EXP 01/16/11 47128 6410756446 0
$25 off $100 EXP 01/16/11 47128 6410756412 2
$25 off $100 EXP 01/16/11 47128 6410756420 5
$25 off $100 EXP 01/16/11 47128 6410756438 7
$25 off $100 EXP 01/16/11 47128 6410756453 6
$25 off $100 EXP 01/16/11 47128 6410756479 1
$25 off $100 EXP 01/16/11 47128 6410755448 7
$25 off $100 EXP 01/22/11 27702 4042459943 5
$25 off $100 EXP 02/05/11 20797 5764615000 0
$25 off $100 EXP 02/28/11 53136 2001299318 0
$10 off $40  EXP 02/28/11 90427 2001299318 0
$10 off $40  EXP 02/28/11 22258 AAAAAAAAAA -
$25 off $75  EXP 02/28/11 47128 AAAAAAAAAA -
$25 off $75  EXP 02/28/11 47128 BBBBBBBBBB - <- Correct Guess!
$25 off $75  EXP 04/06/11 61774 AAAAAAAAAA -
$25 off $75  EXP 04/06/11 61774 6410755448 9 <- Correct Guess!
$25 off $75  EXP 04/06/11 61774 6410756438 9 <- Coreect Guess!
$25 off $75  EXP 04/06/11 61774 6410756453 8 <- Correct Guess!
$25 off $75  EXP 04/06/11 61774 6410756420 7 <- Correct Guess!
$25 off $100 EXP 05/15/11 66783 2001299318 4