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 / electrum-client.js
Created July 25, 2023 00:29
get amount of certain address in nodejs with bitcoinjs-lib
/*
Usage:
$ node electrum-client.js <servername>:<port> 3Eh99S957RnRrKmiU6DPAphwvjYB8UkeQb
Output:
address:3Eh99S957RnRrKmiU6DPAphwvjYB8UkeQb amount:0.0158 btc
*/
const net = require('net')
, bitcoin = require('bitcoinjs-lib');
@st3b1t
st3b1t / ramdisk.sh
Last active July 21, 2023 20:07
create ramdisk on a Linux distro
#!/bin/sh
#path of the ramdisk
PATH=/media/ram
#automount ad startup
AUTO=",auto"
#disk size
SIZE=2G
sudo mkdir -p /media/ram
sudo echo "tmpfs $PATH tmpfs size=$SIZE,rw$AUTO,user,noatime,x-gvfs-show 0 0" >> /etc/fstab
sudo mount -a
@st3b1t
st3b1t / random.html
Created July 4, 2023 14:38
Math.random() vs crypto.getRandomValues() Visual random generation values from different ways in Javascript
<html>
<head>
<title>Math.random() vs crypto.getRandomValues()</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
body { background: #333; text-align: center; }
canvas {
margin: 50px;
height: 400px;
width: 400px;
@st3b1t
st3b1t / two_lines_promnt.sh
Last active June 20, 2023 18:26
double line Satoshi promnt
#!/bin/bash
#┌── Kali Linyx Style #
#└─ Promnt Bash #
export PS1="\033[33m\]┌──(₿)\033[33m\]\033[33m\]\u\033[33m\]@\033[33m\]\h:\033[01;32m\]\w\033[33m\]\n\033[33m\]└─\\[\033[33m\]$\[\033[33m\] "
@st3b1t
st3b1t / git_authors.sh
Created June 16, 2023 20:43
git list all authors of commits in repository
#!/bin/bash
#
# show all authors of commits in a git repository
#
# usage:
# git clone <http_github_repo>
# git_authors.sh
#
git log --all | grep Auth | sort -u
@st3b1t
st3b1t / bitcoin_node_info.py
Last active June 15, 2023 20:14
Bitcoin node info without RPC access
#!/usr/bin/env python3
#
# don't require rpc auth.
#
# requirements:
# sudo apt-get install libssl-dev
# pip install python-bitcoinlib
# docs:
# https://github.com/petertodd/python-bitcoinlib
# usage:
@st3b1t
st3b1t / Dockerfile
Last active July 15, 2023 10:28
Tor Node Dockerfile
FROM debian:stable-slim
ARG PUB_CONTROLIP=0.0.0.0
ARG PUB_CONTROLPORT=9052
#ACCESSLOG /var/log/rinetd.log
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -y \
ca-certificates curl gnupg && \
printf 'deb http://deb.torproject.org/torproject.org stable main' >> /etc/apt/sources.list && \
curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | apt-key add - && \