Skip to content

Instantly share code, notes, and snippets.

View dylanjw's full-sized avatar

Dylan Wilson dylanjw

  • British Columbia
View GitHub Profile
#!/bin/sh
# This script wants to synchronize multiple public Git repositories with each
# other
#
# Use it (e.g. in a Jenkins job) like this:
#
# $0 <Git-URL>...
#
# where Git-URL is either a push URL, or a pair of a fetch and a push URL
@dylanjw
dylanjw / generate_parity_fixtures.py
Created January 27, 2018 07:00
generate_parity_fixtures.py
import contextlib
import json
import os
import pprint
import shutil
import signal
import socket
import subprocess
import sys
import time

original eth-tester estimate_gas:

421     def estimate_gas(self, transaction):
  1         # TODO: move this to the VM level (and use binary search approach)
  2         signed_evm_transaction = self._get_normalized_and_signed_evm_transaction(
  3             dict(transaction, gas=self._max_available_gas()),
  4         )
  5 
  6         computation = _execute_and_revert_transaction(self.chain, signed_evm_transaction, 'pending')
@dylanjw
dylanjw / gitcoin_claim_strategies.txt
Last active March 14, 2018 21:31
Initial claim selection strategies with PRO/CON.
1. first-come-first-serve issue claiming (how it is now)
pros:
- Most accepting to new contributors
- Helps grow # of contributors
- Has a feeling of fairness
- Is built-in to gitcoin; no added guidelines need to be enforced.
cons:
- Code quality varies (increases review effort)
import time
import web3
from solc import compile_source
from web3 import Web3, EthereumTesterProvider
contract_source = '''
pragma solidity ^0.4.18;
@dylanjw
dylanjw / gist:fb8b38ac2596bb46a536c4fa8781c5da
Last active December 1, 2018 18:13
Issue running `make release-desktop` in status-react
$ make release-desktop
git clean -qdxf -f ./index.desktop.js desktop/
scripts/run-pre-build-check.sh desktop
Finished!
lein prod-build-desktop
Updating hook: pre-commit
Updating hook: pre-commit
Updating hook: pre-commit
Compiling ClojureScript...
Compiling ["index.desktop.js"] from ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src" "env/prod"]...
@dylanjw
dylanjw / get_token_recipient_senders.py
Created April 8, 2020 07:25
Add function for retrieving token recipient senders
from web3 import HTTPProvider, Web3
erc20_abi = json.loads('[{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"d
@dylanjw
dylanjw / Example2_1.rs
Last active May 21, 2020 19:26
Functional Data Structures ex 2.1
use std::rc::Rc;
#[derive(Debug)]
pub struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Rc<Node<T>>>;
// Option because sometimes there is no Node.
// Nodes need to be wrapped in an RC because we need to