Skip to content

Instantly share code, notes, and snippets.

$ set -- one 'foo bar' three
$ ruby -e 'puts ARGV.count, ARGV.last' "$@ extra"
3
three extra
$ args="$@ extra"
$ ruby -e 'puts ARGV.count, ARGV.last' "$args"
1
one foo bar three extra
$ ruby -e 'puts ARGV.count, ARGV.last' $args
5
#!/bin/sh
# -*- tab-width: 30 -*-
# list shamelessly stolen from http://unicodeemoticons.com/
selecta <<'EOF' | cut -f 1 | tr -d '\n' | tr '\a' '\n' | pbcopy
☺ smiley face
☻ smiley face
✌ V sign
☹ unhappy
♡ heart
@decklin
decklin / peach-backup-readme.md
Last active March 1, 2017 01:14
Using peach-backup

Using peach-backup

Hi, happy Peach-iversary, etc. I wrote this script to backup my Peach stream. To run it you have to open up Terminal and run commands; sorry! If you know me, I can help with that, otherwise find someone who can walk you through it. Everything here assumes you have a Mac. If you're on Linux, you can probably get it to work. Windows, unfortunately, I'm not sure.

Commands that you should copy from this page, one line at a time (in order!), and paste into your terminal, pressing Enter after each line, look like this:

echo "This is a command you can run! You did it!"

You can try that one now. It should reply with the part in quotation marks.

I wanted to extract my OTP secrets from Authy, so that I could install them on my preferred OTP generator. I found this gist by Indrek Ardel, based on another by Brian Hartvigsen, which were very thorough, but had out-of-date console instructions and sent your secret data through a Google QR code image-generator service. Thankfully, the general principle still works, with some simplification. Turn on developer mode for Chrome extensions and open the JS console for the Authy Chrome app's main.html, and enter:

appManager.getDecryptedApps().forEach(a => { console.log(a.name + ': ' + a.secretSeed); });

This will display the hex-encoded seed for each service that you have configured with Authy. Copy the one you want.

To generate a OTP with that seed (in hex! You don't need to convert to Base32 for oathtool, which is available in Homebrew as part of the oath-toolkit fo