Skip to content

Instantly share code, notes, and snippets.

View vgoklani's full-sized avatar

Vishal Goklani vgoklani

View GitHub Profile
@johan
johan / widgets.js
Last active December 10, 2015 19:08
2013-01-07 version of http://platform.twitter.com/widgets.js
// http://platform.twitter.com/widgets.js captured 2013-01-07
if (!window.__twttrlr) {
(function (a, b) {
function s(a) {
for (var b = 1, c; c = arguments[b]; b++) for (var d in c) a[d] = c[d];
return a
}
function t(a) {
return Array.prototype.slice.call(a)
@aelaguiz
aelaguiz / gist:4455549
Last active October 8, 2016 15:13
Quick & Dirty Theano benchmark
import numpy
import theano
import theano.tensor as T
import config
import time
def theano_softmax():
x = T.fmatrix('x')
_y = T.nnet.softmax(x)
anonymous
anonymous / gist:4365081
Created December 23, 2012 18:26
On Friday, 12/21/2012, The American Statistician published a paper by Stavros Kourouklis in which he proposed a new correction factor for estimating the standard deviation of a distribution based on a finite sample. The article describes the surprisingly simple formula for calculating the correction term and provides a proof that this formula at…
n_sims = 1_000_000
mle_se = zeros(n_sims)
unbiased_se = zeros(n_sims)
yatracos_std_se = zeros(n_sims)
kourouklis_std_se = zeros(n_sims)
for sim in 1:n_sims
n = 10
x = randn(n)
@twiecki
twiecki / ipcluster.py
Created December 10, 2012 17:03
Relevant changes to starcluster ipcluster.py code to start multiple ipython nbs on multiple ports
def _start_notebook(self, master, user, profile_dir, profile_name='default', notebook_port=8888):
master.ssh.execute('ipython profile create %s' % profile_name)
log.info("Setting up IPython web notebook for user: %s" % user)
user_cert = posixpath.join(profile_dir, '%s.pem' % user)
ssl_cert = posixpath.join(profile_dir, '%s.pem' % user)
if not master.ssh.isfile(user_cert):
log.info("Creating SSL certificate for user %s" % user)
ssl_subj = "/C=US/ST=SC/L=STAR/O=Dis/CN=%s" % master.dns_name
master.ssh.execute(
"openssl req -new -newkey rsa:4096 -days 365 "
# Simulator for the simple Boltzmann machine of Coursera NN Lecture 11e
# Christian Jauvin - [email protected]
from collections import defaultdict
import numpy as np
# weights
w_v1_h1 = 2
w_h1_h2 = -1
w_h2_v2 = 1
# Simulator for the simple Boltzmann machine of Coursera NN Lecture 11e
# Christian Jauvin - [email protected]
from collections import defaultdict
import numpy as np
# weights
w_v1_h1 = 2
w_h1_h2 = -1
w_h2_v2 = 1
# Simulator for the simple Boltzmann machine of Coursera NN Lecture 11e
# Christian Jauvin - [email protected]
from collections import defaultdict
import numpy as np
# weights
w_v1_h1 = 2
w_h1_h2 = -1
w_h2_v2 = 1
@jseabold
jseabold / download_remote_dir.py
Created September 18, 2012 18:49
walk and download a remote http file server
# if you can, just use wget
# wget -np -r remote_url
import re
import os
import urllib2
import urlparse
import pycurl
from lxml import html
function mdump()
{
mongodump --db sqdev --collection $1 --query "{\"sid\" : \"$2\"}" --out $3
}
@swinton
swinton / settings.py
Created September 12, 2012 20:26
Example of connecting to the Twitter user stream using Requests.
# OAuth stuff...
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
ACCESS_TOKEN_SECRET = "YOUR_ACCESS_TOKEN_SECRET"
CONSUMER_KEY = "YOUR_CONSUMER_KEY"
CONSUMER_SECRET = "YOUR_CONSUMER_SECRET"