Skip to content

Instantly share code, notes, and snippets.

View JulianNorton's full-sized avatar
🔒

Julian Norton JulianNorton

🔒
View GitHub Profile
@JulianNorton
JulianNorton / calculate_simulations.py
Last active February 23, 2020 21:14
Calculating loot distribution for a given player base
from random import *
# lock the results for reproducibility
seed(1)
# Staff of shadow flame is estimated to be between 7-8%
drop_rate = .075
# Total players who are competing
pool_size = 3
/var/app/weather-10kb/src/modules/WeatherRequest.js:18
timezone.key(process.env.GOOGLE_TIMEZONE_API_KEY);
^
TypeError: timezone.key is not a function
at Object.<anonymous> (/var/app/weather-10kb/src/modules/WeatherRequest.js:18:10)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
@JulianNorton
JulianNorton / uninstall-rippling.sh
Created August 13, 2018 22:31
uninstall rippling
#!/bin/bash
if [ `id -u` -ne 0 ]; then
echo "Rippling uninstall must be run by root"
exit 1
fi
sudo launchctl unload /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /opt/rippling
@JulianNorton
JulianNorton / retention_analysis.py
Last active July 12, 2018 16:13
retention analysis by cohort
import csv
org_data = open("data2.csv")
data_alpha, data_beta, org_first_seen = list(), list(), list()
with open('data2.csv', 'rb') as csvfile_A:
csvfile_A = csv.reader(csvfile_A)
for item in csvfile_A:
@JulianNorton
JulianNorton / click_input_items.js
Last active July 6, 2018 14:31
deletes amazon shopping cart by finding an element by input value of "delete" and clicking it with a delay
function click_input_items() {
matching_inputs = document.querySelectorAll('input[value="Delete"]');
matching_inputs.forEach((ele)=>{
setInterval(function(){ele.click()}, 100);
})
}
click_input_items()
@JulianNorton
JulianNorton / timeit.py
Created February 27, 2018 17:51
test how long it takes to print numbers
# time how long a function takes
import timeit
def display_numbers():
for i in range(1000):
print(i)
print(timeit.timeit(stmt=display_numbers, number=1))
@JulianNorton
JulianNorton / pi_installation.sh
Last active April 5, 2018 13:48
Raspberry pi installation script alexa
# change change password, keyboard layout, enable ssh, enable wifi
sudo raspi-config
# update
sudo apt-get update
# install git
sudo apt-get install git -y
# vim
@JulianNorton
JulianNorton / encrypt.py
Last active September 24, 2017 21:07
script to sanitize data to unique hashes
import hashlib
from hashlib import blake2b
log_file = open("ip_addresses.txt", "r").read().splitlines();
new_file = open("new.csv", 'w')
for line in log_file:
h = blake2b(key=b'secret_key_change_this!', digest_size=10)
h.update((line).encode())
parsed_line = h.hexdigest()
@JulianNorton
JulianNorton / 170908_riddler-nation-goes-to-war.py
Last active September 11, 2017 14:10
170908_riddler-nation-goes-to-war
# https://fivethirtyeight.com/features/riddler-nation-goes-to-war/
# http://www.bicyclecards.com/how-to-play/war/
import random
# https://docs.python.org/3/library/random.html
random.seed(0)
# Ace is 14
def deck_of_aces():
return [(14,'club'),(14,'diamond'),(14,'heart'),(14,'spade')]
@JulianNorton
JulianNorton / calculate_bs.py
Created September 1, 2017 18:19
170901 Riddler Express
'''
https://fivethirtyeight.com/features/is-your-friend-full-of-it/
Riddler Express
From Shaun Raviv, a tall tale on the basketball court:
You’re hanging out with some friends, shooting the breeze and talking sports.
One of them brags to the group that he once made 17 free throws in a row after years of not having touched a basketball.
You think the claim sounds unlikely, but plausible. Another friend scoffs, thinking it completely impossible.
Let’s give your bragging friend the benefit of the doubt and say he’s a 70-percent free-throw shooter.