Skip to content

Instantly share code, notes, and snippets.

sqlite> select id, winner, player1, player2, result, moves from games where (player1='TakticianBot' and winner='black') OR (player2='TakticianBot' and winner='white');
6450|white|BenWo|TakticianBot|R-0|33
6454|white|BenWo|TakticianBot|R-0|27
6459|white|BenWo|TakticianBot|R-0|27
6469|white|BenWo|TakticianBot|R-0|27
6514|white|pythoner6|TakticianBot|F-0|61
6522|white|pythoner6|TakticianBot|R-0|81
6552|white|asgardiator|TakticianBot|1-0|73
6584|white|Archerion|TakticianBot|R-0|39
6979|white|Simmon|TakticianBot|F-0|54
@nelhage
nelhage / left-pad.txt
Created April 7, 2016 04:38
node left-pad
[nelhage@monomorphique:~/code/accidentallyquadratic]$ perf stat node data/left-pad-npm.js 500000
Performance counter stats for 'node data/left-pad-npm.js 500000':
7294.942072 task-clock (msec) # 0.951 CPUs utilized
1,010 context-switches # 0.138 K/sec
15 cpu-migrations # 0.002 K/sec
446,352 page-faults # 0.061 M/sec
19,765,021,583 cycles # 2.709 GHz
<not supported> stalled-cycles-frontend

bench_socket.py

recvfrom(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 16384, 0, NULL, NULL) = 16384
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
write(1, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 12288) = 12288

bench_httplib.py

#!/usr/bin/env python
import imaplib
import os
import logging
import optparse
# LABEL = 'support'
# QUERY = 'before:2015-06-01 -label:to-delete'
# DEST = 'to-delete'
LABEL = 'to-delete'
[nelhage@anarchique:~]$ t=$(TZ=UTC date +"%y%m%d%H%M"); echo $t
1410070128
[nelhage@anarchique:~]$ t=$(TZ=UTC date --date=@$t +"%y%m%d%H%M"); echo $t
1409070608
[nelhage@anarchique:~]$ t=$(TZ=UTC date --date=@$t +"%y%m%d%H%M"); echo $t
1408261630
[nelhage@anarchique:~]$ t=$(TZ=UTC date --date=@$t +"%y%m%d%H%M"); echo $t
1408170747
[nelhage@anarchique:~]$ t=$(TZ=UTC date --date=@$t +"%y%m%d%H%M"); echo $t
1408160632
import json
import sys
import subprocess
REGIONS = "us-west-1 us-west-2 us-east-1".split()
PROFILES = "default".split()
for region in REGIONS:
for profile in PROFILES:
status = json.loads(subprocess.check_output(
dnl 8051.m4 -- m4 macro set for 8051 assembly programming
dnl 6.115 Final Project, Spring 2008 Nelson Elhage
dnl
dnl Contains a set of macros to simplify 8051 assembly programming
dnl slightly. Doesn't fundamentally change the process, but
dnl simplifies a few of the more repetitive tasks, particularly
dnl generating label names
changequote([,])dnl [] make better quoting characters
changecom([//])dnl
type MyThing struct {
sync.Mutex
}
type ThingBucket {
things []MyThing
}
@nelhage
nelhage / node-logs
Last active August 29, 2015 14:02
logs
[2014-06-18 21:19:48.360749] 2014/06/18 21:19:48 [WARN] memberlist: Refuting a suspect message
[2014-06-18 21:20:06.393605] 2014/06/18 21:20:06 [WARN] memberlist: Refuting a dead message
[2014-06-18 21:20:51.393244] 2014/06/18 21:20:51 [WARN] memberlist: Refuting a dead message
[2014-06-18 21:21:30.393259] 2014/06/18 21:21:30 [WARN] memberlist: Refuting a suspect message
>>>>
+++++>>>>+++++>>>>+++++>>>>+++++>>>>++>>>>+++++>>>>+++++>>>>+++++>>>>+++++>>>>+++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++++>>>>++>>>>++++>>>>+++>>>>++>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++>>>>++++++>>>>++++++>>>>++++++>>>>++++++>>>>++>>>>++++++>>>>++++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>++>>>>+++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>++++++>>>>++++>>>>+++>>>>+++++>>>>+>>>>+++++>>>>++>>>>++++++>>>>+++++++>>>>++++++>>>>++++++>>>>+>>>>+++++>>>>+++++>>>>+++++>>>>++++>>>>+++>>>>++++++>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++++>>>>+++++>>>>+>>>>+>>>>+>>>>+>>>>++>>>>++++>>>>++++++>>>>++++>>>>++++>>>>++++>>