Skip to content

Instantly share code, notes, and snippets.

@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 / 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,
# zsh crap
#
# include git info in the prompt
parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# see: http://www.cims.nyu.edu/cgi-systems/info2html?(zsh)Prompt%2520Expansion
#!/usr/bin/env ruby
# a small ghostscript wrapper to convert
# multiple pdf files into one single pdf
# 20090219 Noah K. Tilton <noah@downbe.at>
if ARGV.length < 1
puts "Usage: ./#{$0} <input pdf,[. . .]> <output pdf>"
exit
end
#!/bin/sh
# implements purge algorithm for one slave
# see: http://dev.mysql.com/doc/refman/5.0/en/show-binary-logs.html
master=host1
slave=host2
username=user
password=pass
poll imap.google.com
protocol IMAP
user 'myuser@gmail.com' there with
password 'mypass' keep ssl
mda '/usr/bin/procmail -d %T'
:0
*^content-Type:
{
:0fw
| /usr/local/bin/scanner_cache.py | mail -s "Scanner Cache" me@mydomain.com 2>&1
}
#!/usr/bin/env python
import os
import sys
import datetime
import email
import mimetypes
# attachment root directory