3 ms·
This one executes commands like "$ echo hi" as "echo hi". I have this in my .zshrc, because sometimes copying from annoying code blocks has a "$" in front of it
by SushiHippie 3y ago
This one executes commands like "$ echo hi" as "echo hi".
I have this in my .zshrc, because sometimes copying from annoying code blocks has a "$" in front of it.
\$(){
$@
}
Check what file type a command is.
And if the file is a symbolic link, show what type the linked file is.
fich() {
f=$(which $1)
file $f;
if [[ -L $f ]]; then
file $(realpath $f);
fi
}
For example `fich 2to3` returns:
/usr/bin/2to3: symbolic link to 2to3-3.11
/usr/bin/2to3-3.11: Python script, ASCII text executable
Captures all SNI domains.
Stolen from: https://superuser.com/questions/538130/filter-in-wireshark-for-tlss-server-name-indication-field/1377945#1377945 https://superuser.com/questions/538130/filter-in-wireshark-f...
tshark -p -Tfields -e tls.handshake.extensions_server_name -Y 'tls.handshake.extension.type == "server_name"'
And these functions extract a tar/zip to a temporary directory and cd into it.
Useful to quickly peek into tar/zip files without littering your home/download directory. (/tmp gets cleared after a system restart for me)
cdtar() {
if [[ $# > 0 ]]; then
tmp_dir=$(mktemp -d)
if tar -xvf $1 -C $tmp_dir; then
cd $tmp_dir
else
rm -rf $tmp_dir
fi
fi
}
cdzip() {
if [[ $# > 0 ]]; then
tmp_dir=$(mktemp -d)
if unzip $1 -d ${tmp_dir}; then
cd $tmp_dir
else
rm -rf $tmp_dir
fi
fi
}