Skip to content

Instantly share code, notes, and snippets.

🦋

Eric Scrivner etscrivner

🦋
Block or report user

Report or block etscrivner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@etscrivner
etscrivner / signal_v_noise.rb
Created Jan 24, 2017
Why choosing good metrics is important.
View signal_v_noise.rb
require 'csv'
def percent_support_tickets(time)
1.0 - ((time + 5) / 200.0)
end
seed = Random.new_seed
prng = Random.new(seed)
puts "Seed: #{seed}"
@etscrivner
etscrivner / EIP150ReplaySafeSplit.sol
Last active Jan 29, 2017
Safe splitting contract that accounts for EIP-150 and ETH/ETC hard forks.
View EIP150ReplaySafeSplit.sol
pragma solidity ^0.4.2;
contract EIP150ReplaySafeSplit {
// Fork oracle for EIP-150 fork
AmIOnEIP150Fork amIOnEIP150Fork = AmIOnEIP150Fork(/* To be deployed */);
// Fork oracle for ETH/ETC fork
AmIOnTheFork amIOnDAOFork = AmIOnTheFork(0x2bd2326c993dfaef84f696526064ff22eba5b362);
// This routine provides a way to route funds across Ethereum chain forks. It preserves
// the signature of split method from DAO hard-fork replay split contract. If the current
@etscrivner
etscrivner / AmIOnEIP150Fork.sol
Last active Oct 18, 2016
EIP-150 fork oracle.
View AmIOnEIP150Fork.sol
pragma solidity ^0.4.2;
contract AmIOnEIP150Fork {
// Tracks whether or not hard fork is effective on this chain.
bool public forked = false;
// Event emitted on updates during fork window to indicate status.
event ForkedStatus(bool forked);
// This function should be called between block X and Y.
function update() {
@etscrivner
etscrivner / EIP150ForkConstant.sol
Last active Oct 17, 2016
Solidity contract used to determine the constant that should be used in EIP-150 fork oracle.
View EIP150ForkConstant.sol
pragma solidity ^0.4.2;
contract EIP150ForkConstant {
// Used to determine gas constant
event GasConstant(uint first, uint second, uint third);
event OnFork(bool forked);
// This function should be called between block X and Y.
function run() {
uint beforeGas = 0;
View keybase.md

Keybase proof

I hereby claim:

  • I am etscrivner on github.
  • I am escrivner (https://keybase.io/escrivner) on keybase.
  • I have a public key whose fingerprint is 74A8 F331 A8B7 C5D8 0879 52B4 5A2E 7AA7 837C C233

To claim this, I am signing this object:

@etscrivner
etscrivner / trinums.hoon
Created Jul 10, 2016
Hoon for producing triangular/tetrahedral numbers.
View trinums.hoon
|= number/@
=/ curnum 1
|- ^- (list @)
?: (gth curnum number) ~
:_ $(curnum (add 1 curnum))
=< (roll (triangular curnum) add)
|%
++ iota
|= {start/@ end/@}
=/ count start
View chi_squared_spike.py
import csv
import math
from lib import statistics
from lib import integration
def get_data(csv_file):
with open(csv_file, 'r') as table:
reader = csv.DictReader(table)
@etscrivner
etscrivner / title.py
Created Feb 25, 2016
basestring.title is funky
View title.py
>>> "62nd".title()
"62Nd"
>>> "West 62nd st.".title()
"West 62Nd St."
@etscrivner
etscrivner / json_bench.py
Created Dec 15, 2015
Simple JSON Benchmarking For Python
View json_bench.py
# -*- coding: utf-8 -*-
"""
json_bench
~~~~~~~~~~
JSON encoding benchmark
"""
import datetime
import itertools
@etscrivner
etscrivner / facebook-sdk-test-failures.txt
Created Nov 17, 2015
Failing unit-tests from facebook-sdk when @unittest.skip decorator is removed.
View facebook-sdk-test-failures.txt
======================================================================
ERROR: test_valid_versions (__main__.TestAPIVersion)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/eric/Code/python/facebook-sdk/test/test_facebook.py", line 101, in test_valid_versions
self.assertEqual(str(graph.get_version()), version)
File "facebook/__init__.py", line 213, in get_version
raise self.create_exception_for_error(response)
GraphAPIError: An active access token must be used to query information about the current user.
You can’t perform that action at this time.