Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
libre.org

Ben Sigman bensig

🚀
libre.org
View GitHub Profile
@bensig
bensig / Multisig_eosio_wrap.md
Last active March 16, 2023 23:17
Getting eosio.wrap working
View Multisig_eosio_wrap.md

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
View gist:b2576854f9381e84f7e96ed75470b5ea

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
View oom-debug.sh
#!/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
@bensig
bensig / bitcoin_fast_sync_ideas.md
Created March 3, 2023 20:02
Fast Sync Bitcoin Node - 3 Options
View bitcoin_fast_sync_ideas.md

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

View multisig-edentogoveos
#/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
@bensig
bensig / jail.local
Created September 22, 2022 02:40
Fail2ban for haproxy
View jail.local
[INCLUDES]
before = paths-debian.conf
[DEFAULT]
ignoreip = 3.229.118.187/32
@bensig
bensig / nginx-botsearch-common.conf
Created August 6, 2022 08:10
improved nginx botsearch to include filter for .env files
View nginx-botsearch-common.conf
# Fail2Ban filter to match web requests for selected URLs that don't exist
#
[INCLUDES]
# Load regexes for filtering
before = botsearch-common.conf
[Definition]
@bensig
bensig / haproxy-env.conf
Last active September 22, 2022 02:41
Haproxy ban anyone looking for .env files
View haproxy-env.conf
# Fail2Ban filter configuration file to match failed login attempts to
# HAProxy HTTP Authentication protected servers.
#
# PLEASE NOTE - When a user first hits the HTTP Auth a 401 is returned by the server
# which prompts their browser to ask for login details.
# This initial 401 is logged by HAProxy.
# In other words, even successful logins will have at least 1 fail regex match.
# Please keep this in mind when setting findtime and maxretry for jails.
#
# Author: Jordan Moeser
@bensig
bensig / Confirm_System_Contract.md
Created February 4, 2022 08:47
Confirm changes to WASM
View Confirm_System_Contract.md

Instructions

You will need CDT 1.7 installed. These instructions are written for Linux if you want to run on a mac, it's much more difficult IMHO

Make a directory

mkdir ~/verify cd ~/verify

  1. Install cdt 1.7.0
wget https://github.com/EOSIO/eosio.cdt/releases/download/v1.7.0/eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb
@bensig
bensig / proton-mass-transfer-tool.sh
Created January 25, 2022 08:37
Mass send tokens on Proton Network
View proton-mass-transfer-tool.sh
#!/bin/bash
# You should already have cleos, keosd installed with a wallet created
# In that wallet you will need your private key
# Usage:
# 1. Create a recipients.csv in the same dir as this script
# ** FORMAT OF CSV SHOULD BE like this:
# benobi 0.00000001
# paul 0.00000001
# That will send one SAT to "benobi" and 1 sat to "paul"
# 2. Update the TOKENBANK - this is the account you will be sending FROM