Skip to content

Instantly share code, notes, and snippets.

View evan-goode's full-sized avatar

Evan Goode evan-goode

View GitHub Profile
@evan-goode
evan-goode / a-bad-way-to-calculate-probabilities.markdown
Created October 28, 2018 03:52
a bad way to calculate probabilities
#!/usr/bin/env python3
import json
import math
import random
import yaml
import dominate
from dominate.tags import *
def load_yaml (filename):
@evan-goode
evan-goode / goodbye.js
Created February 17, 2016 19:38
userscripts
var script = document.createElement("script")
script.id = "goodbye"
script.innerHTML = " \
window.onbeforeunload = null \
"
document.documentElement.appendChild(script)
@evan-goode
evan-goode / weather-emoji.sh
Created February 10, 2016 03:30
returns an emoji representing the current weather conditions in a specified location
#!/bin/bash
woeid="2390183"
weather=`curl --silent "http://xml.weather.yahoo.com/forecastrss?w=${woeid}&u=f" | xmllint --xpath "string(//*[local-name()='condition']//@code)" -`
# codes from https://developer.yahoo.com/weather/documentation.html#codes
case "$weather" in
0) # tornado
emoji="🌪" # cloud with tornado
;;
@evan-goode
evan-goode / or.js
Last active December 9, 2015 04:39
function or(array) {
var probability = 0
var combos = []
for(var i = 1; i < array.length + 1; i++) {
var combinations = getCombinations(array, i)
for(var j = 0; j < combinations.length; j++) {
combos.push(combinations[j])
}
}