Skip to content

Instantly share code, notes, and snippets.

@noah
noah / gist:8485438
Created January 18, 2014 02:45
# N.K. Tilton <code@tilton.co> # LICENSE: MIT # # summarize music directory # # point it at a directory to find out which directories contain .mp3 # and/or .flac files, respectively
#!/bin/zsh
# N.K. Tilton <code@tilton.co>
# LICENSE: MIT
#
# summarize music directory
#
# point it at a directory to find out which directories contain .mp3
# and/or .flac files, respectively
@noah
noah / gist:49b92bf6d7269070e57e
Created May 13, 2014 06:02
html-to-markdown.rb
#!/usr/bin/env ruby
#
%w[nokogiri open-uri chronic].each{|lib| require lib}
base = "https://blog.tilton.co"
doc = Nokogiri::HTML open "#{base}/archive.html"
doc.search('section.archives a').each do |post|
post_link = post[:href]

Keybase proof

I hereby claim:

  • I am noah on github.
  • I am nt (https://keybase.io/nt) on keybase.
  • I have a public key whose fingerprint is 8A7B BF7B B3A9 49A8 53B6 68B0 C3D7 A4A5 2266 0FC3

To claim this, I am signing this object:

@noah
noah / syncbit.sh
Created July 23, 2014 15:39
repeatedly attempt to synchronize fitbit using galileo
#!/bin/sh
out=
while [ -z "$out" ]; do
echo "$(date) syncing..."
cmdout="$(galileo --upload --https-only -d --force 2>&1)"
#echo "cmdout: $cmdout"
out="$(echo $cmdout|grep 'Synchronisation sucessfull')" # sic
#echo "out: $out"
@noah
noah / rmmail
Created August 18, 2014 14:38
delete remote imap folders (offlineimap)
% cat $(which rmmail)
#!/bin/bash
if [ $# -ne 1 ]; then
echo "usage: $(basename $0) foldername"
exit
fi
if [ -n "$1" ]; then
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
@noah
noah / networkconfig.txt
Created October 4, 2015 22:43
network config files for raspberry pi USB-N53
pi@host ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
wpa-ssid myessid
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.1.xxx
@noah
noah / offlineimap-rm.sh
Created February 20, 2016 18:09
offlineimap-rm: remove mail directories, including offlineimap metadata
#!/bin/sh
user=noah
MDIR=~/mail
ODIR=~/.offlineimap
A=Account-$user/LocalStatus
RL=Repository-Local/FolderValidity
RR=Repository-Remote/FolderValidity
@noah
noah / 2pod.sh
Created May 2, 2016 17:00
# recursively convert all flac to mp3 and add to ipod
#!/bin/sh
# recursively convert all flac to mp3
#
for dir in "$@"; do
echo "+ $dir"
find "$dir" -type f -name "*.flac"\
| parallel -u\
ffmpeg -v warning -n -i {} -qscale:a 0 {.}.mp3
done
@noah
noah / BlockSpammer.py
Last active July 7, 2016 14:15
Programmatically add entries to postfix sender_access file.
#!/usr/bin/env python2
import sys
import smtplib
from subprocess import call
from email.parser import Parser
from email.utils import parseaddr, make_msgid
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart