The Smallest Javascript Library In The Solar System

  • Marshall
    Posted 4 years ago

    You can find me on Keybase now.

git alias finder (aka: git finda)

A long time ago, I had found Brett Terpstra’s One git Alias To Rule Them All. His alias, git finda [text], prints a nicely formatted table consisting of all git aliases you have defined. This worked well on Mac OSX, but the printf statements to pad/justify the alias name never worked for me on either Windows or Linux. I’ve tweaked his alias slightly and ended up with something that works on both Windows and Linux.

finda = "!grepalias() { git config --global --get-regexp alias | grep -i \"$1\" | awk -v nr=2 '{sub(/^alias\\./,\"\")};{printf \"\\033[31m%12.12s\\033[1;37m\", $1};{sep=FS};{for (x=nr; x< =NF; x++) {printf \"%s%s\", sep, $x; }; print \"\\033[0;39m\"}'; }; grepalias"


The concept: If you are a good pianist, then you will be good at this version of Street Fighter.

The project has a really nice writeup on foobarfiles.

Seed RequestPolicy from 1Password

I recently rebuilt my laptop from scratch, and while installing the most excellent NoScript, someone suggested to install RequestPolicy as a companion extension. I have played with RequestPolicy in the past but ended up uninstalling it for one reason or another. I was about to uninstall it again after having to continuously toggle policies on things for new websites I visited (this being a fresh install of everything).

I decided to try to seed RequestPolicy with a list of domains from 1Password. Both 1Password and RequestPolicy have plain-text import/export mechanisms, so I fired up ruby and wrote a simple little script to take the 1Password export of the ‘URL/Location’ field, and convert it to a format which RequestPolicy likes.

In order to use the following script, you will need the following:

1. Ruby
2. This Gist
3. Export ONLY your 1Password ‘URL/Location’ field. Open 1Password and click on the File -> Export All -> Text File… and uncheck all but the ‘URL/Location’ field. (This is very tedious, but you only have to do it once)

Export 'URL/Location' field

Once you are set, fire up the script like so:

# chmod u+x 1p2rp.rb
# ./1p2rp.rb --in /path/to/1password/export.file --out /path/to/save/request_policy_import.file

Once complete, import /path/to/save/request_policy_import.file into RequestPolicy using the Import function of the extension. Enjoy your 1Password saved websites being white-listed by default.

Chile Colorado

Yesterday we went to our local Cha Cha Cha where I discovered this wonderful burrito dubbed the Chile Colorado, which consisted of slow cooked beef in guajillo sauce. I never knew this flavor existed before!