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
(defn pick-a-door [doors] | |
(nth doors (rand-int (count doors)))) | |
(defn play-the-game [strategy] | |
(let [*doors* '(1 2 3) | |
*winning-door* (pick-a-door *doors*) ; Computer picks one door to be a winner | |
*chosen-door* (pick-a-door *doors*) ; player picks a door | |
*remaining-doors* (filter (fn [value] | |
(or (= value *winning-door*) | |
(= value *chosen-door*))) *doors*)] ; Of the remaining doors, remove one that is not good |
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 | |
# cronicd - run some jobs once a day, at 4:20 | |
# Sleep every minute until it is 4:20 | |
while true; do | |
if [ `date +%H:%M` eq '16:20' ]; then # Military time bro | |
# Run the jobs s l o w l y | |
cat /etc/cronicdtab | while read job; do | |
nice -n 19 $job |
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
;;; David Rocamora's emacs color theme. | |
;;; Colors stolen from Puredyne | |
;;; Based on a Tango theme created by [email protected] | |
(defun color-theme-drr () | |
"David Rocamora's Emacs color theme." | |
(interactive) | |
(color-theme-install | |
'(color-theme-drr | |
((background-color . "#262626") |
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 | |
# sort_renders.sh - Sorts multipass renders in a given directory | |
# usage: sort_renders.sh [directory] | |
## Here are some things to customize: | |
# Populate this with a list of all the pass names seperated by spaces | |
PASSNAMES="foo bar baz quux _ao" |
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 took this from here: http://www.programmierecke.net/howto/gpg-ssh.html | |
# Deactivate the gnome-keyring. We will be replacing it with gnupg-agent | |
gconftool-2 --type bool --set /apps/gnome-keyring/daemon-components/ssh false | |
# Configure gpg to use the agent | |
echo "use-agent" >> ~/.gnupg/gpg.conf | |
# Enable ssh-agent drop in replacement support for gpg-agent | |
echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf |
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 python | |
import boto | |
# Connect to EC2. Picks up environment variables | |
conn = boto.connect_ec2() | |
# Get a list of my instances | |
reservations = conn.get_all_instances() | |
for reservation in reservations: | |
for instance in reservation.instances: |
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 | |
# Customize these | |
jekyll_root=~/Documents/Personal/n22t | |
remote_site_root="[email protected]:sites/n22t.com" | |
publish() | |
{ |
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
# BEGIN W3TC Browser Cache | |
<IfModule mod_deflate.c> | |
<IfModule mod_setenvif.c> | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Vary User-Agent env=!dont-vary |
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
(ns shuffler.core) | |
(defn shuffle-a-deck [] | |
"""Shuffles one deck of cards""" | |
(clojure.string/join "," (shuffle (range 0 52)))) | |
;; this is an infinite number of shuffled decks of cards | |
(def shuffled-decks (repeatedly shuffle-a-deck)) | |
(defn find-a-dup [seq index] | |
"""Finds the first duplicate in a seq""" |
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 | |
TMPFILE=`mktemp /tmp/prettyjson.XXXXXX` || exit 1 | |
python -mjson.tool $1 > $TMPFILE || exit 1 | |
mv $TMPFILE $1 || exit 1 |
OlderNewer