This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
ssh -p 2202 -l craig -t barkingiguana.com $@ screen -xR irc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I love it when I'm looking for something: https://twitter.com/craigwebster/status/8672990615 | |
And stuff like this happens: https://twitter.com/jturnbull/status/8673790759 | |
Why? Well, look at this: | |
$ dig edinburghmenus.com | |
; <<>> DiG 9.4.3-P1 <<>> edinburghmenus.com | |
;; global options: printcmd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Does the requested file not exist? | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# AND is there a file that matches the requested file but with .html at the end? | |
RewriteCond %{REQUEST_FILENAME}.html -f | |
# Then rewrite the request under the hood and serve the HTML file. | |
RewriteRule ^([^.]+)$ $1.html [QSA] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Library: | |
Email = {} | |
Email.Message = function(raw_source) { | |
var parts = raw_source.split(/\r\n\r\n/); | |
this.headers = parts[0]; | |
this.body = parts[1]; | |
} | |
Email.Message.prototype.header(header_name, value) { | |
if(!value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quickly setup iptables, ntp, the backup service and snmpd: | |
# wget http://gist.github.com/raw/282727/1ec21c6628b3cb9a9f6525b4929f7b8675568b4f/first-boot.sh && bash first-boot.sh | |
# Firewall | |
apt-get install --yes iptables | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -p tcp --dport ssh -j ACCEPT | |
iptables -A INPUT -s 193.219.108.245 -p icmp -m icmp --icmp-type 8 -j ACCEPT | |
iptables -A INPUT -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# make sure /etc/mysql.passwd is chmod go-wrx. | |
# and chmod root:root. | |
PASSWORD=`cat /etc/mysql.passwd` | |
NICE='/usr/bin/nice -n 20' | |
CWD=`/bin/pwd` | |
UMASK=`umask` | |
MYSQLDUMP="/usr/bin/mysqldump -u root --password='${PASSWORD}'" | |
DUMPFILE="/var/backups/mysql.sql" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('http') | |
.createServer(function(request, response){ | |
setTimeout(function() { | |
response.sendHeader(200, {'Content-Type' : 'text/plain'}); | |
response.sendBody("zoom"); | |
response.finish(); | |
}, 2000); | |
}) | |
.listen(8000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'rubygems' | |
require 'net/http' | |
require 'cgi' | |
require 'hpricot' | |
name = CGI.escape(ARGV[0]) | |
postcode = CGI.escape(ARGV[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
RETENTION=14 | |
BACKUP_DIRECTORY='/var/backups/mysql' | |
NICE='/usr/bin/nice -n 20' | |
MYSQLDUMP='/usr/bin/mysqldump' | |
BZIP='/bin/bzip2' | |
RM='/bin/rm' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# This is ~/bin/mc | |
# chmod +x ~/bin/mc | |
# Usage: mc foo | |
# Create a Mochiweb project called "foo" in the current | |
# directory. | |
# I keep my clone of http://github.com/toddlipcon/mochiweb at |