Skip to content

Instantly share code, notes, and snippets.

View tynes's full-sized avatar
👽
take me to your leader

Mark Tyneway tynes

👽
take me to your leader
View GitHub Profile
@tynes
tynes / commonAncestor.js
Created October 26, 2016 01:56
binary tree traversal to find common ancestor
const BinaryTree = class {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
addLeftChild(value) {
if (this.left) {
console.log('Left child being overwritten');
}
@tynes
tynes / bash-entropy-music
Created December 8, 2016 19:08
generate music from entropy on the command line
#!/bin/bash
cat /dev/urandom | hexdump -v -e '/1 "%u\n"' | awk '{ split("0,2,4,5,7,9,11,12",a,","); for (i = 0; i < 1; i+= 0.0001) printf("%08X\n", 100*sin(1382*exp((a[$1 % 8]/12)*log(2))*i)) }' | xxd -r -p | aplay -c 2 -f S32_LE -r 16000
@tynes
tynes / init.lua
Created December 29, 2016 22:29
Hammerspoon config file v0.1
--------------------------------------------------------------------------------
-- CONSTANTS
--------------------------------------------------------------------------------
local cmd_alt_shift = {"cmd", "alt", "shift"}
local cmd_alt_ctrl = {"cmd", "alt", "ctrl"}
local cmd_alt_ctrl_shift = {"cmd", "alt", "ctrl", "shift"}
--------------------------------------------------------------------------------
-- CONFIGURATIONS
--------------------------------------------------------------------------------
Verifying that "_tynes.id" is my Blockstack ID. https://onename.com/_tynes
@tynes
tynes / keybase.md
Created February 11, 2018 20:17
Keybase Proof

Keybase proof

I hereby claim:

  • I am tynes on github.
  • I am tynes (https://keybase.io/tynes) on keybase.
  • I have a public key ASAVvc3HHzL9Bo-ONgHr5kPLb36EBcQWsmsgLL1y0jMPaAo

To claim this, I am signing this object:

@tynes
tynes / dexec.sh
Created May 17, 2018 22:15
docker exec bash alias
# usage:
# dexec <cmd>
# uses fzf to select running container then runs
# $ docker run [selected] <cmd>
# with /bin/bash as the default cmd
# TODO: add some pretty printing
function dexec() {
local selected_image
# set an env var to the path to a config
export REGTEST_CONFIG=$HOME/.config/hsd/regtest.conf
# this assumes you have git cloned and npm installed handshake
# be sure to start your handshake node with the same config
# ./bin/hsd --config=$REGTEST_CONFIG
# the cli tools live in node_modules/.bin
# also depends on jq
@tynes
tynes / write.js
Last active March 22, 2019 01:38
#!/usr/bin/env node
/*
* write.js
*
* usage: writes a string to a file
*
* $ ./write.js <path to file> <contents of file>
*/
#!/bin/bash
# pull gmax's lattest banlist, replace ./bitcoin-cli
# with bcoin-cli and write it to disk as a bash script
# WARNING: please inspect the file before executing it
# works correctly as of 4/10/19
curl -s https://people.xiph.org/~greg/banlist.cli.txt \
| sed 's/\.\/bitcoin-cli/bcoin-cli\ rpc/g' \
| sed '1s/^/#!\/bin\/bash\n\n/' > banlist.sh

hsd Watch Only Wallet Simplification

Overview

The hsd wallet has an edge case regarding watch only wallet usage that results in the incorrect path being returned to the client. This will result in invalid signature creation because the wrong key will be derived and used to sign the transaction. Using an extra API call, it is possible to work around this problem right now, but it is not ideal and is fixable.