Skip to content

Instantly share code, notes, and snippets.

View christopher-beckham's full-sized avatar

Christopher Beckham, PhD christopher-beckham

View GitHub Profile
quicksort :: [Int] -> [Int]
quicksort [] = []
quicksort [x] = [x]
quicksort xs =
quicksort(less) ++ [pivot] ++ quicksort(greater)
where
m = length xs `div` 2
pivot = xs!!m
less = [ xs!!i | i <- [0..(length xs)-1], xs!!i <= pivot && i /= m ]
greater = [ xs!!i | i <- [0..(length xs)-1], xs!!i > pivot && i /= m ]
http://en.wikipedia.org/wiki/Animal
http://en.wikipedia.org/wiki/Gnathifera_(phylum)
http://en.wikipedia.org/wiki/Gnathostomulid
http://en.wikipedia.org/wiki/Testis
http://en.wikipedia.org/wiki/Infertility
http://en.wikipedia.org/wiki/Embryo_transfer
http://en.wikipedia.org/wiki/Foal
http://en.wikipedia.org/wiki/Gestation
http://en.wikipedia.org/wiki/Uterus
http://en.wikipedia.org/wiki/Asherman%27s_syndrome
from sys import stdin as d
def dr(): return d.readline().rstrip()
def gr(): r1=int(dr())-1; return [ [ int(s) for s in dr().split() ] for z in [1]*4 ][r1]
nc=int(dr())
for i in range(nc):r=list(set(gr()).intersection(set(gr())));l=len(r);print ''.join(['Case #',str(i+1),': ',"Volunteer cheated!"if l==0 else"Bad magician!"if l>1 else`r[0]`])
def quicksort(arr):
if arr == []:
return []
if len(arr) == 1:
return arr
m = len(arr) / 2
pivot = arr[m]
less = [ arr[x] for x in range(0, len(arr)) if arr[x] <= pivot and x != m ]
greater = [ arr[x] for x in range(0, len(arr)) if arr[x] > pivot and x != m ]
return quicksort(less) + [pivot] + quicksort(greater)
@christopher-beckham
christopher-beckham / gist:e8b239d71efb900c3e98
Last active August 29, 2015 14:01
Shit I never remember
@christopher-beckham
christopher-beckham / gist:accbf1da3a735e1de896
Last active August 29, 2015 14:01
Find consensus of .aln file
from sys import stdin
import sys
N = 10 # number of sequences
body = stdin.read()
body = body.split('\n')
body = body[3:len(body)-2]
final_body = []
for elem in body:
digraph unix {
node [color=lightblue2, style=filled];
"node1" -> "node2"
"node3" -> "node2"
"node4" -> "node1"
}

Dirs:

  • ssh - Contains scripts/data/etc. that should be scped onto remote machines such as Chris's cluster.
  • 22 - blah

Testing $x^2$

from lasagne.nonlinearities import *
from lasagne.layers import Layer
class SpatialSoftmaxLayer(Layer):
"""
Softmax layer that computes the softmax over pixels in the same location,
i.e., over the channel axis. This layer will automatically use the CuDNN
version of this softmax if it is available.
Parameters