Skip to content

Instantly share code, notes, and snippets.

View st3b1t's full-sized avatar
🔗
on chain

st3b1t

🔗
on chain
View GitHub Profile
@st3b1t
st3b1t / proofofwork.js
Last active June 8, 2024 20:31
Proof Of Work in NodeJs
/*
Proof Of Work in NodeJs by st3b1t, part of: https://github.com/st3b1t/bitcoin-nodejs-playground
usage:
$ node index.js <DIFFICULTY>
*/
const crypto = require('crypto');
const difficulty = Number(process.argv[2] ?? 4);
const blockHeader = 'Bl0ckH34d3r:';
const prefix = '0';
@st3b1t
st3b1t / libp2p_websocket.js
Last active June 16, 2024 12:00
websocket p2p network in nodejs
/*
PART OF: https://github.com/st3b1t/libp2p-nodejs-playground
setup:
$ npm install libp2p @chainsafe/libp2p-noise @chainsafe/libp2p-yamux @libp2p/bootstrap @libp2p/mdns @libp2p/websockets
run:
$ node libp2p_websocket.js <PORT>
open in more terminal with different port
@st3b1t
st3b1t / bitcoin-avg-blocktime.sh
Created May 16, 2024 22:16
Calculate the avg time of last NBLOCKS bitcoin block in your full node
#!/bin/bash
# copyright 2024 st3b1t
# Calculate the avg time of last NBLOCKS
NBLOCKS=10
#pick last NBLOCKS blocks
PREV_TIMESTAMP=0
DIFF_SUM=0
COUNT=0
@st3b1t
st3b1t / electrs-client.py
Last active May 21, 2024 23:39
client electrs RPC for commandline
#!/usr/bin/env python3
import sys
import os
import importlib.util
import argparse
import json
##
# usage examples:
# ./electrs-client.py server.version
# ./electrs-client.py mempool.get_fee_histogram
@st3b1t
st3b1t / satlog-rpc.sh
Created February 23, 2024 21:27
testing rpc methods of your rpc Bitcoin full node
#!/bin/sh
#
# included in: https://github.com/st3b1t/SatoshiLog
#
# usage: echo server.banner | satlog-rpc 127.0.0.1 50001
#
read METHOD
HOST=$1
@st3b1t
st3b1t / qrcode.py
Last active February 21, 2024 17:17
commandline qrcode generator
#!/usr/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'qrcode==7.3.1','console_scripts','qr'
#
# requirements: pip install qrcode
import re
import sys
__requires__ = 'qrcode==7.3.1'
try:
@st3b1t
st3b1t / mnemonic.sh
Created November 23, 2023 22:47
generate secure random mnemonic 24 words in bash
#!/bin/bash
# Copyright @st3b1t 2023
#
# generate secure random mnemonic 24 words in bash
#
bip39=(abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon b
@st3b1t
st3b1t / tunnel-bitcoin-node.sh
Created November 9, 2023 21:27
script to create a ssh tunnel to your bitcoin node
#!/bin/sh
#
# script to create a ssh tunnel to your bitcoin node
# and expose in localhost temporary port of bitcoin core
#
#user to access bitcoin node
USERNODE=user-ssh-node
#ip or hostname of bitcoin node
HOSTNODE=bitcoind-host
#ssh port(usually 22)
@st3b1t
st3b1t / podcast-widget.html
Created October 9, 2023 12:31
podcast rss feed widget
<html>
<head></head>
<body>
<h1>Podcast RSS Box</h1>
<div id="feed" style="max-width: 50%;border:1px solid blue;padding:10px">
</div>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
@st3b1t
st3b1t / ad-blacklist.txt
Created October 5, 2023 14:12
AD BlackLists
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://v.firebog.net/hosts/Easyprivacy.txt
https://winhelp2002.mvps.org/hosts.txt