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 os | |
from time import sleep | |
from optparse import OptionParser | |
# Remember to add the trailing slash! | |
SERVER_FOLDER = "/home/2010/cleung24/comp512/a3/servercode/" | |
CLIENT_FOLDER = "/home/2010/cleung24/comp512/a3/clientsrc/" | |
MIDDLEWARE_PORT = 5678 |
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
var Promise = require('bluebird'), | |
data = ['a', 'b', 'c', 'd', null, 'e']; | |
/** | |
* A long running task to run for each element of the array. | |
* It must return a promise | |
*/ | |
function doThing(arg) { | |
return new Promise( | |
function (resolve, reject) { |
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 random | |
import csv | |
DAYS = 7 | |
HOURS = 24 | |
data = [] | |
for day in range(DAYS): | |
for hour in range(HOURS): |
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
// We need this to build our post string | |
var querystring = require('querystring'); | |
var http = require('http'); | |
var fs = require('fs'); | |
function PostCode(codestring) { | |
// Build the post string from an object | |
var post_data = querystring.stringify({ | |
'compilation_level' : 'ADVANCED_OPTIMIZATIONS', | |
'output_format': 'json', |
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
from random import random, shuffle | |
def monte_carlo(draws, reds, blues): | |
cases = [] | |
for i in xrange(draws): | |
red_draws = [1] * reds | |
blue_draws = [0] * blues | |
total = red_draws + blue_draws | |
shuffle(total) | |
utility = total.pop() + total.pop() # pop two off |
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
oparray = [ \ | |
lambda x, y: False, # FALSE | |
lambda x, y: x and y, # AND | |
lambda x, y: x and (not y), # X AND NOT Y | |
lambda x, y: x, # X | |
lambda x, y: (not x) and y, # NOT X AND Y | |
lambda x, y: y, # Y, | |
lambda x, y: x != y, # XOR | |
lambda x, y: x or y, # OR | |
lambda x, y: not (x or y), # NOR |
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
from math import exp | |
class Edge: | |
def __init__(self, edgetup, weight): | |
self.vertex_out = edgetup[0] | |
self.vertex_in = edgetup[1] | |
self.weight = weight | |
class Unit: | |
def __init__(self, number, input_edges, output_edges): |
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
clear all; close all; | |
A = imread('BrownDischer079.tiff'); | |
A = single(A); | |
scale = max(max(A))/256; | |
A = A/scale; | |
figure(1); | |
co=[0:255]/256; colormap([co;co;co]'); | |
image(A); axis off tight; title('original image'); | |
[x,y] = meshgrid(-25:25); |
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
""" | |
genet - Python screen scraper for the Cystic Fibrosis Mutation Database | |
Installation | |
------------- | |
$ pip install requests pyquery | |
$ python | |
> import genet |
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 genet | |
aa_values = genet.extract_aa_values("Cyto loop1 (56 aa) 139/140-194/195") | |
raw_html = genet.search_by_consequence(aa_values) | |
print genet.parse_result_data(raw_html) |
OlderNewer