Skip to content

Instantly share code, notes, and snippets.

View paulsmith's full-sized avatar
😀
Hi, friends

Paul Smith paulsmith

😀
Hi, friends
View GitHub Profile
@paulsmith
paulsmith / keybase.md
Created March 7, 2014 01:52
keybase proof

Keybase proof

I hereby claim:

  • I am paulsmith on github.
  • I am paulsmith (https://keybase.io/paulsmith) on keybase.
  • I have a public key whose fingerprint is ADE0 B338 6493 A843 A705 6F90 3632 F0EE 0AF0 D06B

To claim this, I am signing this object:

@paulsmith
paulsmith / pre-commit
Created September 4, 2013 20:26
gofmt git pre-commit hook
#!/bin/bash
if git rev-parse HEAD >/dev/null 2>&1; then
FILES=$(git diff --staged --name-only | grep -e '\.go$')
else
FILES=$(git ls-files -c | grep -e '\.go$')
fi
for file in $FILES; do
if test -n "$(gofmt -l $file)"; then
echo "Error: git pre-commit failed, file needs gofmt: $file"
@paulsmith
paulsmith / uni-ascii-translit.txt
Last active February 15, 2019 19:55
Unicode code points transliterated into ASCII characters (using `iconv(1)`). The code points are the printable (i.e., non-control) characters in the Latin-1 Supplement and Latin Extended-A blocks. The first column is the code point in decimal, then code point in hex, then the Unicode character, finally the ASCII transliterated character(s).
160 U+00a0  
161 U+00a1 ¡ !
162 U+00a2 ¢ c
163 U+00a3 £ lb
165 U+00a5 ¥ yen
166 U+00a6 ¦ |
167 U+00a7 § SS
168 U+00a8 ¨ "
169 U+00a9 © (c)
170 U+00aa ª a
@paulsmith
paulsmith / logproxy.go
Created July 11, 2013 04:05
Logging TCP proxy, with SSL/TLS support
package main
import (
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net"
"os"
@paulsmith
paulsmith / appendgopkg.vim
Created April 29, 2013 18:00
A simple Vim command to quickly append a package to the list of imports in a Go source code file.
" AppendGoPackage() prompts you for the name of a Go package, searches for
" the import statement at the top of the file, appends the package to the
" list of names, and restores the cursor's location.
function! AppendGoPackage()
call inputsave()
let s:pkg = input("Go package: ")
call inputrestore()
let s:cmd = "normal! ma?^import (\<CR>%O\t\"" . s:pkg . "\"\<ESC>`a"
execute s:cmd
endfunction
@paulsmith
paulsmith / gifted-and-talented-cocktail.md
Created April 14, 2013 22:12
The Gifted & Talented cocktail

The Gifted & Talented

An improved gin and tonic.

Ingredients

  • Cucumber medallion, peeled, on the thick side
  • 3-4 drops Scrappy’s lime bitters
  • 3-4 drops Scrappy’s grapefruit bitters
  • 2 oz. Plymouth gin
@paulsmith
paulsmith / shoddy-cocktail.md
Created March 31, 2013 20:56
The Shoddy cocktail

The Shoddy

Ingredients

  • 1-½ oz. Bulleit bourbon
  • ¼ oz. Bénédictine
  • ¼ oz. simple syrup
  • 2-3 dashes Peychaud’s bitters
@paulsmith
paulsmith / brew-doctor.log
Created March 29, 2013 18:13
brew install tmux (fails for version 1.8 stable on Mac OS X 10.6.8)
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Mapnik.framework/Programs/mapnik-config
@paulsmith
paulsmith / henrietta-cocktail.md
Last active December 13, 2015 18:49
The Henrietta cocktail

The Henrietta

Ingredients

  • 1-½ oz. Bulleit bourbon
  • ½ oz. St. Germain elderflower liquer
  • ½ oz. lemon juice
  • ¼ oz. simple syrup
@paulsmith
paulsmith / oscars-2013-raw.txt
Last active December 10, 2015 23:18
Parsing a list of 2013 Oscar nominees into CSV. (The raw text is formatted strangely w.r.t. case because it was copy-pasted from a PDF.)
BEST PICTURE
Amour
TBD, Producer
Argo
Grant Heslov, Ben Affleck and George Clooney, Producers
BeAsts of the southern Wild
Dan Janvey, Josh Penn and Michael Gottwald, Producers
djAngo unchAined
Stacey Sher, Reginald Hudlin and Pilar Savone, Producers
les misérABles