This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "strings" | |
| "github.com/PuerkitoBio/goquery" | |
| ) |
This file contains hidden or 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 CSVObject(object): | |
| """ | |
| This class instantiates a file object as an interable. It means that | |
| CSV files can be read more efficiently than reading the entire data | |
| into memory. | |
| """ | |
| def __init__(self, fileName, delims, quotes): | |
| self.fileName = fileName | |
| self.delims = delims | |
| self.quotes = quotes |
This file contains hidden or 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 ParseLine(line, delims, quotes): | |
| """ | |
| Parses a line of text into components. This attempts to | |
| be a proper parser that can cope with multiple delimiters. | |
| """ | |
| inQuote = False # flag for being 'within' quotes | |
| token = '' # current token | |
| tokens = [] # list of tokens | |
| for char in line: | |
| if inQuote: # so if we're in the middle of a quote... |
This file contains hidden or 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 datetime | |
| def GetToday(): | |
| now = datetime.date.today() | |
| return now.strftime("%Y-%m-%d") | |
| if __name__ == '__main__': | |
| print GetToday() | |
This file contains hidden or 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
| """ | |
| Grouped descriptives | |
| (c) 2013, Alan James Salmoni | |
| """ | |
| def Count(data): | |
| return len(data) | |
| def Sum(data): |
This file contains hidden or 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 | |
| x = numpy.array(range(400)) | |
| xm = x.mean() | |
| xstd = x.std() | |
| def fitline(y): | |
| N = len(y) | |
| x = numpy.array(range(N)) | |
| ym = y.mean() |
This file contains hidden or 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 _winreg as wreg | |
| current_file = __file__ | |
| key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION") | |
| wreg.SetValueEx(key, current_file, 0, wreg.REG_DWORD, 10001) |
This file contains hidden or 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 | |
| x = numpy.array(range(400)) | |
| xm = x.mean() | |
| xstd = x.std() | |
| def fitline(y): | |
| N = len(y) | |
| x = numpy.array(range(N)) | |
| ym = y.mean() |
This file contains hidden or 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
| velocity <- function(vector) { | |
| N <- length(vector) | |
| val <- sum(abs(vector[1:N-1]-vector[2:N])) | |
| return (val) | |
| } |