Skip to content

Instantly share code, notes, and snippets.

@SamWhited
SamWhited / post_commit_btproof.sh
Last active December 17, 2015 21:38
Send a small ammount of money via bitcoin after making a git commit so that the blockchain can be used to verify the time at which the commit was made (https://www.btproof.com/)
#!/bin/bash
# What this does:
#
# This is an untested (I have no idea what the syntax is for bitcoind, so this probably doesn't actually work;
# it's just an idea) post-commit hook for sending a bitcoin transaction. This allows one to use the bitcoin
# blockchain for trusted timestamping of git commits. This might be useful if you expect a bogus copyright claim,
# or want to make sure you have proof that you started a project before working for a company or going to a school
# that likes to seize intellectual property from their employees and claim it was developed on their dime.
#
@SamWhited
SamWhited / fonts.sh
Created August 6, 2013 04:27
Some oneliners for manipulating fonts in TeXLive
# List fonts on the system
fc-list | cut -d ':' -f 2 | sort | uniq | sed 's/^\s*//g'
# Get name of all fonts in current directory
find -name '*.[to]tf' -exec otfinfo --family \{\} \; | sort | uniq
@SamWhited
SamWhited / StJamesInfirmary.ly
Last active December 25, 2015 02:49
Lilypond example
\version "2.16.2"
tuba = \relative c {
% Clef, key, midi instrument, etc. is set here
\clef bass
\key aes \major
\time 2/2
% The music...
R1*4 \bar "||:" \break
@SamWhited
SamWhited / Makefile
Last active November 17, 2019 19:30
Makefile for sheet music with LilyPond and LaTeX
SHELL = /bin/sh
.SUFFIXES:
.SILENT:
.PHONY: timidity clean
# If you want more output, change this.
REDIRECT = > /dev/null
SHEETMUSICDIR = Songs
AOBSHEETMUSICDIR = AOB/Songs
DRAFTSHEETMUSICDIR = Drafts/Songs
@SamWhited
SamWhited / README.md
Last active August 29, 2015 13:58
A simple server that accepts HTTP post requests

This is a simple server example that accepts geojson features as POST requests (fair warning, it does no validation to make sure anything is geojson conformant) and spits out a geojson file with all the features wrapped in a feature array.

This is just an example. It does lots of bad things (like reading / writing the entire file every time it gets a post request) and is easily abused. The authentication isn't exactly secure either. By default it listens on :2230.

@SamWhited
SamWhited / spec.md
Last active August 29, 2015 14:05
API spec for a simple, universal commenting system

Simple comments API 1.0.0-draft01

Copyright

This work is licensed under a [Creative Commons Attribution 4.0 International License][ccby].

Introduction

@SamWhited
SamWhited / lincolnletter.tex
Created October 14, 2014 14:14
Open letter to the city council of Lincoln
\documentclass{letter}
\signature{Sam Whited}
\address{Atlanta, GA}
\begin{document}
\begin{letter}{Lincoln Town Office \\ PO Box 25 \\ Lincoln, NH 03251}
\opening{To whom it may concern:}
@SamWhited
SamWhited / rendermontage.sh
Created October 20, 2014 18:40
Script to render a montage of many images with an overlay
#!/bin/sh
#
# Requires: ImageMagick
# Usage:
# rendermontage.sh thumbsize overlayimage outputimage
#
montage -geometry $1x$1>+0+0 *.{jpeg,jpg,png} $3
composite -gravity center -background none $2 $3 $3
@SamWhited
SamWhited / pubkeys.md
Last active July 18, 2017 02:16
Public Keys [NO LONGER UP TO DATE]

This gist is deprecated; some of the keys may still be used, but the fingerprints are no longer mirrored to two or more locations for verification.

PGP

9761 51DE E472 01CE 4A85 9F70 5408 3AE1 04EA 7AD3

Verification methods

@SamWhited
SamWhited / TimePreference.java
Created December 17, 2014 00:10
Time picker preference for Android
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TimePicker;
import java.text.DateFormat;
import java.util.Calendar;