Skip to content

Instantly share code, notes, and snippets.

View RooSoft's full-sized avatar

Marc Lacoursière RooSoft

View GitHub Profile
@RooSoft
RooSoft / p2pkh_test.exs
Created August 12, 2022 16:24
parse a standard transaction to bitcoin address (pay-to-pubkey-hash)
pub_key_hash_size = 0x14
pub_key_hash = 0x12AB8DC588CA9D5787DDE7EB29569DA63C3A238C
# 76 a9 14 12ab8dc588ca9d5787dde7eb29569da63c3a238c 88 ac
# OP_DUP OP_HASH160 OP_PUSHBYTES_20 12ab8dc588ca9d5787dde7eb29569da63c3a238c OP_EQUALVERIFY OP_CHECKSIG
script =
<<@dup::8, @hash_160::8, pub_key_hash_size::8, pub_key_hash::160, @equal_verify::8,
@check_sig::8>>
# can probably be gotten by https://hexdocs.pm/curvy/Curvy.html#sign/3
@RooSoft
RooSoft / watch.sh
Created September 30, 2020 18:01
Watch folder for file manipulation
usage() {
echo "Usage: ${0} folder" >&2
echo "Watches file manipulations in a folder" >&2
exit 1
}
if [[ "$#" -ne 1 ]] ; then
usage
fi
@RooSoft
RooSoft / trap.sh
Created January 1, 2020 16:18
How to trap ctrl-c in a bash script
#!/bin/bash
ctrlc_count=0
function no_ctrlc()
{
let ctrlc_count++
echo
if [[ $ctrlc_count == 1 ]]; then
echo "Stop that."
@RooSoft
RooSoft / bumpme
Last active September 25, 2019 17:21
For concourse tutorial purposes
Wed Sep 25 17:21:13 UTC 2019
### Keybase proof
I hereby claim:
* I am roosoft on github.
* I am roosoft (https://keybase.io/roosoft) on keybase.
* I have a public key ASDJUx3y7nbSQQDAGLMthYoAzLNmGK-2Xv_AJSAQdJdyNQo
To claim this, I am signing this object:
@RooSoft
RooSoft / gist:4069761
Created November 14, 2012 01:55
Hello world
world = 'world'
"hello #{world}"
@RooSoft
RooSoft / gist:4069753
Created November 14, 2012 01:54
Sinatra hello world
require 'sinatra'
get '/' do
'Hello world'
end