Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
thattommyhall / check.coffee
Created November 5, 2012 17:27
testing new static assets server
lazy = require 'lazy'
http = require 'http'
http.globalAgent.maxSockets = 200
process.stdin.resume()
failed = 0
success = 0
status = ->
@thattommyhall
thattommyhall / gist:3017841
Created June 29, 2012 13:12 — forked from fcoury/gist:1068141
fpm ruby-1.9.3 ON UBUNTU 12.04
sudo apt-get install libssl-dev libreadline-dev libyaml-dev build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libffi-dev
sudo gem install fpm
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -zxvf ruby-1.9.3-p194.tar.gz
./configure --prefix=/usr && make && make install DESTDIR=/tmp/ruby193
fpm -s dir -t deb -n ruby -v 1.9.3-p194 -C /tmp/ruby193 \
(fn [n]
(let [primes
(fn primes []
(concat
[2 3 5 7]
(lazy-seq
(let [primes-from
(fn primes-from [n]
(if (some #(zero? (rem n %))
(take-while #(<= (* % %) n) (primes)))
(fn [player board]
(let [column
(fn [[x y]]
(for [newy [0 1 2]]
[x newy]))
row
(fn [[x y]]
(for [newx [0 1 2]]
[newx y]))
@thattommyhall
thattommyhall / gist:2301094
Created April 4, 2012 13:37
Find 404s in apache logs
awk '$9 == 404 {print $7}' access.log | uniq -c | sort -rn
@thattommyhall
thattommyhall / gist:2237418
Created March 29, 2012 13:23
SSL Keygen for 123reg
openssl genrsa -des3 -out DOMAIN.key 2048
openssl req -new -key DOMAIN.key -out DOMAIN.csr
@thattommyhall
thattommyhall / gist:2205969
Created March 26, 2012 15:33
fpm ruby 1.9.3
apt-get install libreadline-dev libyaml-dev build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
./configure --prefix=/usr && make && make install DESTDIR=/tmp/ruby193
fpm -s dir -t deb -n ruby -v 1.9.3-p125 -C /tmp/ruby193 \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.4)" -d "libgdbm3 (>= 1.8.3)" \
-d "libncurses5 (>= 5.7)" -d "libreadline6 (>= 6.1)" \
-d "libssl0.9.8 (>= 0.9.8)" -d "zlib1g (>= 1:1.2.2)" \
usr/bin usr/lib usr/share/man usr/include
@thattommyhall
thattommyhall / list.rb
Created February 27, 2012 16:36
List servers in all EC2 regions
require 'fog'
AWS = Fog::Compute.new(:provider => 'AWS')
REGIONS = AWS.describe_regions.body["regionInfo"].map {|region| region["regionName"]}
COMPUTE = {}
REGIONS.each do |region|
COMPUTE.merge!(region => Fog::Compute.new({:provider => 'AWS', :region=>region}))
end
@thattommyhall
thattommyhall / mycnf_gen.sh
Created February 10, 2012 13:20
mycnf generator
#!/bin/bash
CORES="`cat /proc/cpuinfo | grep processor | wc -l`"
CORES16="`echo "$CORES * 16" | bc`"
STRINGRAM="`cat /proc/meminfo | head -n 1 | awk '{print $2}'` / 1024"
RAM=`echo $STRINGRAM | bc`
RAM64="`echo "$RAM / 64" | bc`"
@thattommyhall
thattommyhall / my.cnf
Created February 10, 2012 12:35
Suggested my.cnf
[client]
default-character-set = utf8
socket = /tmp/mysql.sock
[mysqld]
#skip-grant-tables
max_sp_recursion_depth = 255
socket = /tmp/mysql.sock
tmpdir = /opt/tmp