This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RunningStat | |
{ | |
public: | |
RunningStat() : m_n(0) {} | |
void Clear() | |
{ | |
m_n = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################################### | |
# Knuth-Morris-Pratt Algorithm | |
# Author: Samuel Jackson (samueljackson@outlook.com) | |
# Date: 20/07/2013 | |
####################################################### | |
# implementation of KMP Search | |
def kmp_search(s, w): | |
m = 0 # current search start point | |
i = 0 # current index in target word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
####################################################### | |
# Otsu's Method | |
# Author: Samuel Jackson (samueljackson@outlook.com) | |
# Date: 21/07/2013 | |
# Description: Performs Otsu's method of thresholding | |
# using the between class variance. | |
####################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo() { | |
return { | |
bar : "Hello World!" | |
} | |
} | |
function foo2() | |
{ | |
return | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
################################################ | |
# Sieve Of Eratosthenes | |
# Implementation the sieve of eratosthenes for | |
# finding all prime numbers up to a given limit | |
# Author: Samuel Jackson (slj11@aber.ac.uk) | |
# Date: 4/8/13 | |
################################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"email": "example@gmail.com", | |
"password": "yourpasswordhere", | |
"server": "smtp.gmail.com", | |
"port": 587 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5.1,3.5,1.4,0.2,Iris-setosa | |
4.9,3.0,1.4,0.2,Iris-setosa | |
4.7,3.2,1.3,0.2,Iris-setosa | |
4.6,3.1,1.5,0.2,Iris-setosa | |
5.0,3.6,1.4,0.2,Iris-setosa | |
5.4,3.9,1.7,0.4,Iris-setosa | |
4.6,3.4,1.4,0.3,Iris-setosa | |
5.0,3.4,1.5,0.2,Iris-setosa | |
4.4,2.9,1.4,0.2,Iris-setosa | |
4.9,3.1,1.5,0.1,Iris-setosa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def timed(f): | |
import cProfile, pstats, StringIO | |
def wrap(*args): | |
#start profiling | |
pr = cProfile.Profile() | |
pr.enable() | |
#execute function | |
ret = f(*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def findSequence(x, delta_x, start=0): | |
string = "" | |
if len(x) == 1: return str(x[0]) + ',' | |
if len(x) == 2: return str(x[0]) + ',' + str(x[1]) + ',' | |
while (start<delta_x.size-1): | |
end = start+1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int* p; // the thing pointed to is const, you can change the value of p | |
int const *q; // same as p | |
int * const r; // the pointer is const, but the thing pointed to can change value | |
int const * const s; // the pointer is const and the thing pointed to is const |