Skip to content

Instantly share code, notes, and snippets.

View shakibamoshiri's full-sized avatar

Shakiba Moshiri shakibamoshiri

View GitHub Profile
@TechNickAI
TechNickAI / limit_bandwidth.bash
Created May 31, 2023 18:51
Limit Bandwidth by port
#!/bin/bash
# A script to limit the outgoing bandwidth of the consensus and execution layers by port
# We do this because the highest cost for running a node in AWS is the outgoing bandwidth
# Define your ports and their corresponding rate limits
declare -A ports=([30303]="500kbit" [9000]="1mbit")
# Define arbitrary class IDs for each port
declare -A class_ids=([30303]=1 [9000]=2)
@leandronsp
leandronsp / 001-server.bash
Last active May 21, 2025 10:02
A complete yet simple Web server (with login & logout system) written in Shell Script
#!/bin/bash
## Create the response FIFO
rm -f response
mkfifo response
function handle_GET_home() {
RESPONSE=$(cat home.html | \
sed "s/{{$COOKIE_NAME}}/$COOKIE_VALUE/")
}
@andytryn
andytryn / static_ip.txt
Created November 7, 2021 03:50
Manjaro set static IP Address
# install netctl
sudo pacman -S netctl --noconfirm
# check network card name
ip link
### Config Static IP Address ###
# Card Name : eth0
sudo cp /etc/netctl/examples/ethernet-static /etc/netctl/eth0
@superboum
superboum / benchmark-base.md
Last active September 24, 2025 12:41
Benchmark your disk with FIO

Install FIO on Ubuntu/Debian:

sudo apt update
sudo apt install -y fio lshw

Install FIO on Fedora:

@meee1
meee1 / Layer 2 VPN’s using SSH
Created December 31, 2020 10:10
Layer 2 VPN’s using SSH
Layer 2 VPN’s using SSH from https://la11111.wordpress.com/2012/09/24/layer-2-vpns-using-ssh/
September 24, 2012
Basics:
OpenSSH running on Linux provides the ability to create a VPN tunnel on-the-fly, which can be useful as a quick hack – it’s simple, stable, not the most efficient thing in the world – (tunneling TCP over TCP is generally considered to be a bad idea) – but way easier than trying to set up something like OpenVPN. For preliminary testing, anyway, you can’t beat it.
How it works:
When the tunnel is established, SSH creates a TAP (virtual ethernet tunnel) device on each computer. This link behaves more like a virtual wire than a NIC. As such, you can’t use it directly – you have to create a virtual bridge and add this TAP device to it, treating the bridge as the NIC.
@PhilipSchmid
PhilipSchmid / minio-upload.sh
Created November 19, 2020 13:38
Upload data to Minio using CURL
#!/bin/bash
# Usage: ./minio-upload my-bucket my-file.zip
bucket=$1
file=$2
host=minio.example.com
s3_key=svc_example_user
s3_secret=svc_example_user_password
$ pkg update
$ pkg install nmap
@qdm12
qdm12 / README.md
Last active August 14, 2025 07:28
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@blurayne
blurayne / ui-widget-select.sh
Last active May 21, 2025 20:15
Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#!/bin/bash
##
# Pure BASH interactive CLI/TUI menu (single and multi-select/checkboxes)
#
# Author: Markus Geiger <[email protected]>
# Last revised 2019-09-11
#
# ATTENTION! TO BE REFACTORED! FIRST DRAFT!
#
@fnky
fnky / ANSI.md
Last active October 20, 2025 09:25
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27