Three Times I Didn’t Vote

Not necessarily times I could vote, mind.

In reverse chronological order:

1. I checked out the anti-Trump protest in Vancouver tonight. That was a crazy election, eh? I didn’t vote, because of course I can’t: I’m Canadian. American elections are strange to us, because we’re so closely connected as countries, yet we have absolutely no voice in their politics. I didn’t predict a Trump victory, but I had the same misgivings that I had over Brexit: It’s not a joke. This could really happen. A lot of people aren’t happy. It doesn’t matter if they’re lies if people believe them. And lo, Trump the narcissistic egomaniac did win the presidency.

2. Over a year ago now (when Trump was still a joke) was the Canadian federal election. It came at the tail end of my two years in Ireland. I didn’t vote for a couple reasons: one, I’d never bothered registering with the Canadian Embassy in Ireland, and I’d have to do that before I could get a ballot; two, the ballot would’ve been mailed to me, and at that point I was getting ready to give up my apartment (see: Eurotrip posts); and three, I had very mixed feelings about voting. The truth is, as much as I cared about the Canadian election, it felt strange to vote after so long away. And it felt wrong to vote in the riding for my official Canadian residence (AKA my parent’s house), a riding I’d never actually lived in*.

And lo did Justin Trudeau triumph over Stephen Harper, and (mostly) everyone rejoiced.

* Actually, their riding includes the town where I finished high school. I only found that out tonight when I pulled up the election maps. At the time, however, I didn’t know I’d ever lived in the riding.

3. In 2015 I was in Ireland for the marriage equality referendum. As a resident but non-citizen, I was ineligible to vote. It was quite the experience, tho, from Panti Bliss’s speech at the Abbey Theatre after the Iona Institute sued RTÉ to seeing Paddies from across the world — because voting had to be done in person — converge on Ireland to make their voices heard. And love won.

Posted in General, Ireland | Comments Off on Three Times I Didn’t Vote

Macbook Data Recovery

Last summer the hard drive on my Macbook suddenly stopped booting. After panicking, I took it into work and was able to figure out a way of recovering my data, formatting the hard drive, and restoring Mac OSX without too much trouble.

Guess what happened again last night.

Stuff needed

  • USB storage (hard-drive, thumbstick, whatever)
  • A target computer (optional)

Step one: Boot into recovery mode. This is done by holding down the “Command” and “R” keys while booting. You should get a window titled “OS X Utilities”, with four options: “Restore From Time Machine Backup”, “Reinstall OS X”, “Get Help Online”, and “Disk Utility”.

Step two: Attempt to recover the drive. Click “Macintosh HD” in left pane. The right pane should give you a button to “Verify Disk”. Follow the suggestions to repair your disk. In my experience, these steps fail, but if they work for you, then you’re probably golden.

Assuming repairing the disk fails…

Step three: Mount your drives. You should see both the Macintosh HD and your USB drive in the left pane. Mount both. If necessary, you can format your USB drive to HFS first. This will probably be required.

Step four: Open the terminal. If you go back to the main window (in other words, close the Disk Utility programme), the menubar will have a “Utilities” drop down. Choose “Terminal”.

Step five: Copy over the files. Everything you care about should be under /Volumes/Macintosh HD/User/. Your USB drive should be mounted to something like /Volumes/Untitled (or a different path, if you gave it a proper name).

Step six: Verify recovered data. On another PC, mount your USB drive and make sure the data was successfully copied over. If you’re in Windows, you can use HFSExplorer to read the HFS filesystem. Note: If you can’t find the USB drive under “File” -> “Load filesystem from device”, open the programme again in administrator mode.

Step seven: Reformat and reinstall. Go nuts. You can do this stuff through the “OS X Utilities” window. I did this, and it worked for about a year. This time I think I’ll throw Linux on instead.

Posted in General | Tagged | Comments Off on Macbook Data Recovery

Multiplication Workshop

I’ve been playing Human Resource Machine. It’s awesome! It’s a little silly that I’ve been relaxing after a long day of coding by… doing assembly programming, but it’s a fun game.

Anyway, I’ve been hung up at the optimization challenges for Year 20: Multiplication Workshop.

The challenge: For each two things in INBOX, multiply them and OUTPUT the result. Don’t worry about negative numbers for now.

Optimization challenges:

  1. Use 15 or fewer commands
  2. Complete in 109 or fewer steps.

The first challenge was easy. The second was not. But I’m finally there, so… here’s my solution!

FYI:

  • Register 0 is my counter
  • Register 9 is initialized to “0”.
  • Register 1 is a copy of the number to add in the multiplication loop
  • Register 2 is the final result.

There’s a little bit of trickery. If either input number is a zero, it jumps to an early exit. If the operand being used as a counter is larger than the other operand, we swap them. And to speed up the mulitiplication loop, I negate counter to take advantage of the “jumpn” command, or “jump if the current value in the accumulator is negative”. So the “BUMPUP” instruction increments the counter and copies the new value to the accumulator, and if it’s zero we exit.

Whee!

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
b:
    INBOX         ; read first input
    JUMPZ    f    ; jump to label f if zero
    COPYTO   2
    INBOX         ; read second input
    JUMPZ    g    ; jump to label g if zero
    COPYTO   0
    SUB      2    ; this bit compares the two numbers...
    JUMPN    h
    ; in this branch, the current value of the counter is bigger than the
    ; other operand. Let's switch!
    COPYFROM 0    
    COPYTO   1
    COPYFROM 2
    COPYTO   0
    COPYFROM 1
    COPYTO   2
c:
    ; because register 2 already equals register 1 (instead of "0"),
    ; reduce the counter by one.
    BUMPDN   0
    JUMPZ    e ; jump for an early exit if the counter is zero
    SUB      0 ; make the counter negative for a faster loop
    SUB      0
    COPYTO   0
d:
    COPYFROM 1 ; the main addition loop
    ADD      2
    COPYTO   2
    BUMPUP   0
    JUMPN    d ; we keep looping until the counter is zero
e:
    COPYFROM 2 ; output the value in register two
    OUTBOX  
    JUMP     a ; go back for new input

; This label is if the first value is zero
f:
    INBOX      ; dump
    COPYFROM 9 ; copy zero from register

; This label is used if the second value is zero
g:
    OUTBOX  
    JUMP     b

; This is a shortcut to copy the second operand to the result,
; then jump back to the bit where we negate the counter.
h:
    COPYFROM 2
    COPYTO   1
    JUMP     c
Posted in Code | Comments Off on Multiplication Workshop

TK MAX MEETUP GROUP 4 LYFE

I wrote this the day after the “The Imitation Game” meetup (November 22nd, 2014). The fellow who usually wrote the post-mortems wasn’t there, and I had to record an excellent evening. And thus I reproduce it here for safe-keeping:

OK, I’ll try my hand at a post-mortem.

The three of us got together for the movie, which was very well crafted and Cumberbatch-y and not that good, in my opinion. The others disagree. Subsequently we had drinks at The Church, where we diligently protected the reservation for the 8:45 TK Max Christmas Party (our coworkers didn’t appear ’til much later), debated dystopias, complained about a fictional coworker, taught me how to pass as Irish, and subjected ourselves to increasing amounts of bass and songs about asses ’til we called it a night.

TK MAX MEETUP GROUP 4 LYFE

Posted in Ireland | Comments Off on TK MAX MEETUP GROUP 4 LYFE