Skip to content

Instantly share code, notes, and snippets.

@macterra
macterra / poisson.py
Created December 31, 2018 01:32
Calculate mean and stdev for most recent 1000 block times
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from datetime import datetime
from dateutil import tz
import numpy
N = 1000
rpc_connection = AuthServiceProxy("http://[name]:[pass]@127.0.0.1:8332")
best_block_hash = rpc_connection.getbestblockhash()
tip = rpc_connection.getblock(best_block_hash)
max = tip["height"]
from jira import JIRA
from datetime import timedelta, date
import dateutil.parser
def daterange(startDate, endDate):
for n in range(int ((endDate - startDate).days)):
yield startDate + timedelta(n)
jira = JIRA('https://jira.synaptivemedical.com', basic_auth=('davidmcfadzean', '[redacted]'))
@macterra
macterra / burndown.py
Last active July 26, 2017 12:44
script to generate burndown stats csv from Jira
from jira import JIRA
from datetime import timedelta, date
def daterange(startDate, endDate):
for n in range(int ((endDate - startDate).days)):
yield startDate + timedelta(n)
jira = JIRA('https://jira.synaptivemedical.com', basic_auth=('davidmcfadzean', '[redacted]'))
startDate = date(2017, 5, 1)
import random
def hist(x):
h = [0 for i in range(11)]
band = x[N-1]/10.0
for i in range(N):
dec = (int)(x[i]/band)
h[dec] = h[dec] + 1

Keybase proof

I hereby claim:

  • I am macterra on github.
  • I am mcfadzean (https://keybase.io/mcfadzean) on keybase.
  • I have a public key whose fingerprint is 0914 576F E182 5A2B 59FC 6583 0ACC 87BA D50C 0FAA

To claim this, I am signing this object:

@macterra
macterra / gist:1155302
Created August 18, 2011 21:36
recursively strip the last two chars from filenames
#!/bin/sh
#recursively strip the last two chars from filenames
#shane s antyr
find . -type f -print | while read file
do
file_clean=$( echo ${file} | sed 's/\(.*\)../\1/')
echo $file $file_clean
mv $file $file_clean
done
#!/usr/bin/python
import random, sys
nCouples = int(sys.argv[1])
iters = int(sys.argv[2])
tot = 0.0
for x in range(iters):
nMales = nCouples
nFemales = nCouples
import random
nCouples = 1000000
nMales = nCouples/2
nFemales = nCouples/2
nSonlessCouples = nCouples
while nSonlessCouples > 0:
for i in range(nSonlessCouples):
if random.random() < 0.5: