This file contains 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've got a brand-new combine harvester, and I'll give you the key." | |
# | |
# ("Combine harvester"... 'cause it does the cropping for you... | |
# ... http://i1.kym-cdn.com/photos/images/newsfeed/000/234/772/71e.jpg | |
# ... | |
# ... http://i3.kym-cdn.com/photos/images/original/000/234/807/f3a.jpg ) | |
# | |
# | |
# This is a quick demo, so works a bit clunkily: pass a list of files |
This file contains 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
# shuffles.py | |
# | |
# Written for the following /r/math post: | |
# | |
# > Hi all. I've got a programming problem that distills down to choosing | |
# > a permutation, B, of a sequence A, with uniform probability such that | |
# > no two pairwise sums are the same. For example: | |
# > | |
# > A = [ 0 1 2 3 4 ] | |
# > B = [ 2 4 1 3 0 ] |
This file contains 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
class Colouring(object): | |
def __init__(self, colouring): | |
self.colouring = colouring | |
def __eq__(self, other): | |
# Two colourings are "equal" (read: "equivalent") if one is a | |
# rotational-shift of the other. (I'm sure there are smarter | |
# ways to do this (this may not even be *right*), but I was in | |
# a hurry, and it seems to work.) |
This file contains 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
# Where to keep your ssh-agent environment details | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null |
This file contains 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
<?php | |
$target = $_GET['target']; | |
$watermark = $_GET['watermark']; | |
if ((strlen($target) == 0) || (strlen($watermark) == 0)) { | |
exit; | |
} | |
if (!file_exists($target) || !file_exists($watermark)) { |
This file contains 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
(eval-when-compile (require 'color-theme)) | |
(defun color-theme-wombat () | |
"Color theme 'wombat', taken from http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/#comment-1051, created 2009-06-23." | |
(interactive) | |
(color-theme-install | |
'(color-theme-wombat | |
((background-color . "#242424") | |
(background-mode . dark) | |
(border-color . "#888a85") | |
(cursor-color . "#656565") |