Skip to content

Instantly share code, notes, and snippets.

function Gaussian()
h = .5;
d = 1;
hold on
load Hw3data2a.txt;
[n colSize] = size(Hw3data2a);
x = sort(Hw3data2a);
function ParzenBiVarUp()
h = .5;
d = 2;
load Hw3data2c.txt
[n colSize] = size(Hw3data2c);
input = Hw3data2c;
minD_x = min(Hw3data2c(:,1));
int whichSet = -1;
int wordBase = word;
int i;
int hit = 0;
while(1) {
if (wordBase % cache->blockSizeInWords == 0)
break;
wordBase--;
}
[Pp][Rr][Oo][Gg][Rr][Aa][Mm] fprintf(yyout,"%s 7 ",yytext);
([\"][^\"]*[\"])|([\'][^\']*[\']) fprintf(yyout,"%s 15 ",yytext);
("\(\*"[^\)\*]*"\)\*")|"(*)" (for whitespace)
replace the top two lines with their corresponding fprintf's in the lexfile provided.
notes = 'Recreate the problem: %(What do we need to do to recreate the problem? )s \n \n \
Expected behavior: %(What behaviour were you expecting (vs what is actually happening)?)s \n \n \
Priority: %(Priority)s \n \n \
Browswer: %(What browser were you using?)s \n \n \
Other information: %(Is there any other information that would help us troubleshoot this?)s' \
% bug_details
@angusb
angusb / gist:3362991
Created August 15, 2012 19:43
channelstaticmeta orm
class ChannelStaticMeta(models.Model):
cstmid = models.AutoField(primary_key=True)
channels_cid = models.ForeignKey(Channel, db_column="cid", unique=True)
regex = models.CharField(max_length=255, null=False, blank=True)
class Meta:
db_table = u"channels_static_meta"
verbose_name = "Channel Static Meta"
verbose_name_plural = "Channel Static Metas"
@angusb
angusb / gist:3822022
Created October 2, 2012 18:21
ugly fib
(defn fib[x]
(loop [n 0 r ()]
(println n, r)
(cond (= x n) r
(or (= n 0) (= n 1)) (recur (inc n) (conj 1 r))
:else (recur (inc n) (conj (+ (last r) (butlast r)) r)))))
@angusb
angusb / gist:3870261
Created October 11, 2012 04:56
Function from hell
; Given a string of comma separated integers, write a function which
; returns a new comma separated string that only contains the numbers
; which are perfect squares.
(fn [s]
(apply str
(interpose \,
(filter #(= (Math/sqrt %)
(Math/floor (Math/sqrt %)))
(map #(Integer/parseInt %)
@angusb
angusb / gist:3901024
Created October 16, 2012 18:16
asanaapi
class AsanaResource(object):
def __init__(self):
# stuff
def get(self, endpoint=""):
"""Submits a get to the Asana API and returns the result.
Returns:
dict: json response from Asana
"""
@angusb
angusb / gist:4120327
Created November 20, 2012 19:12
stylistic python?
msgs = []
for begin, length in piece.empty_blocks():
msgs.append(Msg('request',
index=piece_num_to_fetch,
begin=begin,
length=length))
return msgs