Skip to content

Instantly share code, notes, and snippets.

View bensig's full-sized avatar
🚀
libre.org

Ben Sigman bensig

🚀
libre.org
View GitHub Profile
@bensig
bensig / ansible_hierarchy.md
Created April 6, 2024 05:40
ansible order of priority for configs

Override Order

host > stage > group > all > defaults

@bensig
bensig / bitcoin_rpctest.sh
Created April 6, 2024 05:27
Using curl to test bitcoin rpc authentication
rpcuser=$1
rpcpass=$2
url=$3 #should be http://localhost:8332 for mainnet or http://localhost:38332 for signet
curl --user $rpcuser:$rpcpass --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' $URL
@bensig
bensig / docker-isntall.sh
Created April 5, 2024 18:59
docker with docker compose v2 install for debian / ubuntu
# Install docker repo and setup docker on ubuntu / debian with `docker compose` plugin
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
@bensig
bensig / ssh_configs.md
Created November 6, 2023 20:10
How to setup .ssh env

This is how you can use a config.d directory in your ssh config so that you will have versatility, portability, and customization of your ssh env and commands to connect to servers using simple shortcuts from VS Code and Terminal. Manage multiple identities, keys, servers, everything.

example: ssh prototype or ssh user1@prototype

  1. Make sure you have a .ssh dir with permissions 755 for the dir
  2. Create an SSH key and give it permissions 600
  3. Make an ssh config file by typing nano ~/.ssh/config and put in the line Include config.d/* hit cntrl + x then y when you're done editing
  4. Create a config.d directory mkdir ~/.ssh/config.d
  5. In there, you can add in ssh config files for various projects - for exmaple, personal or work
  6. Let's create one for work cd ~/.ssh/config.d && nano work
@bensig
bensig / haproxy.cfg
Created November 15, 2019 00:17
haproxy config for P2P proxy using wireguard for EOS seed nodes
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 4096
@bensig
bensig / bitcoin_fast_sync_ideas.md
Created March 3, 2023 20:02
Fast Sync Bitcoin Node - 3 Options

Option 1 - Use This Bitcoin Fast Sync Command

There is no torrent which would be faster than just using the Bitcoin network "hive" - which is huge. There may be a way to sync using local or low-latency nodes nearby, but any time you specify which nodes you sync from - it introduces risk.

Very good to have a fast CPU and lots of RAM, SSD is not as important as RAM.

With this command I was able to download the entire blockchain and create all indices in almost exactly 24 hours:

bitcoind --datadir=<path-to-external-ssd> -blockfilterindex=1 -txindex=1 -coinstatsindex=1 -dbcache=16384 -daemon If you have 32GB of RAM, you can use 32768 for dbcache

@bensig
bensig / Multisig_eosio_wrap.md
Last active March 16, 2023 23:17
Getting eosio.wrap working

Steps to get eosio.wrap working:

Generated a JSON of all producers and their perms - alphabetized:

[
    {
        "actor": "amsterdam",
        "permission": "active"
    },
    {
@bensig
bensig / gist:b2576854f9381e84f7e96ed75470b5ea
Last active March 5, 2023 00:09
New 2023 Nginx to filter bad bots and scanners

There are 2 parts - a filter and a jail config:

nginx-access-erriez.conf

[Definition]
#^<HOST> .*"\\x.*"$
failregex = ^<HOST>.*"CONNECT leakix.*"$
#            ^<HOST>.*"HTTP.*"$
            ^<HOST>.*"MGLNDD.*"$
@bensig
bensig / oom-debug.sh
Created March 4, 2023 20:51
Unpack ubuntu oom killer output
#!/bin/bash
# may need to specify a diff path to syslog if you want older log files
cat /var/log/syslog | grep kernel | rev | cut -d"]" -f1 | rev | awk '{ print $3, $4, $5, $8 }' | grep '^[0-9].*[a-zA-Z]' | perl -MData::Dumper -p -e 'BEGIN { $db = {}; } ($total_vm, $rss, $pgtables_bytes, $name) = split; $db->{$name}->{total_vm} += $total_vm; $db->{$name}->{rss} += $rss; $db->{$name}->{pgtables_bytes} += $pgtables_bytes; $_=undef; END { map { printf("%.1fG %s\n", ($db->{$_}->{rss} * 4096)/(1024*1024*1024), $_) } sort { $db->{$a}->{rss} <=> $db->{$b}->{rss} } keys %{$db}; }' | tail -n 10 | tac
#/bin/sh
# Set the permission of the proposing account
ACCOUNTPERM="benobi.chat@active"
# Get user input
echo "You may need to set your account permission first - check the contents of this script"
echo ""
read -p "Enter the name of the proposal: " NAME
read -p "Enter the name of the account to pay: " PAYEE