-
Find the Discord channel in which you would like to send commits and other updates
-
In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!
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
"""Embed a YouTube video via its embed url into a notebook.""" | |
from functools import partial | |
from IPython.display import display, IFrame | |
width, height = (560, 315, ) | |
def _iframe_attrs(embed_url): | |
"""Get IFrame args.""" | |
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
"""Test how many threads we can run at once.""" | |
import itertools | |
import threading | |
import time | |
import sys | |
import requests | |
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
"""Calculate the average number of moves in a snakes and ladders game. | |
Because as a parent one gets roped into these board (boring?) games | |
every so often, and I wanted to calculate the average duration of a | |
snakes and ladders game. Turns out it's about 36 moves (though | |
admittedly that's for a single-player game). :-) | |
> python snakes_and_ladders.py | |
Played 10000 rounds, averaged 36.0559 moves, max 324 moves, took 0.508s | |
""" |
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
"""Calculate the probability of generating a duplicate random number after | |
generating "n" random numbers in the range "d". | |
Usage: python birthday_probability.py n [d=365] | |
Each value can either be an integer directly, or in the format "2**x", where | |
x is the number of bits in the value. | |
For example, to calculate the probability that two people will have the same | |
birthday in a room with 23 people: |
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 gym | |
import numpy as np | |
import matplotlib.pyplot as plt | |
env = gym.make('CartPole-v0') | |
env.render(close=True) | |
#vector of means(mu) and standard dev(sigma) for each paramater | |
mu=np.random.uniform(size=state.shape) | |
sigma=np.random.uniform(low=0.001,size=state.shape) | |
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
"""Print most frequent N-grams in given file. | |
Usage: python ngrams.py filename | |
Problem description: Build a tool which receives a corpus of text, | |
analyses it and reports the top 10 most frequent bigrams, trigrams, | |
four-grams (i.e. most frequently occurring two, three and four word | |
consecutive combinations). | |
NOTES |
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
Show hidden characters
{ | |
// Custom brackets for LaTeX+ for the BracketHighlighter Sublime Text 3 plugin | |
// Needs the LaTeX+ plugin from https://github.com/randy3k/Latex-Plus/ | |
// And the BracketHighlighter plugin from https://github.com/facelessuser/BracketHighlighter | |
// Based on this page https://github.com/randy3k/Latex-Plus/wiki/BracketHighlighter-settings | |
// | |
// HowTo use: save this to Packages/User/bh_core.sublime-settings | |
// (or Menu > Preferences > Package Settings > BracketHighlighter > Brackets Settings - User) | |
// | |
// FIXME reorder the objects in a more logical fashion |
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
#!/usr/bin/env python3 | |
''' | |
Filter to wrap Pandoc's CodeBlocks into minted blocks when using latex. | |
Pandoc's `fence_code_attributes` can be used to provide: | |
- the language (first class) | |
- minted's argumentless options (following classes) | |
- minted's options with arguments (attributes) | |
''' |