Skip to content

Instantly share code, notes, and snippets.


Guy Aridor rawls238

  • Columbia University
  • New York, NY
View GitHub Profile
import numpy as np
import multiprocessing
from joblib import Parallel, delayed
from scipy.stats import bernoulli
def test(i, dist):
#dist = bernoulli(0.7)
return dist.rvs()
rawls238 /
Last active Aug 25, 2017
code to simulate quiz winning probs
from random import random
import numpy as np
from itertools import permutations
def answer_correctly(threshold):
return random() <= threshold
def next_turn(round_num, num_teams, answered_last_correctly, ty = 'rotate'):
if ty == 'rotate':
return round_num % num_teams
View powerball scraper
import requests
from collections import Counter
f = requests.get('').text
c = Counter()
for line in f.split('\n'):
c.update([x for x in line.split(' ') if x.isdigit()])
View basic-db.js
'use strict'
var http = require('http');
const PORT = 4000;
let inMemoryStore = {};
const parseQueryParams = (str) => {
const split = str.split('&');
View parametrize.js
class SignupExp extends PlanOut.Experiment {
//...other config
assign(params, args) {
params.set('signup_form_text', new PlanOut.Ops.Random.UniformChoice(choices=['Join Now', 'Sign up'], unit=userId));
params.set('signup_nav_text', new PlanOut.Ops.Random.UniformChoice(choices=['Welcome to the Future', 'This product is great'], unit=userId));
const exp = new SignupExp({userId: 'foo'});
View invite-suggestions-exp.jsx
export default parametrize(InviteSuggestionsExperiment, ['suggestionCount', 'inviteText'], InviteSuggestions);
View InviteSuggestionsExp.js
class InviteSuggestions extends Experiment {
//do some logger configuration
setup() {
assign(params, args) {
if (!args.paying_user) {
return false;
View invite-suggestions.jsx
const InviteSuggestions = React.createClass({
getDefaultProps() {
return {
numSuggestionsToShow: 0,
inviteButtonText: null
renderInviteSuggestions() {
const suggestions = this.props.suggestions.slice(0, this.props.numSuggestionsToShow);