Skip to content

Instantly share code, notes, and snippets.

@SwitHak
SwitHak / 20220401-TLP-WHITE_Spring4Shell.md
Last active September 2, 2024 22:32
BlueTeam CheatSheet * Spring4Shell* | Last updated: 2022-04-16 1722 UTC
@coderofsalvation
coderofsalvation / eco-friendly-tiny-server-patterns.md
Last active September 2, 2024 13:33
My favorite (awesome) eco-friendly server patterns

tiny servers: the serverpark killers

auto-suspend-wakeup webservices

stop wasting cpu/mem-resources on idling services:

#!/bin/sh
while sleep 1s; do
 set +e
git fetch --all
# 7 天内有多少 commit 改动了 package-lock
git log --format=format:'%h' --no-merges --since="7 days ago" --all -- package-lock.json | wc -l
# 7 天内所有 commit 共产生了多少完全无重复的 package-lock
git log --format=format:'%h' --no-merges --since="7 days ago" --all -- package-lock.json | \
xargs -I{} git ls-tree {} package-lock.json | \
sort | uniq | wc -l
git log --name-status --diff-filter=D <file / dir>
@coderofsalvation
coderofsalvation / useful-lua-patterns.md
Last active September 2, 2024 13:34
My favorite lua patterns

Useful Lua Patterns/Functions

NOTE: for JS patterns see my JS patterns-page

Simple javascript-like template function

-- print( tpl("${name} is ${value}", {name = "foo", value = "bar"}) )
-- "foo is bar"
function tpl(s,tab)
@CharlesGodwin
CharlesGodwin / cloudflare.md
Last active October 29, 2025 16:56
I Don't Need Port Forwarding and Don't Care About CGNAT

I Don't Need Port Forwarding and Don't Care About CGNAT

This was rewritten 2022-11-30

This article is for users that want all these features:

  • To connect to home network from anywhere
  • Can connect without any port forwarding; either by choice or internet provider can't or won't provide access
  • No setup or configuration or installation on client machine
  • No enrolment / registration required
@ssstonebraker
ssstonebraker / tcpdump_tcpreplay.org
Created November 2, 2021 18:33 — forked from niranjan-nagaraju/tcpdump_tcpreplay.org
TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

tcprewrite

Rewrite IP/Mac addresses, -C optionally to fix checksums

  1. tcpprep, first:C2S, Second S2C, Generate cache file
        
@cuteribs
cuteribs / Advanced Format 4Kn.md
Created October 29, 2021 10:33
Advanced Format 4Kn
@rojenzaman
rojenzaman / get_port.sh
Last active September 3, 2024 12:13
Get an unused port.
#!/bin/bash
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range
while :
do
PORT="`shuf -i $LOWERPORT-$UPPERPORT -n 1`"
ss -lpn | grep -q ":$PORT " || break
done
echo $PORT