Archive by Author | Kris Hom

Backup Shazam Tags from Android without Root


1. Connect your phone via USB and backup Shazam data files. The adb command is part of the Android SDK. You will need to change the package name “” to “” if you have the free version.

adb backup -f

2. Convert the backup file to a tar file.

dd bs=1 skip=24 | openssl zlib -d >

3. Extract the tar file.

tar -xvf

4. Export the data from the database using sqlite.

$ sqlite3 ./apps/
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .output tags.sql
sqlite> .dump
sqlite> .exit

5. Or export csv data with this sql from spectas

$ sqlite3 ./apps/
sqlite> .mode csv
sqlite> .output tags.csv
sqlite> SELECT , t.title, t.subtitle, t.album, t.subgenre_name, tg.short_datetime, tg.location_name,, tg.lon 
FROM artist a, artist_track at, track t, tag tg
WHERE = at.artist_id AND at.track_id = t._id AND tg.track_id = t._id ORDER BY tg.timestamp;
sqlite> .exit

Animated GIF with ImageMagick

Installing ImageMagick on OS X

Like the ImageMagick docs, I recommend using MacPorts but here are the steps to install just the binary release.

  1. Start in your home dir
    cd $HOME
  2. Download the ImageMagick-x86_64-apple-darwin12.4.0.tar.gz binary release from
    curl -O ""
  3. Extract the files
    tar -xvf ImageMagick-x86_64-apple-darwin12.4.0.tar.gz
  4. Export paths (change the ImageMagick version number 6.8.6 to the version you have)
    export MAGICK_HOME="$HOME/ImageMagick-6.8.6"
    export PATH="$MAGICK_HOME/bin:$PATH"
    export LD_LIBRARY_PATH

Creating the Animated GIF

This assumes you have source frames that match *.png (change this as needed)

  1. The -layers OptimizeFrame argument will save the smallest bounding rectangle that has changed in each frame
    convert -layers OptimizeFrame -loop 0 *.png output.gif
  2. You can also try -layers OptimizeTransparency to possibly reduce file size by only saving the pixels that changed between each frame
    convert -layers OptimizeTransparency -loop 0 *.png output.gif
  3. The -delay argument can be used to specify the time between frames in 1/100ths of a second

Additional Resources

Android Emulator with Google Play Store

  1. Download and extract the Android SDK.
  2. Connect your physical Android phone via USB.
  3. Download apk files. Note that Phonesky.apk may be called Vending.apk on older phones.
    $ for file in GoogleLoginService.apk GoogleServicesFramework.apk Phonesky.apk; do sdk/platform-tools/adb pull /system/app/$file; done
  4. Unplug your Android phone. This prevents error: more than one device and emulator when copying the apk files.
  5. Start the emulator, replacing <avd> with the name of your avd.
    $ sdk/tools/emulator -avd <avd> -partition-size 384 &
  6. Copy apk files (after emulator starts).
    $ sdk/platform-tools/adb remount && for file in GoogleLoginService.apk GoogleServicesFramework.apk Phonesky.apk; do sdk/platform-tools/adb push $file /system/app; done
  7. Open the Play app and log in with a Google account.

I used apk files from a Galaxy Nexus running 4.2.1 Jelly Bean and Google Play Store version 4.1.10. My avd is Android 4.2.2 – API Level 17 Intel Atom (x86).
Android AVD Settings

IceWM on Cygwin

Back when I was an intern at IBM, all the cool kids ran IceWM on top of Cygwin as their X11 window manager. Since there’s no pre-built package, you have to build it from source. Here’s what worked for me:

Compile IceWM on Cygwin

If you don’t care to run a separate window manager, the Cygwin environment, or a local xterm, VcXsrv Windows X Server is my favorite alternative and comes with PuTTY plink.exe to handle SSH.

I’m Feeling Bucky

25th Anniversary of the Buckyball

An interactive doodle built in HTML, CSS, and JavaScript for the 25th Anniversary of the Buckyball.

Pac-Man 30th Anniversary Doodle

Pinky plush toy, the Pac-Man board game, and the game running on an iPad

By far the coolest project I’ve worked on. It’s no longer on the homepage, but you can still play at
Marcin also has some more photos here

Android Emulator with Market App

UPDATE: See the new version at

Download Android SDK

  1. Go to
  2. Download the SDK for your platform
  3. Unzip the files

Create an Android Virtual Device (AVD)

  1. To launch the Android SDK and AVD Manager on Windows, execute SDK Setup.exe, at the root of the SDK directory. On Mac OS X or Linux, execute the android tool in the <sdk>/tools/ folder.
  2. Under “Installed Packages” click [Update All…]
  3. Read 😉 and accept all end user license agreements
  4. Click [Install]
  5. Switch to the “Virtual Devices” page
  6. Click [New…]
  7. Enter a name (i.e. MyPhone)
  8. Target: Android 1.6 -API Level 4
  9. SD Card Size 96 MiB (or more if you want)
  10. Click [Create AVD]

Install HTC System Image

This step will add the Market app to your AVD.

  1. Go to
  2. Download in the Android 1.6 section
  3. Unzip the file and copy system.img to the AVD folder. To locate the AVD path, select your AVD in Android SDK and AVD Manager and click [Details…]. On Mac OS X or Linux the AVD should be at ~/.android/avd/MyPhone.avd/ where MyPhone is the phone name you chose when you created the AVD.
  4. Select your AVD in Android SDK and AVD Manager and click [Start…]
  5. Use the default settings
  6. On the first boot, the tutorial asks you to slide out the keyboard. Do this using Ctrl-F11 or Ctrl-F12 (see the Keyboard Mappings section below).
  7. If your AVD does not have an internet connection when it boots (sometimes it takes a while) try restarting the emulator.

Keyboard Mappings

<sdk>/tools/emulator -help-keys

HOME Home button
F2, PAGEUP Menu (Soft-Left) button
Shift-F2, PAGEDOWN Star (Soft-Right) button
ESCAPE Back button
F3 Call/Dial button
F4 Hangup/EndCall button
F7 Power button
F5 Search button
KEYPAD_PLUS, Ctrl-F5 Volume up button
KEYPAD_MINUS, Ctrl-F6 Volume down button
Ctrl-KEYPAD_5, Ctrl-F3 Camera button
KEYPAD_7, Ctrl-F11 switch to previous layout
KEYPAD_9, Ctrl-F12 switch to next layout
F8 toggle cell network on/off
F9 toggle code profiling
Alt-ENTER toggle fullscreen mode
F6 toggle trackball mode
DELETE show trackball
KEYPAD_5 DPad center
KEYPAD_4 DPad left
KEYPAD_6 DPad right
KEYPAD_8 DPad up
KEYPAD_2 DPad down
KEYPAD_MULTIPLY increase onion alpha
KEYPAD_DIVIDE decrease onion alpha

Convert mp4 and flv video to mp3 with VLC

Download VLC at

NOTE – FLV transcoding does not work in version 2.0.4. Make sure you’re using the most recent release.

Mac OS X Terminal

/Applications/ -I dummy "/Users/yourname/Music/Input File.mp4" --sout='#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst="/Users/yourname/Music/Output File.mp3"}' vlc://quit

Mac OS X Terminal (Multiple Files)

for file in /Users/$USER/Music/*.mp4; do /Applications/ -I dummy "$file" --sout="#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst=\"$(echo "$file" | sed 's/\.[^\.]*$/.mp3/')\"}" vlc://quit; done


  1. Open VLC
  2. File > Streaming/Exporting wizard…
  3. Transcode/Save to file
  4. Next
  5. Choose an input file under “Select a stream” or “Existing playlist item”
  6. Next
  7. Check “Transcode video”
  8. Codec: Dummy
  9. Check “Transcode audio”
  10. Codec: MP3
  11. Bitrate (kb/s): 128
  12. Next
  13. Encapsulation format: RAW
  14. Next
  15. Choose a destination file ending in .mp3. Note that if you click Browse, it will force you to use .raw, so choose both .mp3.raw and delete .raw in the input field.
  16. Next
  17. Finish

Windows Command Prompt

Change “C:\Input File.flv” and “C:\Output File.mp3”.

"%ProgramFiles%\VideoLAN\VLC\vlc.exe" "C:\Input File.flv" --sout=#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst="C:\Output File.mp3"} vlc://quit

Windows Command Prompt (Multiple Files)

Change %USERPROFILE%\Music to the directory containing the files to convert (make sure you keep the \*.* at the end).

for %a in ("%USERPROFILE%\Music\*.*") do "%ProgramFiles%\VideoLAN\VLC\vlc.exe" "%a" --sout=#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst="%a.mp3"} --intf=dummy --verbose=2 --play-and-exit

Note that this command will spawn multiple instances of VLC and convert each file in parallel, which can take a lot of CPU. I attempted to fix this using “–one-instance –playlist-enqueue” but the destination file does not get updated. As a workaround, you can throttle the invocations by adding this to the end of the command:

 && choice /T 30 /D y /M "Waiting 30 seconds..."

Windows GUI

  1. Open VLC
  2. Media > Convert / Save…
  3. Click [Add…] and select an input file
  4. Click [Convert / Save]
  5. Under “Destination” enter a destination file ending in .mp3
  6. Under “Settings” click the button with alt text “Create a new profile” to the right of the red “X”
  7. Enter a Profile Name (i.e. “MP3 Only”)
  8. On the /Encapsulation\ tab select “RAW”
  9. On the /Audio Codec\ tab check “Audio”
  10. Codec: MP3
  11. Bitrate: 128 kb/s
  12. Channels: 2
  13. Sample Rate: 44100
  14. Click [Save]
  15. Under “Settings” select the profile name from Step 7 (i.e. “MP3 Only”)
  16. Click [Start]

Instructions were written for VLC 1.0.5 “Goldeneye”

Day 9 – Grey Shirt Day – Round 2

I remembered. We’ll see if jchang did as well…

Day 8 – Return of the Micro Kitchen!

This morning I went rummaging through the nearest micro kitchen and was delighted to find regular and peanut M&M’s, Pepperidge Farm Milano Cookies, Famous Amos Cookies, diet/regular RedBull and tons of Starbucks iced coffees. I was almost maintaing a constant weight for a bit there, but now it’s climbing steadily once again. Good thing today is tennis day.

I’m counting calendar days instead of weekdays, since I have a tendency to work weekends and also don’t want to do a seven-fifths conversion to figure out how long I’ve been here.

So far my experience at Google has been basically this: Here’s all the food you could ever eat, whatever hardware and software you desire, and the project of your dreams. Have fun.