Last active
November 22, 2021 09:11
-
-
Save nidble/a1d24fb4cdc0544efb298fa202f0ea69 to your computer and use it in GitHub Desktop.
Spared commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netstat -tulpn | |
netstat -polenta | |
#ask for www.foo.baz | |
dig +short www.foo.baz | |
#ask at 208.67.222.222 for foo.baz MX | |
dig @208.67.222.222 foo.baz MX | |
ps axfww | |
tcpdump -n -S -s 0 -A 'tcp dst port 80' and src 172.31.4.7 | |
# kill by port | |
PORT=3030 | |
kill $(lsof -t -ni:$PORT) | |
echo "${{secrets.DEPLOY_KEY}}" > deploy_key && | |
chmod 600 ./deploy_key && | |
rsync -chav --delete \ | |
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \ | |
--exclude /.git/ \ | |
--exclude /.github/ \ | |
--exclude /node_modules/ \ | |
./ ${{env.dest}} | |
# https://mysteries.wizardzines.com/ | |
strace -tt -T -f -p $(pgrep python) | |
sudo tcpdump -n -i any port 53 #(port 53, considering to add -A for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://medium.com/@GroundControl/better-git-diffs-with-fzf-89083739a9cb | |
# $@ all the parameters of git diff | |
# -1 the current file | |
fd() { | |
preview="git diff $@ --color=always -- {-1}" | |
git diff $@ --name-only | fzf -m --ansi --preview $preview | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES="${1:-./logs}" | |
# s~ | |
# \([^c_]*\) <- match and group all that not contain 'c_' | |
# c_a <- followed by 'c_' | |
# \([a-z0-9_]\+\.csv\)$ <- match and group all that match 1 or more char or digit or _ followed by '.csv' | |
# ~ | |
# \1\2 <- substiture with first match ie: ./logs/2019/1/ and second match ie: delete_3_2019.csv | |
# ~ | |
for file in $(find $FILES -type f -name "*csv"); do | |
newfile="$(echo $file | sed 's~\([^c_]*\)c_\([a-z0-9_]\+\.csv\)$~\1\2~')" | |
cp --verbose $file $newfile | |
rm $file | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# considering an foo.txt with this content | |
"./fixtures/good/CATALOG-1701.json", | |
"./fixtures/good/CATALOG-1711.json", | |
"./fixtures/good/CATALOG-1716.json", | |
"./fixtures/good/CATALOG-1721.json", | |
"./fixtures/good/CATALOG-1726.json", | |
"./fixtures/good/CATALOG-1731.json", | |
# text quote estraction example | |
cat foo.txt | sed 's/^[^"]*"\([^"]*\)",/\1/g' | |
# start from beginning to first double quote, then capture te rest exluding double quote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://jvns.ca/blog/2021/11/15/esbuild-vue/ | |
and saw which files it opened, like this: (you have to scroll right to see the filenames) | |
$ strace -e openat -f esbuild blah.js --bundle --outfile=/dev/null | |
openat(AT_FDCWD, "/home/bork/work/mess-with-dns/frontend/package.json", O_RDONLY|O_CLOEXEC) = 3 | |
openat(AT_FDCWD, "/home/bork/work/mess-with-dns/frontend/blah.js", O_RDONLY|O_CLOEXEC) = 3 | |
openat(AT_FDCWD, "/home/bork/work/mess-with-dns/frontend/node_modules/vue/package.json", O_RDONLY|O_CLOEXEC) = 3 | |
openat(AT_FDCWD, "/home/bork/work/mess-with-dns/frontend/node_modules/vue/dist/vue.runtime.esm.js", O_RDONLY|O_CLOEXEC) = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff <(sed -n 's/.*href="\([^"]*\).*/\1/pI' a.html | sed 's/\&/\&/g' | sort) <(sed -n 's/.*href="\([^"]*\).*/\1/pI' b.html | sed 's/\&/\&/g' | sort) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment