Skip to content

Instantly share code, notes, and snippets.

@SamWhited
SamWhited / get_test.sh
Created March 6, 2012 20:29
Continuously make requests to a server with curl and measure the request frequency with pv
#!/usr/sbin/env bash
while true; do
curl $1 -s > /dev/null
echo .
done | pv -l > /dev/null
@SamWhited
SamWhited / if-news-snippet
Created March 9, 2012 00:07
Radiant snippet for inserting content on pages whose path contains a date (Archive page)
<r:hide>
Insert content only if we're viewing a news item.
Matches any path that contains "/news/yyyy/mm/dd/"
</r:hide>
<r:if_path matches="\/news\/(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\/" ignore_case="true">
<r:yield />
</r:if_path>
@SamWhited
SamWhited / email.md
Created March 20, 2012 21:54
My email in a fun, spam-bot-defeating, format.

This is my email:

echo sam.samwhited.com | sed 's/\./@/'

Also this:

echo sam.samwhited.com | awk '{sub(/\./,"@")}; 1'
@SamWhited
SamWhited / links.md
Created April 20, 2012 21:41
Strange pages on SamWhited.com
@SamWhited
SamWhited / hyperref.tex
Created April 23, 2012 18:42
The proper options for the hyperref LaTeX package
% Because I can never remember how to get rid of the borders on all systems...
\usepackage[pdfborder=0, bookmarks, colorlinks=false]{hyperref}
@SamWhited
SamWhited / LSJAP.tex
Created May 11, 2012 18:23
The Love Song of J. Alfred Prufrock by T.S. Eliot (1915)
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\documentclass[a4paper,11pt]{article}
% Use [PoetryTeX](http://samwhited.github.com/poetrytex/).
\usepackage{poetrytex}
% Use the PA5 paper size
\usepackage[paperwidth=140mm,paperheight=210mm]{geometry}
@SamWhited
SamWhited / qc.sh
Created June 6, 2012 20:38
Downloads Questionable Content (http://questionablecontent.net/)
#!/usr/bin/env bash
for i in $(eval echo {$1..$2})
do
curl "http://questionablecontent.net/comics/$i.png" > "QuestionableContent/$i.png"
done
@SamWhited
SamWhited / gitparse.tex
Created July 16, 2012 02:07
Make LaTeX git-aware
% A few example commands for a more git-aware LaTeX.
% Note that this requires you to run pdflatex/xelatex/etc. with the
% `--shell-escape' option which is extremely unsafe. Use with care
% and *never* use with plain TeX.
% Print the short-hash of the current commit
\newcommand*{\gitrev}{%
\immediate\write18{%
rm gitrev.tex 2> /dev/null; git rev-parse --short HEAD > gitrev.tex
}%
@SamWhited
SamWhited / 0001-Remove-titlecase-from-blockquote.patch
Created August 5, 2012 03:29
Remove titlecase from Brandon Mathis' blockquote plugin
From 9b679e42b946eb140d2c57a7ec4afa6d42d1d097 Mon Sep 17 00:00:00 2001
From: Sam Whited <[email protected]>
Date: Sat, 4 Aug 2012 23:27:41 -0400
Subject: [PATCH] Remove titlecase from blockquote
---
plugins/blockquote.rb | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb
@SamWhited
SamWhited / PorUnaCabeza.tex
Created August 5, 2012 23:48
Side-by-side translation of `Por Una Cabeza' by Carlos Gardel using poetrytex and paracol.
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8
\documentclass[11pt]{article}
% Use UTF-8
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% Use [PoetryTeX](http://www.ctan.org/pkg/poetrytex) and paracol.