Skip to content

Instantly share code, notes, and snippets.

View nmarley's full-sized avatar
🦀
我想吃一點點東西。

Nathan Marley nmarley

🦀
我想吃一點點東西。
View GitHub Profile
@nmarley
nmarley / reverse-hex.rb
Last active July 2, 2019 12:56
Ruby reverse bytes in hex string (endianness)
# Ruby reverse bytes in hex string (endianness)
def flip_bytes(hex)
return hex.scan(/../).reverse.join('')
end
hs = "e0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"
puts flip_bytes(hs)
@nmarley
nmarley / conv.rb
Last active August 9, 2017 17:20
Convert Dash BIP32 extended public key version prefix from 'xpub' to 'drkv'
#! /usr/bin/env ruby
# Utility converting BIP32 extended key version bytes
require './dashutil'
xkey = ARGV.shift
pref = ARGV.shift
# xpub661MyMwAqRbcFnEEbFf8idiyo8QGKiqhTujUmaJsDhAEZ82cEQPMq69Y4V27vGc5rJnxsd26kyHpBJDW72YMjntsmASbdBy1awfGMsUvLCa
@nmarley
nmarley / swap-version.php
Last active December 15, 2016 02:28
BIP32 serialization version byte swap using BitWasp's bitcoin-php library
<?php
use BitWasp\Bitcoin\Base58;
use BitWasp\Buffertools\Buffer;
use BitWasp\Buffertools\BufferInterface;
use BitWasp\Buffertools\Buffertools;
require "./vendor/autoload.php";
class XKeyUtil {
@nmarley
nmarley / bitwalletrecover.py
Created April 1, 2016 15:09 — forked from UdjinM6/bitwalletrecover.py
bitwalletrecover.py - recover compressed private keys from your bitcoin/litecoin/darkcoin wallet. Requires python3, pycoin (https://pypi.python.org/pypi/pycoin), and base58 (https://pypi.python.org/pypi/base58).
## bitwalletrecover.py - recover private keys from your darkcoin wallet
## (this version was not tested with bitcoin/litecoin).
## Requires python3, pycoin (https://pypi.python.org/pypi/pycoin),
## and base58 (https://pypi.python.org/pypi/base58).
##
## Starting with Python 3.4, pip is included by default with the Python binary
## installers. To install pip for older versions 3.x:
##
## sudo apt-get install python3-setuptools
## sudo easy_install3 pip
@nmarley
nmarley / pubkey_to_address.js
Last active September 10, 2019 11:45
Ethereum public key hex string to address
var eu = require('ethereumjs-util')
var uncompressed_public_key_hex = '04320c6bb9c30cd4ee54484ad10b01d2742105a70b9333b2310be8e870344f18f23d70897cf0588510fc28cf76b637902179cc2d3ead649718bef61c6eb95cec7e'
var upk_buf = new Buffer(uncompressed_public_key_hex, 'hex')
var addr_buf = eu.pubToAddress(upk_buf.slice(1,65))
var addr = addr_buf.toString('hex')
console.log("addr: " + eu.toChecksumAddress(addr) )
@nmarley
nmarley / .gitignore
Last active June 3, 2019 00:49
Armstrong Economics XML feed parser -- caching broken on site, but XML feed working
armstrong-economics.zip
aws-lambda/
@nmarley
nmarley / README.md
Created August 11, 2016 23:33
SMB mount from OSX

smb_mount

Examples for mounting Windows network filesystem(s) from an OSX client.

  1. List available shares/disks on computer 'mb052361' (as local Windows user 'root'):

    smbutil view //root:password@mb052361

Output:

@nmarley
nmarley / ipv6.py
Created September 22, 2016 17:27
IPv6 Shortener in Python
import re
def shorten(ipv6_long):
hextets = ipv6_long.split(':')
temp = []
for hextet in hextets:
# trim leading '0's
hextet = re.sub(r'^0+', '', hextet)
@nmarley
nmarley / README.md
Last active June 17, 2017 22:27
Dash v12.0 Proposal Import for v12.1 testing...

Dash v12.0 Proposal Import for v12.1 testing...

Basic instructions:

Note:

The export must be run against a v12.0 node. The import must be run from a v12.1 hot wallet which is unlocked (so that prepare collateral tx's can be executed).

  1. Clone special branch of sentinel:
@nmarley
nmarley / keybase.md
Created November 25, 2016 15:58
keybase.md

Keybase proof

I hereby claim:

  • I am nmarley on github.
  • I am nmarley (https://keybase.io/nmarley) on keybase.
  • I have a public key whose fingerprint is B3BF 1ADA 5118 4FF3 0B17 B2B4 AAE1 CD6B A06E 985C

To claim this, I am signing this object: