Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
isomorphisms / 2^2^2^2^2
Created March 14, 2013 19:58
2^2^2^2^2
$ bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
2^2
4
2^2^2
@isomorphisms
isomorphisms / USD.R
Created July 20, 2013 03:36
$USDX or $USD:IND, the USD index basket. #forex #currency #oanda #FRED
# This computes the USD index which is the "broad measure of the US Dollar against a BASKET of currencies" rather than against a particular pair
getFX(c("USD/EUR", "USD/JPY", "USD/GBP", "USD/CAD", "USD/SEK", "USD/CHF"))
# The formula comes from ICE markets https://www.theice.com/publicdocs/futures_us/ICE_Dollar_Index_FAQ.pdf
e <- .576
y <- .136
s <- .119
l <- .091
@isomorphisms
isomorphisms / brains.R
Last active December 21, 2015 16:58
animals sorted by brain size
require(ggplot2); data(msleep); attach(msleep)
animal.brains <- na.omit( data.frame( name, round( brainwt / bodywt * 100, 1) ))
names(list) <- c("animal", "how.brainy")
@isomorphisms
isomorphisms / peek.bash
Last active January 1, 2016 11:48
alternative peeking tool to head and tail: pick out a random 20 lines of a file, plus the first and last lines.
#!/bin/bash
# peek
# look at N random lines of datafile.csv
# usage: rand datafile.csv N
# rand $1 $2
head -1 $1 #names row of $1
require(microbenchmark)
# ζ is U+3b6 in Ubuntu
ready.set.go.10000000 <- microbenchmark( "ζ <- complex(0); for (j in 1:1e6) ζ <- c(ζ,complex(argument=j/1e6*2*pi,modulus=1) )", "ζ <- complex(1e6); for (j in 1:1e6) ζ[j] <- complex(argument=j/1e6*2*pi, modulus=1)", "ζ <- complex( argument=1:1e6*2*pi, modulus=1 )" )
a<-Sys.time(); ready.set.go.10000000 <- microbenchmark( "ζ <- complex(0); for (j in 1:1e7) ζ <- c(ζ,complex(argument=j/1e7*2*pi,modulus=1) )", "ζ <- complex(1e7); for (j in 1:1e7) ζ[j] <- complex(argument=j/1e7*2*pi, modulus=1)", "ζ <- complex( argument=1:1e7*2*pi, modulus=1 ))" ,times=5e4L); b<-Sys.time()
b-a
# You're meant to read through this
# configuraton file rather than simply
# copying it to your home directory.
#
# There are some places where you're
# meant to uncomment something if you
# want to use it in your TMUX.
#
# I hope it's readable.
#
" fun! MySys()
" return "$1"
" endfun
" set runtimepath=~/.vim_runtime,~/.vim_runtime/after,\$VIMRUNTIME
" source ~/.vim_runtime/vimrc
" helptags ~/.vim_runtime/doc
imap jk <Esc>
@isomorphisms
isomorphisms / peek.bash
Last active March 9, 2019 08:25
an inspector/peeking function ... alternative to "head"
#print a specific line
li() { sed -n "$1"p ; }
lines() { sed -n "$1,$2"p ; }
#whitespace
ws() { echo -e "\t⋮\t⋮\t⋮" ; } #could also do this once for each column à la (head -1 | tr -dC , | sed "s/,/\t⋮/g")
@isomorphisms
isomorphisms / .muttrc
Created May 27, 2014 18:52
configure Mutt to work with Gmail — fast / non-gui / cli alternative to Gmail Web Interface
set from = "humility.consulting@gmail.com"
set realname = "Humility Consulting"
set imap_user = "humility.consulting@gmail.com"
set imap_pass = "my password in plaintest"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
s#MITx/2.01x/2013_Spring#Structural Engineering#g
s#MITx/3.091x/2013_Spring#Solid State Chemistry#g
s#MITx/8.MReV/2013_Summer#Mechanical Engineering#g
s#MITx/8.02x/2013_Spring#E\&M#g
s#MITx/14.73x/2013_Spring#Poverty#g
s#MITx/6.002x/2013_Spring#Circuits \& Electronics#g
s#MITx/3.091x/2012_Fall#Solid State Chemistry#g
s#MITx/8.MReV/2013_Summer#Mechanical Engineering#g
s#MITx/6.00x/2013_Spring#Programming#g
s#MITx/6.00x/2012_Fall#Programming#g