Skip to content

Instantly share code, notes, and snippets.

View jpfairbanks's full-sized avatar

James jpfairbanks

View GitHub Profile
@jpfairbanks
jpfairbanks / downselect.jl
Created October 25, 2018 13:47
A function to delete rows from an array based on equality among the columns
A = readdlm("filename.csv")
function droprows(A::AbstractMatrix, r)
keeprows = Int[]
for i in 1:size(A,1)
if A[i,r[1]] == A[i,r[2]] == A[i,r[3]]
continue
else
push!(keeprows, i)
end
import Base: start, next, done
using LightGraphs
## New implementation.
type Circuits
dg::DiGraph
end
type CircuitsState
#!/usr/bin/env python3
"""pklcat: pretty print a python pickle from stdin to stdout"""
import pickle as pk
import pprint
from sys import stdin
from sys import argv
if len(argv) <= 1:
pprint.pprint(pk.load(stdin))
else:
@jpfairbanks
jpfairbanks / install.sh
Created September 16, 2016 13:36
install stimator on pace.gatech.edu
module load anaconda2
pip install --upgrade --user stimator
ipython
# then type import stimator at the prompt
@jpfairbanks
jpfairbanks / closure.jl
Last active January 3, 2016 14:19
Closure defining macro for julia
function accumulator()
x=0; (y) -> x+=y
end
acc = accumulator()
z = 0
for i in 1:10
z =acc(1)
end
print(z)
@jpfairbanks
jpfairbanks / embedded_type.jl
Created October 23, 2015 18:02
Metaprogramming julia
import Base.Test
type T
a::Int
end
type S
t::T
b::Int
end

Keybase proof

I hereby claim:

  • I am jpfairbanks on github.
  • I am jpfair (https://keybase.io/jpfair) on keybase.
  • I have a public key whose fingerprint is 4543 B3CC 499D 3ADD 8E5A AF0F 1F6F E256 F2F0 E39C

To claim this, I am signing this object:

@jpfairbanks
jpfairbanks / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console