Skip to content

Instantly share code, notes, and snippets.

Avatar

James jpfairbanks

View GitHub Profile
@jpfairbanks
jpfairbanks / downselect.jl
Created Oct 25, 2018
A function to delete rows from an array based on equality among the columns
View downselect.jl
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
View circuits.jl
import Base: start, next, done
using LightGraphs
## New implementation.
type Circuits
dg::DiGraph
end
type CircuitsState
View pklcat.py
#!/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 Sep 16, 2016
install stimator on pace.gatech.edu
View install.sh
module load anaconda2
pip install --upgrade --user stimator
ipython
# then type import stimator at the prompt
@jpfairbanks
jpfairbanks / embedded_type.jl
Created Oct 23, 2015
Metaprogramming julia
View embedded_type.jl
import Base.Test
type T
a::Int
end
type S
t::T
b::Int
end
View keybase.md

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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jpfairbanks
jpfairbanks / closure.jl
Last active Jan 3, 2016
Closure defining macro for julia
View closure.jl
function accumulator()
x=0; (y) -> x+=y
end
acc = accumulator()
z = 0
for i in 1:10
z =acc(1)
end
print(z)
You can’t perform that action at this time.