Skip to content

Instantly share code, notes, and snippets.

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 / 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]
@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 / rtomv
Created October 31, 2013 11:24
mv(1) for rtorrent(1)
#!/usr/bin/env python2
print "ohai"
#!/usr/bin/env ruby
# encoding: utf-8
#
require 'bencode'
# print the list of files which are in a given directory, but not currently seeding in rtorrent
#
# This script answers the question / problem:
# "I have a ton of stuff downloading in rtorrent, and it's all going
# into one directory. What stuff from that directory can be safely
@noah
noah / mylsusb
Created February 11, 2012 02:30
Bus 002 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
#!/bin/zsh
while [[ $# -gt 0 ]]; do
filename=$(basename $1)
new_filename=''
year=$(echo $filename | sed -n -e 's/.*\([0-9]\{4\}\).*/\1/p')
if [[ ! -z $year ]]; then
new_filename=$year
\documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{fontspec}
\setromanfont{Liberation Serif}
\begin{document}
hello world
\end{document}
#!/usr/bin/env python
SESSION_DIR = '/path/to/.sessions'
# ^ should match session_path from .rtorrent.rc
MV_DIR = '/downloads/complete/tracker1.com'
# ^ Change this to path these files should have been moved to
import os
import sys
directory = /download/queue
. . .
schedule = watch_directory_1,5,5,"load_start=/download/torrents/tracker1.com/*.torrent,d.set_custom1=/download/tracker1.com/"
schedule = watch_directory_2,5,5,"load_start=/download/torrents/tracker2.com/*.torrent,d.set_custom1=/download/tracker2.com/"
system.method.set_key =event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
. . .