Skip to content

Instantly share code, notes, and snippets.

Michael Sproul michaelsproul

Block or report user

Report or block michaelsproul

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
@michaelsproul
michaelsproul / generic_beacon_state.rs
Last active May 7, 2019
Experiments with generic-array and BeaconState
View generic_beacon_state.rs
use generic_array::*;
use std::marker::PhantomData;
use typenum::Unsigned;
use typenum::{U1024, U4096, U512, U8192};
type Hash = [u8; 32];
type Crosslink = u64;
trait FixedArray<T> {
// Not using `std::Default` for brevity.
View excel_tax.xlsx
IF(EXACT($C12, "Sell"), IF($E12 - $I12 < VLOOKUP($K12, $A$1:$N$146, 5) - SUMIF($H$2:$H11, $H12, $I$2:$I11) - SUMIF($K$2:$K11, $K12, $L$2:$L11), $E12 - $I12, VLOOKUP($K12, $A$1:$N$146, 5) - SUMIF($H$2:$H11, $H12, $I$2:$I11) - SUMIF($K$2:$K11, $K12, $L$2:$L11)), "")
@michaelsproul
michaelsproul / slack_matrix.md
Last active Jul 19, 2018
Notes on Matrix <-> Slack Integration
View slack_matrix.md
@michaelsproul
michaelsproul / cap_types.sh
Last active Jul 16, 2018
Find types of caps used in a capDL spec
View cap_types.sh
grep '.type = CDL_' capdl_spec.c | sed 's/.*\(\.type = CDL_[[:alnum:]]*\).*/\1/' | sort | uniq
@michaelsproul
michaelsproul / constraints.txt
Last active Feb 18, 2018
Populus and Vyper setup
View constraints.txt
ethereum==1.6.1
eth-utils==0.7.1
View caddy.conf
[program:caddy]
command=/home/caddy/sproul.xyz/start.sh
directory=/home/caddy/sproul.xyz
user=caddy
environment=HOME="/home/caddy",USER="caddy"
@michaelsproul
michaelsproul / wa-results.txt
Created Jul 15, 2017
Western Australia Senate Results (as of 15/07/2017)
View wa-results.txt
=== Elected ===
Mathias CORMANN (Liberal) [521540 votes]
Sue LINES (Australian Labor Party) [379352 votes]
Rachel SIEWERT (The Greens (WA)) [139395 votes]
Michaelia CASH (Liberal) [416033 votes]
Glenn STERLE (Australian Labor Party) [272937 votes]
Dean SMITH (Liberal) [310808 votes]
Patrick DODSON (Australian Labor Party) [170055 votes]
Linda REYNOLDS (Liberal) [206560 votes]
Chris BACK (Liberal) [105249 votes]
@michaelsproul
michaelsproul / bitcoin-data-dir.md
Last active Jul 3, 2017
Seamlessly move Bitcoin data directory
View bitcoin-data-dir.md

I just moved my bitcoin data out of ~/.bitcoin by using the -datadir flag to bitcoind.

$ bitcoind -daemon -datadir=/external-drive/btc

However, I found that I now needed to pass -datadir=/external-drive/btc to bitcoin-cli in order for the passwordless authentication to succeed.

Rather than passing the flag every time, you can also change where bitcoind will stash the authentication cookie (which is what enables passwordless auth). Moving it back to ~/.bitcoin/.cookie does the trick, like so:

@michaelsproul
michaelsproul / btc.ksy.yaml
Last active Nov 9, 2017
Kaitai Struct parser for Bitcoin Transactions
View btc.ksy.yaml
# Bitcoin Transaction
# Spec: https://en.bitcoin.it/wiki/Transaction
meta:
id: btc_txn
endian: le
file-extension: txn
seq:
# Bitcoin version, usually 1.
- id: version
type: u4
@michaelsproul
michaelsproul / zfsautoimport.plist
Last active Apr 2, 2017
Slightly broken script to automatically import ZFS pools from an external HDD on OS X
View zfsautoimport.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>zfsautoimport</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/zpool</string>
<string>import</string>
You can’t perform that action at this time.