Skip to content

Instantly share code, notes, and snippets.

View sandipb's full-sized avatar

Sandip Bhattacharya sandipb

View GitHub Profile
@nerdalert
nerdalert / Netfilter-IPTables-Diagrams.md
Last active April 9, 2024 09:18
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@jace
jace / denoise.sh
Last active October 11, 2023 10:17
Remove noise from video using sox and ffmpeg
# 1. extract audio from all videos (assuming .mp4 videos).
for FILE in *.mp4; do ffmpeg -i $FILE ${FILE%%.mp4}.wav; done
# 2. use the first second of the first audio file as the noise sample.
sox `ls *.wav | head -1` -n trim 0 1 noiseprof noise.prof
# Replace with a specific noise sample file if the first second doesn't work for you:
# sox noise.wav -n noiseprof noise.prof
# 3. clean the audio with noise reduction and normalise filters.
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 19, 2024 12:30
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@vans163
vans163 / virtualbox.sh
Last active November 6, 2021 22:15
Virtualbox Commandline stuff
#Create storage
VBoxManage createhd --filename VMName.vdi --size 40000 --format VDI
VBoxManage modifyhd GoDial.vdi --resize 30500
VBoxManage list hdds
VBoxManage closemedium disk $(UUID) --delete
#Create VM
VBoxManage createvm --name "VMName" --ostype Windows7_64 --register
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active April 20, 2024 13:55
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@BretFisher
BretFisher / docker-for-mac.md
Last active April 26, 2024 09:38
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@reachlin
reachlin / prometheus.yml
Created April 19, 2017 07:06
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace
@cimmanon
cimmanon / psql.md
Created May 2, 2017 17:22
PostgreSQL cheat sheet for MySQL users

I use PostgreSQL via the psql client. If you use a different client (eg. pgAdmin, etc.), I don't know how much will translate over.

One nice difference between psql and mysql (cli) is that if you press CTRL+C, it won't exit the client.

User administration

Login as superuser (via shell)

psql -U postgres
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 1, 2024 17:42
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@angelo-v
angelo-v / jwt-decode.sh
Last active April 30, 2024 17:09
Decode a JWT via command line
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904
function jwt-decode() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
jwt-decode $JWT