Skip to content

Instantly share code, notes, and snippets.

View jimmybot's full-sized avatar

James Lee jimmybot

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
font-family: monospace;
}
ul {
list-style: none;
}
-module(gameoflife).
-export([ping/2, start/0, clock/0]).
% currying in erlang?
clock() ->
Cells = [ul, ur, ll, lr],
lists:map(fun(Cell) -> timer:send_after(1000, Cell, update) end, Cells),
clock_receive(length(Cells)).
-module(nested_loops).
-export([pair_list_list/2, pair_e_list/2, pair_list_list2/2, pair_e_list2/2, pair_list_list3/2, pair_list_list4/2]).
pair_list_list(List1, List2) ->
pair_list_list(List1, List2, []).
pair_list_list([], _, Acc) ->
Acc;
pair_list_list(List1, List2, Acc) ->
[E|Rest] = List1,
"\e[B": history-search-forward
"\e[A": history-search-backward
"\e[C": forward-char
"\e[D": backward-char
"\e[1;6D": backward-word
"\e[1;6C": forward-word
set show-all-if-ambiguous on
set visible-stats on
void setup() {
size(600, 600);
smooth();
background(255);
fill(255);
stroke(100, 100);
PFont fontA = loadFont("courier");
textFont(fontA, 14);
noLoop();
}
@jimmybot
jimmybot / .tmux.conf
Last active September 22, 2015 18:17
# ` is an interesting key for a prefix
set-option -g prefix `
set -g window-status-bg yellow
# we need literal ` sometimes, allow switching
# we can also send the prefix char with `-a
bind-key C-b set-option -g prefix C-b
bind-key C-v set-option -g prefix `
bind-key ` last-window
"use strict";
function* aGenerator() {
throw new Error("rarg")
}
function runner() {
var gen = aGenerator()
gen.next()
}
def logger(fn):
start = time()
fn()
end = time()
print("time taken was: ", end - start)
return inner
import random
import sqlite3
conn = sqlite3.connect('btreedemo.sqlite')
c = conn.cursor()
c.execute('''DROP TABLE IF EXISTS keyword_campaigns''')
c.execute('''CREATE TABLE keyword_campaigns
(keyword, campaign_id, budget, spent, primary key(keyword, campaign_id)) without rowid''')
select * from keyword_campaigns where keyword = 'halloween';