Skip to content

Instantly share code, notes, and snippets.

View shesek's full-sized avatar

Nadav Ivgi shesek

View GitHub Profile
@shesek
shesek / shutdown-status.sh
Created February 5, 2021 11:11
Display which services are in the process of shutting down (s6)
#!/bin/bash
sp='\|/-'
i=1
cd /var/run/s6/services
while :; do
services=$(for s in *; do s6-svstat $s 2> /dev/null | grep -q 'want down' && echo $s || true; done)
[ -n "$services" ] || break
echo -ne "[s6-finish] waiting for: $services ${sp:i++%${#sp}:1} \r"
sleep 0.2
done
@shesek
shesek / README.md
Created September 22, 2020 04:05
Rust - reproduible Windows exe builds - removing PE timestamps

For improved reproduciblity, you can build windows executables without the PE timestamps via mingw-w64 by setting:

RUSTFLAGS='-Clink-arg=-Wl,--no-insert-timestamp'

You may use something like this to conditionally set these flags for Windows builds only:

RUSTFLAGS="$RUSTFLAGS $([[ $platform != *"-windows-"* ]] || echo '-Clink-arg=-Wl,--no-insert-timestamp')" \
@shesek
shesek / address-to-scripthash.md
Last active January 5, 2024 00:55
Bitcoin address to electrum scripthash with nodejs
$ npm install bitcoinjs-lib
$ node -p 'b=require("bitcoinjs-lib");s=b.address.toOutputScript("2MwEUm842QN4YoetosKc1YbeFpHDjsZ6scS", b.networks.regtest);Buffer.from(b.crypto.sha256(s).reverse()).toString("hex")'

Note the b.networks.regtest, change if the address is on a different network.

@shesek
shesek / bitcoin-address-utxo.html
Last active December 19, 2023 08:11
Bitcoin address UTXO extractor based on Blockstream's API
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bitcoin address UTXO extractor</title>
<style>
table, .csv { display: none }
</style>
<div class="container py-5">
<h2>Bitcoin address UTXO query</h2>
<form class="mt-3">
<div class="form-group">
@shesek
shesek / index.pug
Last active February 18, 2019 10:40
Bitcoin address UTXO extractor based on Blockstream's API
.container.py-5
h2 Bitcoin address UTXO query
form.mt-3
.form-group
label(for='address') Bitcoin address
input.form-control#address(type='text', name='address')
input.btn.btn-primary(type='submit', value='Get UTXOs')
table.table.mt-5
thead: tr #[th txid:vout] #[th value] #[th block height] #[th block time]
@shesek
shesek / bitcoin-ATH.txt
Last active December 15, 2017 13:33
Bitcoin ATH
$ curl 'https://bitcoincharts.com/charts/chart.json?m=bitstampUSD&r=360&c=1&s=2017-01-01&e=2017-12-16' | jq -c '.[] | [(.[0]|strftime("%Y-%m-%d")),.[7]]' | tr -d '"[]' | awk -F, 'BEGIN{ath=0;total=0;aths=0;in20p=0}{total++;if ($2>ath*0.8) in20p++; if ($2>ath){print $1 " " $2; ath=$2; aths++ } } END { print "\nTotal "total" days\nATH in "aths" days (" (aths/total*100) "%)\n20% range from ATH in "in20p" days ("(in20p/total*100)"%)" }'
2017-01-01 987.468055790686
2017-01-02 1013.002448970431
2017-01-03 1020.555479651876
2017-01-04 1088.449474525684
2017-02-21 1104.602728943062
2017-02-22 1126.242226009392
2017-02-23 1153.559162275172
2017-02-24 1174.774405556085
@shesek
shesek / reproducible-archiver.js
Created August 28, 2017 03:00
Reproducible zip builds for Archiver
var Zip = require('archiver/lib/plugins/zip')
, date = new Date(0)
, mode = 0755
// Set static timestamp/mode and append to queue instead of actually appending to zip
Zip.prototype.append = function(source, data, cb) {
(this._queue || (this._queue=[])).push([ source, Object.assign(data, { date, mode }) ]);
cb();
}
@shesek
shesek / bower-lock-versions.sh
Last active September 16, 2017 23:12
Lock-down bower.json to the currently installed package versions (semi shrinkwrap)
cp bower.json bower.json.old
cat bower.json.old | \
jq "$(cat bower_components/*/.bower.json | \
jq -r '".dependencies[\"" + .name + "\"]=\"" + (._source+"#"+._resolution.commit) + "\"|.resolutions[\"" + .name + "\"]=\"" + ._resolution.commit + "\""' |paste -d'|' -s -)" \
> bower.json
@shesek
shesek / exif.txt
Last active May 6, 2016 22:02
EXIF metadata for images posted on drcraigwright.net. More info and reproduction: https://www.reddit.com/r/Bitcoin/comments/4i76ut/exif_metadata_for_images_posted_on_craig_wrights/
======== 08fb5101c50f322723b6c5a64b1eba6c35f7d729.png
ExifTool Version Number : 10.10
File Name : 08fb5101c50f322723b6c5a64b1eba6c35f7d729.png
Directory : .
File Size : 12 kB
File Modification Date/Time : 2016:05:06 20:21:20+03:00
File Access Date/Time : 2016:05:06 23:36:21+03:00
File Inode Change Date/Time : 2016:05:06 23:34:19+03:00
File Permissions : rw-rw-r--
File Type : PNG
@shesek
shesek / keybase.md
Created May 27, 2015 20:55
Keybase proof

Keybase proof

I hereby claim:

  • I am shesek on github.
  • I am nadav (https://keybase.io/nadav) on keybase.
  • I have a public key whose fingerprint is 948A C570 261E 66CA 7291 0A0A 4B33 3941 E3B4 3EDD

To claim this, I am signing this object: