Skip to content

Instantly share code, notes, and snippets.

@kgaughan
kgaughan / gist:9207738
Created February 25, 2014 12:14
Stack overflow redirects.
$ curl --head http://www.podtrac.com/pts/redirect.mp3/feeds.soundcloud.com/stream/135361168-stack-exchange-stack-exchange-podcast-54.mp3
HTTP/1.1 302 Found
Content-Length: 206
Location: http://feeds.soundcloud.com/stream/135361168-stack-exchange-stack-exchange-podcast-54.mp3
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 25 Feb 2014 12:04:14 GMT
$ curl --head http://feeds.soundcloud.com/stream/135361168-stack-exchange-stack-exchange-podcast-54.mp3
HTTP/1.1 301 Moved Permanently
#!/bin/bash
#
# Cleans up basic whitespace problems in .rst and .py files. Run before
# commits.
#
# Tabs to spaces.
for i in `fgrep -rl $'\t' --include=\*.py --include=\*.rst .`; do
if test -f $i; then
tmp=`mktemp`

Keybase proof

I hereby claim:

  • I am kgaughan on github.
  • I am talideon (https://keybase.io/talideon) on keybase.
  • I have a public key whose fingerprint is 59C0 C696 FC51 A3B6 ADE9 1408 682D 43CC CF9F 6473

To claim this, I am signing this object:

@kgaughan
kgaughan / fetch-ca-chain.sh
Last active August 29, 2015 13:58
Given an SSL/TLS certificate, walk all its intermediates to construct a CA bundle. This is a bit of a hack, but at least it more-or-less works.
#!/bin/sh
#
# Given an SSL/TLS certificate, walk all its intermediates to construct a CA bundle.
#
if test "x$1" = "x"; then
echo Please provide a certificate. >&2
exit 2
fi
if test ! -e $1; then
@kgaughan
kgaughan / test.rs
Created April 21, 2014 14:06
Experiment with unique pointers, pattern matching, union types, closures, and tasks.
enum List {
Cons(u32, ~List),
Nil,
}
fn main() {
let list = Cons(1, ~Cons(2, ~Cons(3, ~Nil)));
let mut head = ~list;
loop {
match head {
@kgaughan
kgaughan / gist:3b7889c4c20ca8657ce8
Last active August 29, 2015 14:08
Example emperor mode uWSGI configuration skeleton.
[uwsgi]
chdir = /home/keith/sites/weblogs
logto = /home/keith/sites/weblogs/logs/%n.uwsgi.log
master = true
threads = 5
socket = /var/run/uwsgi/weblog.%n.sock
pythonpath = /home/keith/sites/weblogs
env = LC_ALL=en_IE.UTF-8
env = LANG=en_IE.UTF-8
module = %n.wsgi:application
@kgaughan
kgaughan / gist:b7d64be13b06c7edf5b3
Last active August 29, 2015 14:08
Example standalone uWSGI config.
[uwsgi]
virtualenv = /path/to/my/virtualenv
chdir = /path/to/my/app
master = true
threads = 5
; Use a free port.
socket = localhost:6000
env = LC_ALL=en_IE.UTF-8
env = LANG=en_IE.UTF-8
module = mysite.wsgi:application
@kgaughan
kgaughan / gist:5196af89eca7d2a8ce69
Created December 6, 2014 16:41
Submission port test
234.<--220 lir.talideon.com ESMTP Postfix\r\n
372.-->EHLO from.com\r\n
377.<--250-lir.talideon.com\r\n
250-PIPELINING\r\n
250-SIZE\r\n
250-VRFY\r\n
250-ETRN\r\n
250-STARTTLS\r\n
250-ENHANCEDSTATUSCODES\r\n
250 8BITMIME\r\n
May 15 14:13:06 lir postfix/smtpd[86084]: connect from unknown[115.134.25.73]
May 15 14:13:06 lir postfix/smtpd[86084]: lost connection after CONNECT from unknown[115.134.25.73]
May 15 14:13:06 lir postfix/smtpd[86084]: disconnect from unknown[115.134.25.73]
May 15 14:13:06 lir postfix/smtpd[86084]: connect from unknown[115.134.25.73]
May 15 14:13:08 lir postfix/smtpd[86084]: lost connection after UNKNOWN from unknown[115.134.25.73]
May 15 14:13:08 lir postfix/smtpd[86084]: disconnect from unknown[115.134.25.73]
May 15 14:13:17 lir postfix/smtpd[86084]: connect from unknown[115.134.25.73]
May 15 14:13:19 lir postfix/smtpd[86084]: lost connection after UNKNOWN from unknown[115.134.25.73]
May 15 14:13:19 lir postfix/smtpd[86084]: disconnect from unknown[115.134.25.73]
May 15 14:13:22 lir postfix/smtpd[86084]: connect from unknown[115.134.25.73]
@kgaughan
kgaughan / gist:cf9a01bda8daf0a43741
Created May 15, 2015 15:12
DNS isn't rocket science... or maybe it is...
lir:~% host 1.39.35.161
161.35.39.1.in-addr.arpa domain name pointer 1-39-35-161.live.vodafone.in.
lir:~% host 1-39-35-161.live.vodafone.in
Host 1-39-35-161.live.vodafone.in not found: 3(NXDOMAIN)