Skip to content

Instantly share code, notes, and snippets.

@snitzr
snitzr / monty_hall.py
Last active April 1, 2020 21:24
Monty Hall problem outcome simulator
import random
# probability calculator
def monty():
runs = 5000
true_switch_win_counter = 0
false_switch_win_counter = 0
true_switch_counter_total = 0
@snitzr
snitzr / .vimrc
Last active January 14, 2018 06:39
The .vimrc I use
set nocompatible " must be first
" non-terminal UI edits start
set go-=T " hide toolbar
set go-=r " hide scrollbar
set go-=R " hide scrollbar
set go-=l " hide scrollbar
set go-=L " hide scrollbar
" set go-=m
" set mouse=a
@snitzr
snitzr / .zshrc
Last active January 14, 2018 06:15
# My .zshrc used with Zsh and Oh My Zsh https://github.com/robbyrussell/oh-my-zsh
# Path to your oh-my-zsh installation.
export ZSH=/Users/aaronsnitzer/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
@snitzr
snitzr / twitter_bot.py
Created May 29, 2016 13:44
twitter_bot.py
#!/usr/bin/env python3
# MIT license
from tweepy import OAuthHandler, Stream, API
from tweepy.streaming import StreamListener
import sqlite3
import secrets
# auth
# add a file called secrets.py next to bot.py and enter keys and tokens into variables.
@snitzr
snitzr / bitcoin.py
Last active January 29, 2018 08:31
Python version of Satoshi Nakamoto's blockchain formula originally written in C. Original function: https://bitcoin.org/bitcoin.pdf.
import math
import ast
def attacker_success_probability(q, z):
p = (1 - q)
lamb = (z * (q / p))
some = 1
k = 0
while (k <= z):
@snitzr
snitzr / geolocate.js
Last active January 29, 2018 08:31
Find user location with GPS
// adapted and simplified from
// https://developers.google.com/web/fundamentals/native-hardware/user-location/obtain-location
// find location
window.onload = function() {
var geoOptions = {
timeout: 10000, // milliseconds
maximumAge: 5 * 60 * 1000 // milliseconds
}