Skip to content

Instantly share code, notes, and snippets.

View takinbo's full-sized avatar

Tim Akinbo takinbo

View GitHub Profile
@takinbo
takinbo / keypress_nav.js
Created February 25, 2012 19:28
Form Navigation
// Adds the ability to navigate text boxes while pressing either n or p
$('.bigbox2').keypress(function (e) {
switch (e.which) {
case 78:
case 110:
// N was pressed
el = $(this);
prefix = el.attr('name').replace(/-.*$/, "");
pos = $('input[name|="'+prefix+'"]').index(el);
if (pos < $('input[name|="'+prefix+'"]').length) {
@takinbo
takinbo / stream.js
Created February 20, 2017 17:53
stream trading events from Luno.com
var WebsocketClient = require('websocket').client,
colors = require('colors'),
sprintf = require('sprintf-js').sprintf;
var ws = new WebsocketClient();
var asks = bids = {};
var now = function () {
var date = new Date();
return sprintf("%02d:%02d:%02d", date.getHours(), date.getMinutes(), date.getSeconds());
@takinbo
takinbo / 70-hwrng.rules
Created May 31, 2018 21:12
udev rules for the ElectroDoodle TRNG-N1
# ElectroDoodle TRNG-N1 │ rgb_bitdist| 2| 100000| 100|0.25684952| PASSED
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", SYMLINK+="hwrng", RUN+="/usr/bin/stty -F /dev/%k 115200 raw", T│ rgb_bitdist| 3| 100000| 100|0.39832547| PASSED
AG+="uaccess"
@takinbo
takinbo / docker-compose.yml
Created March 23, 2019 15:08
docker-compose.yml file for NBXplorer
version: "3"
services:
nbxplorer:
restart: always
build:
context: https://github.com/dgarage/NBXplorer.git#v2.0.0.21
dockerfile: Dockerfile.linuxamd64
env_file: nbxplorer.env
network_mode: host
@takinbo
takinbo / nbxplorer.env
Created March 23, 2019 15:13
nbxplorer environment file
NBXPLORER_NETWORK=mainnet
NBXPLORER_BIND=127.0.0.1:24444
NBXPLORER_NOAUTH=1
NBXPLORER_CHAINS=btc
NBXPLORER_BTCRPCURL=http://127.0.0.1:8332/
NBXPLORER_BTCNODEENDPOINT=127.0.0.1:8333
NBXPLORER_BTCRPCAUTH=rpcuser:rpcpassword
@takinbo
takinbo / explorer.conf
Created July 9, 2019 09:28
sample nginx configuration for blockstream esplora
server {
listen 80;
server_name explorer.local;
location ~ ^/api(/?)(.*) {
proxy_pass http://127.0.0.1:4000/$2;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@takinbo
takinbo / 584802.hex
Created July 10, 2019 16:23
Invalid Block #584802
00004020f1f9b8c77a42e502101978707f5de1896176ac1f3b251b0000000000000000007f5a9b94bc04c945693178e32eeae20f5066d7cde08c72001bdd5842da314a7aadf7255d9b0d1f1700e4a56d01010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff550362ec081c4d696e656420627920416e74506f6f6c313132ee003300200f0c9c50fabe6d6dc0ba0d6922d0606afa6321ef35c91f070cb29a0425d4ffef18f70658908db8b6040000000000000033060000b43f0000ffffffff02037f114f000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000
@takinbo
takinbo / paginated_collection.js
Created July 25, 2011 21:57 — forked from io41/paginated_collection.js
Pagination with Backbone.js & django-tastypie
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by');
typeof(options) != 'undefined' || (options = {});
typeof(this.limit) != 'undefined' || (this.limit = 20);
typeof(this.offset) != 'undefined' || (this.offset = 0);
typeof(this.filter_options) != 'undefined' || (this.filter_options = {});
typeof(this.sort_field) != 'undefined' || (this.sort_field = '');
@takinbo
takinbo / ban_spy.sh
Last active September 17, 2019 07:12
ban bitcoin spy nodes
bitcoin-cli listbanned | jq -r '.[] | select(.ban_reason=="manually added") | .address' | xargs -P 10 -i -- bitcoin-cli setban {} remove \
&& curl -s https://people.xiph.org/\~greg/banlist.gui.txt | xargs -P 10 -L 1 bitcoin-cli
@takinbo
takinbo / hex2sha256.sh
Created January 30, 2020 09:57
calculate the sha256 hash of a hex string
echo -n $1 | xxd -r -p | sha256sum -