A few new bashrc aliases and functions
x1phosura x1phosura@x1phosura.zone
Fri, 12 Apr 2024 00:33:52 -0700
1 files changed,
20 insertions(+),
0 deletions(-)
jump to
M
.bashrc
→
.bashrc
@@ -235,6 +235,7 @@
# public-ip: fetch current public IP address public-ip() { curl 'http://icanhazip.com/' + #curl 'https://j3s.sh/ip.html' } # scan-for-printers: look for printers on the connected LAN@@ -291,6 +292,23 @@ echo "$file_path not found."
fi } +# Note: has a limit of like 10k or something, I forget +hex2bin() { + if [ "$#" = 0 ]; then + echo "usage: $0 [path of file containing hex digits to bindump]" + return 1 + fi + sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' "$1" | xargs printf +} + +bin2hex() { + if [ "$#" = 0 ]; then + echo "usage: $0 [path of file to hexdump]" + return 1 + fi + hexdump -v -e '1/1 "%02x"' "$1" +} + ############################## aliases ############################## # Note to self: alias substitution is recursive AS LONG AS each expanded alias@@ -315,6 +333,8 @@ alias now='date +%s '
alias gdb='gdb -q ' # muzzle gdb alias local_webserver='python -m http.server 8001 ' # can change port number alias hx='/usr/lib/helix/hx ' +# may be battery_BAT0 +alias bat-stat='upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep --color=never -E "state|to full|percentage"' # config editing aliases alias bashrc="$EDITOR ~/.bashrc"