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
library(microbenchmark) | |
lru_cache <- function(cache.size = 1000) { | |
lru <- new.env(hash=TRUE, parent=emptyenv(), size=cache.size) | |
pred <- new.env(hash=TRUE, parent=emptyenv(), size=cache.size) | |
succ <- new.env(hash=TRUE, parent=emptyenv(), size=cache.size) | |
pred$TAIL <- "HEAD" | |
succ$HEAD <- "TAIL" |
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
'dot;color black' plot (; 50&}.@:((**(1-]))^:(i. 200)&0.25)) 2.4 ([+-~*((%~i.)100)) 4 | |
NB. 100 numbers in [0,1) ^^^^^^^^^ | |
NB. rescaled to ^^^^^ | |
NB. 100 numbers in [2.4,4) ^^^ ^ | |
NB. makes "x", ^^^^^^^^^^^^^^^^^^^^^^^^ | |
NB. ^^^^^^^^^ function y -> y * (1-y)*x | |
NB. ^^^^^^^^^^ applied 200 times | |
NB. ^^^^^ starting with y=0.25 | |
NB. ^^^^^^^ then dropping first 50 iterations | |
NB. ^ put original "x" alongside result |
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
all: text.pdf text.html | |
text.pdf: bib.bib text.tex | |
git clean -f -e text.pdf -e text.html | |
latexmk -pdf text.tex -pdflatex="pdflatex -halt-on-error -interaction=nonstopmode" | |
text.image.html: text.pdf | |
cp text.bbl text.hbbl | |
hevea text.tex -o text.html < /dev/null |
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
library(vadr) | |
library(plyr) | |
# do "chain" arguments ever feature a dot on the second level (not in | |
# its own chain?) Answer by walking over expressions to pull out | |
# examples of usages. | |
dirs = c("~/analysis", "~/analysis/writing") | |
globs = c("*.r", "*.R") |
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
See video file |
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 python3 | |
# Usage: python3 import_bibdesk_dates.py path/to/zotero.sqlite | |
# Will only touch records that have not been synced (i.e. "version" == 0) | |
import sqlite3 | |
import re | |
import datetime | |
import pytz | |
import dateutil.parser |
OlderNewer