Long-form
- Launch Disk Utility from
/Applications/Utilities
- Select the SD card from the source list and choose “Partition.”
- When repartitioning the drive, choose “Options…” and format using GPT.
- Erase the newly-created partition with the “Mac OS Extended (Journaled, Encrypted)” option.
- My 1Password and system keychains.
- The database for Authy, which is like Google Authenticator, backed up via iExplorer.
- Copies of my source code repositories.
- Public and private SSH keys.
- Riyria Revelations by Michael J. Sullivan (1-2, 3-4, 5-6)
- Abhorsen by Garth Nix (1, 2, 3)
- The Demon Cycle by Peter V. Brett (1, 2, 3)
- Imager by L.E. Modesitt (1, 2, 3)
- The Wheel of Time by Robert Jordan (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) and Brandon Sanderson (12, 13, 14)
- Farseer by Robin Hobb (1, 2, 3)
- Activities designed to defame, embarrass, harm, abuse, threaten, slander or harass third parties;
- Activities prohibited by the laws of the United States and/or foreign territories in which you conduct business;
- Activities designed to encourage unlawful behavior by others, such as hate crimes, terrorism and child pornography;
- Activities that are tortious, vulgar, obscene, invasive of the privacy of a third party, racially, ethnically, or otherwise objectionable;
- Activities designed to impersonate the identity of a third party; and
- Activities designed to harm or use unethically minors in any way.
activities designed to defame, embarrass, harm, abuse, threaten, slander or harass third parties;activities prohibited by the laws of the United States and/or foreign territories in which you conduct business;activities designed to encourage unlawful behavior by others, such as hate crimes, terrorism and child pornography;activities that are tortious, vulgar, obscene, invasive of the privacy of a third party, racially, ethnically, or otherwise objectionable; activities designed to impersonate the identity of a third party;and activities designed to harm or use unethically minors in any way.- Download and install Calibre.1
- Download and decompress the DeDRM archive.
- Open Calibre’s preferences (
⌘,
). - Go to “Plugins.”
- Click “Load plugin from file.”
- Choose the K4MobileDeDRM plugin’s zip file (zip within the main zip; don’t extract).
- Download Kindle for Mac.
- Register it with your account.
- Download all of your eBooks (open them from the “Archived Items”).
- Navigate to either of the following (likely the second):
~/Library/Application Support
/Kindle/My Kindle Content/ ~/Library/Containers
/com.amazon.Kindle/ Data/Library /Application Support/Kindle /My Kindle Content/
- Drag all of the
.azw
files into the Calibre window. - Select the books in the Calibre window which you wish to export.
- Click the “Convert books” toolbar item.
- Choose “ePub” as the output format in the top-right of the convert window.
- Go to the “Page Setup” item in the left list, and configure the conversion:
- Select “Kindle” as the input profile.
- Select “iPad” as the output profile.
- Hit the “OK” button to begin the conversion. It will take a while.
-
This is a link to the project’s GitHub page because their main website does not support HTTPS. You should not install software over an unencrypted connection. ↩︎
Cleaning up old git branches
My local git repository is full of branches which have long-since been merged: code review, one-off features, and quick bug fixes add up really quickly. Deleting these branches is cumbersome.
Complaining on Twitter proved really fruitful:
There’s also
git branch --merged
, which you could pipe to xargs (assuming you can remember the syntax, which I never can.) – @bjhomer
Of course, he’s right, so finding and deleting them is easy. The end result is this wonderful snippet, which deletes all merged branches:
git branch --merged origin/master | grep -v master | xargs git branch -d
The text spam after it executes can only be described as cathartic.
Portable encrypted backups
To keep track of the ever-growing array of passwords and private data, I use 1Password, which I could not recommend more.
There’s a problem though: what if I lose access to my database? I’ve toyed with a few options in the past, including uploading it to Dropbox or Google Drive, but these are services for which I’ve enabled multi-factor authentication, and require internet access.
For a few years now, Macbook Pros have included an SD slot for photographers. Or, as it turns out, everybody!
I bought a Transcend SD card with a decently-useful 16GB capacity for about $10. As of OS X 10.8, you can format any disk to be encrypted. Match made in heaven.
Going from the stock card to an encrypted version is easy, but does involve making the disk Mac-only:
With a tiny, portable, encrypted disk, there’s a lot of cool things you can back up. I currently save:
I’ll find more uses as time goes on. Right now it’s a manual process to update, but this is more of an emergency backup: I use Arq for my normal backup needs.
Getting into fantasy
Science fiction has always been my favorite genre. I enjoy imagining possible futures and I’ve never stopped wondering what changes may happen in my lifetime.
The mysterious worlds of the future always held such potential that I rarely strayed from the genre. I started reading simple novels by Isaac Asimov and grew into reading hard sci-fi like Alastair Reynolds where the thick story and technology are enrapturing.
Fantasy is similar, but different. Instead of imagining the future, you’re compelled to imagine something potentially in parallel. It could be our past, our future, or another world entirely, with any kind of supernatural circumstances.
Earlier this year I was introduced to fantasy by David: his careful but persistent prodding toward reading Name of the Wind was eventually successful beyond his wildest imaginations.
Below are a few of the unforgettable series I have read since then and recommend without hesitation. The links point to the Kindle editions on Amazon, and feature an affiliate marker.
Fantasy is an amazing genre: much of the books are not only available digitally, but also DRM-free, negating previous hacks I’ve had to use. I am incredibly happy about that.
The Kingkiller Chronicle (1, 2)
This series by Patrick Rothfuss is still my favorite, and displays an incredibly powerful piece of storytelling. The depth of the characters and plots combine with the history and lore of the world to produce what I have come to expect in many fantasy novels.
The first novel is Name of the Wind. I was initially put off by the name–of all things!–but I’ve come to realize just how wrong was that assumption. The second novel follows a similar model in which the protagonist walks us through a long series of flashbacks.
It was impossible to put down.
I entered expecting something interesting, and I exited fully in love with the idea of the genre and the execution of the novels.
I strongly recommend picking up Name of the Wind and starting from there. You will not be disappointed.
Mistborn (1, 2, 3, 3.5) & other Brandon Sanderson (1, 2, 3, 4, 5, 6)
If Patrick Rothfuss was a great introduction to fantasy, Brandon Sanderson’s Mistborn trilogy was a wonderful bit of bliss to keep me coming back for more. From his blog entries on the novels, I’ve since learned he had all three written before final publication and he was able to form an amazingly cohesive universe.
Mistborn starts us in a tyrannical world ruled by a single god-king full of brown and dying plants and an entire race of people subjugated by nobility.
Sanderson coined Sanderson’s Laws, a set of idealized goals for fantasy novels wherein the magic system is concretely defined, additive and the novels don’t require last-second, unexpected uses of magic to bring about victory.
Logic, as you may guess from being in software development, is something I eagerly enjoy.
It turns out this is really important to making fantasy novels engaging. Since reading Mistborn I’ve used it as a metric in defining what I do or do not like, and nothing by Sanderson has disappointed.
He is an impossibly prolific writer. I have nearly read everything the man has written and everything has been amazing and worth every minute. He has very easily become my favorite author.
The Gentleman Bastard (1, 2, 3)
This series by Scott Lynch was a first for me as it didn’t feature a strong magic component.
It’s an interesting approach: it’s a world of rich history, of which we see mostly the grimy bits. It’s a world of magic, in which we see but a glimmer.
Contained within is a truly interesting premise: what if thievery wasn’t for personal gain, but for the art of it? What happens when skill of the game becomes more important than even living in luxury?
The long con, and really thorough introspection by characters makes this series a really different place to visit.
Codex Alera (1, 2, 3, 4, 5, 6)
When I was in college, I loved the show The Dresden Files. When I came across The Furies of Calederon, I grabbed the sample on name recognition alone, but didn’t follow up for some time.
What a mistake! It’s an excellent series, and the writing is really easy to absorb. I read the entire series in about two weeks, and I would loved to have continued on forever.
I really enjoyed the many races and cultures featured in the novels. I think Jim Butcher did a wonderful job bringing to life the history and superstitions each.
Ad infinitum
At the time of writing this, I’ve read 50 fantasy novels totalling more than 26,000 pages since Name of the Wind, and there’s no end in sight. Here are a few other amazing pieces of literature that I can’t help but identify:
My Reading page is a good place to find more novels I’ve enjoyed. I hope this list is helpful to at least someone out there! I cannot believe I went so long without indulging in fantasy.
Morality clauses in domain registration
GoDaddy has received a lot of bad press for their support of the Stop Online Privacy Act (SOPA), which they helped write and from whom they are exempt. However, GoDaddy and many other registrars should be avoided for more simple reasons.
From the GoDaddy Legal Agreement:
Go Daddy may also cancel the registration of a domain name, after thirty (30) days, if that name is being used, as determined by Go Daddy in its sole discretion, in association with spam or morally objectionable activities. Morally objectionable activities will include, but not be limited to:
In response, many are switching to Namecheap. This registrar tends to play contrarian with GoDaddy so fortunately they are against SOPA. However, from the Namecheap Registration Agreement: (Namecheap has removed their morality clause, see below.)
Namecheap may also cancel the registration of a domain name, after thirty (30) days, if that name is being used, as determined by Namecheap in its sole discretion, in association with spam or morally objectionable activities (as well as any activities set forth in Section 4 above). Morally objectionable activities will include, but not be limited to
Both have nearly identical language. These clauses leave a bitter taste in my mouth.
Should I really be held to the backwards laws of “foreign territories in which you conduct business?” Software sales are global, I interact with many customers in very dangerous nations.
Who determines what is “objectionable?” Certainly the test should be legality not questionability. The internet is the backbone of the economy and vital for freedom of expression. Depending upon corporations like this, especially those in violent support of SOPA, leaves wide a huge vulnerability in communication.
Let’s not get started on obscene.
What can you do about it? Support a better registrar. I use Gandi whose motto is “no bullshit.” No morality clause, and easy-to-read legal agreements.
Addendum (2011-12-25): As pointed out in this Hacker News thread, Gandi has a similar clause. Hover (Tucows) doesn’t feature any of these crazy terms. A statement from the GM of Hover discusses why these clauses exist and why they don’t have them:
Generally, most of the power a registrar requires to prevent the bad guys from doing bad things comes from national laws and not all these extra clauses. We (Hover/Tucows) find that all these extra conditions just make it harder for our customers to do business with us and so we’ve left out as much as we can and rely mostly on national laws to get what we need done.
Addendum (2011-12-29): Namecheap has removed their morality clause. I am happy to have effected change on this issue, and it is a move in the right direction. :)
Migrating from Kindle to iBooks
I started off reading eBooks from the Amazon Kindle store. As time has progressed, I’ve found myself using my physical Kindle less and less. Partly because I forget to charge it, and partly because I can never get the lighting in my favorite reading locations quite right. And at night? Forget about it.
So I’ve converted all of my Kindle purchases to ePubs for use in iBooks. I could use the Kindle app for iOS but I’ve found iBooks to be faster at syncing read position, and it feels a lot more natural to use.
Since I went through the effort of converting all of my Kindle documents, I figured I’d write a mini guide to getting it done. I’m specifically focusing on the Mac since that’s all I know; other users will have to venture elsewhere.
Setting up Calibre
Calibre is a Java application which is an eBook management suite. It’s a bit ugly but it does what it says and works well. Since the Kindle’s eBooks are encrypted, we need to install a decryption plugin to do the heavy lifting there.
The encryption used on Kindle books is fairly basic. The decryption key is a product of the serial number for your device, so it’s not difficult to determine.
Getting books from Amazon
The DeDRM scripts work by understanding Kindle for Mac’s settings files, so to get the eBooks we need use the application. There are scripts to do conversions directly from Kindle hardware’s eBooks, but it’s more effort.
I really wish this application were retina.
Converting books to ePub format
Kindle eBooks are in the MobiPocket format. However, iBooks requires ePub, so we need to both decrypt and convert the files. At this point, we’ve got all we need, so we can use Calibre to do the conversion.
If you have any issues at the decryption step, you should delete your ~/Library/Application Support/Kindle
folder and start again.
Exporting and enjoyment
You can now “Save to disk” from the toolbar item to save the books which you’ve converted, and import them into iTunes for use in iBooks. Calibre is powerful enough to do many other formats if you want to use other devices as well.
Remember, don’t post any of the unencrypted documents anywhere. Just because the DRM is gone doesn’t mean you’re legally authorized to do so. They’re for your personal use only.
Incrementing with a bitmask
Bitmasks are fun. There’s lots of little tricks you can do with them. A common situation is checking for the presence of a flag among elements in a linked list, or some similar data structure. I came across a trick a few years ago that makes it drop-dead simple.
Let’s say we needed to check for AUsefulFlag
in the flags
element of each node, and total how many elements in the linked list had the flag.
uint64_t count = 0;
for(Node *iter = head; iter != NULL; iter = iter->next)
{
count += !!(iter->flags & AUsefulFlag);
}
After execution, count
is the number of items which have AUsefulFlag
set.
Double-not (!!
) is one of those useful operations which are especially useful with bitmasks. It may require a double-take at first, but it behaves exactly how you’d think.
!!
of 1
is 1
. !!
of 0
is 0
. In fact, !!
of any true value evaluates to 1
, so we can use it to transform something like 0b00001000
to simply 1
and increment by that value.