Instantly share code, notes, and snippets.

# gorlum0

• Sort options
Created Jun 6, 2013
View gist:5721558
 font color: black background color: #F5F2E7
Created Sep 7, 2012
Some convenience funcs for algs4partI-class exercises - easier in numbers for me than in alphabet.
View str2nums.py
 #algs4partI-class def str2nums(s): return [ord(x)-ord('A') for x in s.split()] def nums2str(l): return ' '.join(chr(x + ord('A')) for x in l)
Created Aug 31, 2012
Created Aug 31, 2012
Created Aug 31, 2012
Created Mar 26, 2012
quix.txt for quixapp
View quix.txt
 > This is a Quix Command File > > For the syntax of this file, please refer to http://quixapp.com/syntax/ > @Basic commands @These are the most basic commands Quix offers, but possibly also the most powerful ones. a http://www.amazon.com/s/?field-keywords=%s Amazon Search d http://www.google.com/search?q=define:%s Google Define a word dict http://www.google.com/dictionary?langpair=en%7Cen&q=%s&hl=en&aq=f Google Dictionary for a word
Created Mar 16, 2012
Count inversions in an array, not "in-place"
View count-inv-lr.py
 #!/usr/bin/env python """(c) gorlum0 [at] gmail.com""" import random from sys import maxsize as inf def merge_sort(A): """merge-sort which counts inversions""" def merge(L, R): m = len(L)-1 B = []
Created Jan 28, 2012
ml-class - ex2_reg (python)
View ex2_reg.py
 #!/usr/bin/env python from __future__ import division import numpy as np import matplotlib.pyplot as plt from scipy import optimize from numpy import newaxis, r_, c_, mat, e from numpy.linalg import * def plotData(X, y): pos = (y.ravel() == 1).nonzero()
Created Jan 28, 2012
ml-class - ex2 (python)
View ex2.py
 #!/usr/bin/env python from __future__ import division import numpy as np import matplotlib.pyplot as plt from scipy import optimize from numpy import newaxis, r_, c_, mat, e from numpy.linalg import * def plotData(X, y): #pos = (y.ravel() == 1).nonzero()
Created Oct 31, 2011
ml-class - ex1_multi (python)
View ex1_multi.py
 #!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from numpy import newaxis, r_, c_, mat from numpy.linalg import * def featureNormalize(X): X_norm = X.A m = X.shape[0]
You can’t perform that action at this time.