Skip to content

Instantly share code, notes, and snippets.

View nerab's full-sized avatar

Nicholas E. Rabenau nerab

View GitHub Profile
@nerab
nerab / journal.markdown
Last active August 29, 2015 14:25
Journal
  • yes keeps repeating a command
  • Run a quick throwaway container

docker run -it busybox

@nerab
nerab / hello-blink1.markdown
Created October 22, 2014 17:15
hello blink1
~/$ git clone https://github.com/todbot/blink1.git
Cloning into 'blink1'...
remote: Counting objects: 8363, done.
remote: Total 8363 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (8363/8363), 79.39 MiB | 3.57 MiB/s, done.
Resolving deltas: 100% (4286/4286), done.
~/$ cd blink1/commandline/
~/blink1/commandline$ sudo apt-get install libusb-dev
Reading package lists... Done

Building dependency tree

@nerab
nerab / raspi-ympd.markdown
Created September 25, 2014 19:49
Installing ympd on the Raspberry Pi

ympd on the Raspberry Pi

Due to its small size, ympd is well-suited to run on the Raspberry Pi. Installing it is pretty straightforward:

git clone https://github.com/notandy/ympd.git
cd ympd/
sudo apt-get install cmake libmpdclient-dev
mkdir build
cd build
@nerab
nerab / gist:8217397
Created January 2, 2014 10:30
Bulk edit taskwarrior tasks by UUID
for t in $(task _uuid status:pending pro:Backup); do
task $t done
done
@nerab
nerab / read_keychain.bash
Created May 5, 2012 22:36
Read MacOS keychain in a shell function
function keychain(){
# Keychain access idea from https://github.com/defunkt/gist
if [ "$1" ]; then
security 2>&1 >/dev/null find-internet-password -gs "$1" | ruby -e 'puts $1 if STDIN.gets =~ /^password: \"(.*)\"$/'
else
echo No argument given. The following passwords are in your chain: >&2
security dump-keychain | ruby -e 'ARGF.each_line{|line| puts $1 if line =~ /\"srvr\"<blob>=.(.*).$/}'
fi
}
@nerab
nerab / jeg2_consume_csv.rb
Created May 5, 2012 22:32
Produce and consume CSV with Rails
# from http://speakerdeck.com/u/jeg2/p/10-things-you-didnt-know-rails-could-do slide 64
require "csv"
namespace :users do
desc "Import users from a CSV file"
task :import => :environment do
path = ENV.fetch("CSV_FILE") {
File.join(File.dirname(__FILE__), *%w[.. .. db data users.csv])
}
CSV.foreach(path, headers: true, header_converters: :symbol) do |row|
@nerab
nerab / mail2kindle.md
Created November 30, 2011 21:12
Send eBooks to a Kindle from the MacOS command line
  1. Install msmtp, a simple sendmail stand-in that sends mail via a relay host (which is what you want, in almost all cases):

     brew install msmtp --with-macosx-keyring
    

    The flag with-macosx-keyring will make msmtp use the MacOS keychain, which is a pretty secure way to keep your mail account password secure.

  2. Configure it as described in this article. Don't use the manual installation method described there, Homebrew (which we used in step 1) is way more convenient.

  3. Have mail use msmtp instead of sendmail by creating .mailrc with the following content (or adding it, it the file already exists):