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
# Numerically stable and accurate implementation of the natural logarithm | |
# of the cumulative distribution function (CDF) for the standard | |
# Normal/Gaussian distribution in PyTorch. | |
import matplotlib.pylab as P # replace this with numpy if you want | |
import torch as T | |
def norm_cdf(x): | |
return (1 + T.erf(x/P.sqrt(2)))/2 |
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 torch as T | |
def h_poly_helper(tt): | |
A = T.tensor([ | |
[1, 0, -3, 2], | |
[0, 1, -2, 1], | |
[0, 0, 3, -2], | |
[0, 0, -1, 1] | |
], dtype=tt[-1].dtype) | |
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
from __future__ import division, print_function # Always do this just to | |
# ensure compatability | |
# between python 2.7 and 3 | |
import matplotlib.pylab as P | |
# Always do these next to lines to enable LaTeX to be used on the | |
# matplotlib plots | |
P.rc('text', usetex=True) | |
P.rc('font', family='serif') |
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
{ | |
"smoothScroll.pages.spring-constant": "800", | |
"smoothScroll.other.spring-constant": "800", | |
"mode.normal.focus_search_bar": "", | |
"mode.normal.scroll_page_down": "D", | |
"mode.normal.scroll_page_up": "U", | |
"mode.normal.scroll_half_page_down": "<space> d", | |
"mode.normal.scroll_half_page_up": "<s-space> u", | |
"mode.normal.tab_new_after_current": "T O", | |
"mode.normal.tab_move_backward": "<", |
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
set smoothscroll | |
let scrollstep = 100 | |
map O t |
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
#---------------------------------------------------------------# | |
# This script manually goes through youtube and collects all # | |
# of your viewing history into a convenient text file. This # | |
# might take about 30min to an hour, depending on your # | |
# computer's RAM, processing speed, and internet connection. # | |
# Note that this program requires the splinter module to work. # | |
# Run 'pip install splinter' to get it. # | |
#---------------------------------------------------------------# | |
print "Making sure you're not using python 3..." | |
from splinter import Browser |
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 tourney_in_order(k): | |
""" | |
Tells you the bracket for a tourney with n=2^k competitors 1-n, where 1 | |
is the best. The bracket is such that competitors lose in the order of | |
their skill to the person with a level of skill as close to theirs as | |
possible. | |
>>> bracket = tourney_in_order(4) | |
>>> print bracket | |
[16, 8, 15, 4, 14, 7, 13, 2, 12, 6, 11, 3, 10, 5, 9, 1] |