Skip to content

Instantly share code, notes, and snippets.

View wrboyce's full-sized avatar

Will Boyce wrboyce

View GitHub Profile
from datetime import datetime
import hashlib
import time
import urllib
def main():
fn = 'current-%s.jpg' % datetime.now().strftime('%Y%m%d%H%M')
lasthash = file('LATEST', 'r').read().strip()
thishash, thisfile = None, None
Carriers (2)
Litter tray with lid/hood & cat san clumping litter
Food (wet? dry? milk?)
Flea/worming stuff [see Vet]
Toys
CATS!
[user]
name = Will Boyce
email =
signingkey =
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "dev"]
remote = origin
=SUPERVISOR REPORT==== 12-Jun-2011::14:47:06 ===
Supervisor: {local,erb_handler_supervisor}
Context: start_error
Reason: {{badmatch,
{'EXIT',
{{case_clause,
{ok,[1234,"/Users/wrboyce/Dev/Erb/etc/"]}},
[{erb_handler_sshcli,init,1},
{gen_event,server_add_handler,4},
{gen_event,handle_msg,5},
Response = io_lib:format("~s: ", [Nick]) ++
case ets:lookup(State#state.db, SeenKey) of
[{SeenKey, SeenData}] ->
{SeenAgeDays, {SeenAgeHours,SeenAgeMinutes,SeenAgeSeconds}} = calendar:time_difference(SeenData#data.datetime, calendar:universal_time()),
io_lib:format("~s was last seen", [SeenNick]) ++
string:join("", lists:map(fun({V,L}) ->
case V of
0 ->
"";
_ ->
Host jumpbox
Hostname jumpbox.domain.com
Port 2020
PasswordAuthentication no
Host *.domain.local
ProxyCommand ssh jumpbox -- nc %h %p
PasswordAuthentication no
# for tab completion goodness
Host ldap0.domain.local
import random
class CreditCard(object):
CARD_TYPES = {
'amex': {
'prefixes': ['34', '37'],
'length': [15]
},
'diners-carte-blance': {
handle_call(getBots, _From, State) ->
io:format("handle_call(getBots)~n", []),
T = mnesia:table_info(bot_config,all),
io:format("table_info: ~p~n", [T]),
Q = qlc:q([
C || C <- mnesia:table(bot_config),
C#bot_config.enabled =:= true]),
R = mnesia:transaction(fun() -> qlc:e(Q) end, 3),
io:format("Result: ~p~n", [R]),
{ok, Bots} = R,
@wrboyce
wrboyce / helloworld.erl
Created September 1, 2011 09:52
erb module example
-module(helloworld).
-behaviour(gen_server).
-include("erb.hrl").
-export([start_link/1]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
-define(SERVER, ?MODULE).
start_link(Bot) ->
gen_server:start_link(?SERVER, ?MODULE, [Bot], []).
from math import sqrt
def fib(n):
x = (1+sqrt(5))/2
y = -(1/x)
return (x**n - y**n) / sqrt(5)