Skip to content

Instantly share code, notes, and snippets.

View wridgers's full-sized avatar

Will Ridgers wridgers

View GitHub Profile
@wridgers
wridgers / muttrc
Created May 16, 2011 18:32
mutt rc dotconfig, colours and transparent background!
---------------------------------------------------------------
~/.mutt/muttrc
---------------------------------------------------------------
color hdrdefault cyan default
color attachment yellow default
color header brightyellow default "From: "
color header brightyellow default "Subject: "
color header brightyellow default "Date: "
fact :: (Integral a) => a -> a
fact f
| f == 0 = 1
| otherwise = f*fact (f-1)
fac :: (Integral a) => a -> a
fac 0 = 1
fac n = n*fac(n-1)
removen :: Int -> [a] -> [a]
removen n arr =
let (x,y) = splitAt n arr
in x ++ tail y
det :: (Integral a) => [[a]] -> a
det matrix
| rows /= cols = -1
| rows == cols = 1
where rows = length (matrix)
cols = length (matrix !! 0)
@wridgers
wridgers / sql.php
Created August 14, 2011 10:54
Converting a CubeCart install to a PrestaShop install. Part 1.
<?php
function clean($in) {
// I used this function to rename things, since the conversation also required a name change.
$out = str_replace("Oldsite", "Newsite", $in);
return $out;
}
$source_database = 'dbname';
@wridgers
wridgers / bash.php
Created August 14, 2011 11:01
Converting a CubeCart install to a PrestaShop install. Part 2.
<?php
$source_database = 'dbname';
$source_server = 'dbserver';
$source_user = 'dbuser';
$source_pass = 'dbpass';
$source = mysql_connect( $source_server, $source_user, $source_pass );
mysql_select_db($source_database);
@wridgers
wridgers / go.sh
Created August 14, 2011 11:03
Converting a CubeCart install to a PrestaShop install. Part 3.
#!/bin/bash
file=$1
id=$2
echo Making 45x45
convert $1 -resize 45x45^ -gravity center -extent 45x45 ./out/$2-$2-small.jpg
echo Making 80x80
convert $1 -resize 80x80^ -gravity center -extent 80x80 ./out/$2-$2-medium.jpg
@wridgers
wridgers / rules.txt
Created December 10, 2011 18:18
Rules for C/C++ Turing Machine contest
-- RULES --
~ should be a single .c or .cpp file
~ must be written in C or C++ (C is a subset of C++)
~ entry must compile (of course)
~ must be a deterministic 1-tape TM as defined below
~ should accept the input string as a command-line argument (see Links for how to do this)
~ upon input, the program should output state:tape followed by a new line
~ the program should terminate once the state becomes H,Y, or N.
~ the delta function should be changeable (no hard coding the procedure!)
~ submissions should have a 'default' delta function that reverses the input string
@wridgers
wridgers / .tmux.conf
Created February 7, 2012 16:05
tmux config file
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g history-limit 1000
@wridgers
wridgers / tlds.js
Created March 3, 2012 23:06
A list of all internet top level domains.
var generic = ['.aero', '.asia', '.biz', '.cat', '.com', '.coop', '.info', '.int', '.jobs', '.mobi', '.museum', '.name', '.net', '.org', '.pro', '.tel', '.travel', '.xxx'];
var us = ['.edu', '.gov', '.mil'];
var a = ['.ac', '.ad', '.ae', '.af', '.ag', '.ai', '.al', '.am', '.an', '.ao', '.aq', '.ar', '.as', '.at', '.au', '.aw', '.ax', '.az'];
var b = ['.ba', '.bb', '.bd', '.be', '.bf', '.bg', '.bh', '.bi', '.bj', '.bm', '.bn', '.bo', '.br', '.bs', '.bt', '.bv', '.bw', '.by', '.bz'];
var c = ['.ca', '.cc', '.cd', '.cf', '.cg', '.ch', '.ci', '.ck', '.cl', '.cm', '.cn', '.co', '.cr', '.cs', '.cu', '.cv', '.cx', '.cy', '.cz'];
var d = ['.dd', '.de', '.dj', '.dk', '.dm', '.do', '.dz'];
var e = ['.ec', '.ee', '.eg', '.eh', '.er', '.es', '.et', '.eu'];
var f = ['.fi', '.fj', '.fk', '.fm', '.fo', '.fr'];
var g = ['.ga', '.gb', '.gd', '.ge', '.gf', '.gg', '.gh', '.gi', '.gl', '.gm', '.gn', '.gp', '.gq', '.gr', '.gs', '.gt', '.gu', '.gw', '.gy'];
var h = ['.hk', '.hm', '.hn', '.hr', '.ht', '.hu'];