Skip to content

Instantly share code, notes, and snippets.

View takinbo's full-sized avatar

Tim Akinbo takinbo

View GitHub Profile
@takinbo
takinbo / nginx-cloudflare-real-ip.sh
Created October 22, 2024 07:46
script for generating the snippet to include in the nginx configuration file for using the real ip address when logging access.
#!/usr/bin/env bash
for ip in $(curl -s https://www.cloudflare.com/ips-v4/); do
echo "set_real_ip_from $ip;";
done
for ip in $(curl -s https://www.cloudflare.com/ips-v6/); do
echo "set_real_ip_from $ip;";
done
echo "real_ip_header X-Forwarded-For;"
echo "real_ip_recursive on;"
@takinbo
takinbo / MTNGH-FBB.csv
Created July 25, 2022 09:11
The document is a list of all sizes and the computed rate (per GB) for all custom amounts of MTN Ghana Fibre Broadband bundles
Amount Bundle Size (GB) Price Per GB
25 4.91 5.09164969450102
26 5.1 5.09803921568628
27 5.3 5.09433962264151
28 5.5 5.09090909090909
29 5.69 5.09666080843585
30 6.16 4.87012987012987
31 6.09 5.09031198686371
32 6.28 5.09554140127389
33 6.48 5.09259259259259
@takinbo
takinbo / cl
Last active June 14, 2023 19:37
c-lightning cli script with custom functions
#!/bin/bash
declare -A NODEMAP
for node_id in $(lightning-cli listpeers | jq -r '.peers | .[].id'); do
node_alias=$(lightning-cli listnodes $node_id | jq -r '.nodes | .[] | .alias');
if [ ${#node_alias} != 0 ]; then
NODEMAP[$node_id]=$node_alias;
NODES+="{\"$node_id\":\"$node_alias\"}";
fi
@takinbo
takinbo / index.js
Created September 17, 2021 13:00
sample implementation of lnurl-pay and lightning address
const lnurl = require('lnurl')
const { v4: uuid4 } = require('uuid')
const express = require('express')
const { exec } = require('child_process')
const crypto = require('crypto')
const app = express()
const port = 7000
const users = ['godwin', 'bernard']
@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 -
@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 / 584802.hex
Created July 10, 2019 16:23
Invalid Block #584802
00004020f1f9b8c77a42e502101978707f5de1896176ac1f3b251b0000000000000000007f5a9b94bc04c945693178e32eeae20f5066d7cde08c72001bdd5842da314a7aadf7255d9b0d1f1700e4a56d01010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff550362ec081c4d696e656420627920416e74506f6f6c313132ee003300200f0c9c50fabe6d6dc0ba0d6922d0606afa6321ef35c91f070cb29a0425d4ffef18f70658908db8b6040000000000000033060000b43f0000ffffffff02037f114f000000001976a914edf10a7fac6b32e24daa5305c723f3de58db1bc888ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000
@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 / 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 / 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