Files
workshops/slides/joyous_bash/joyous_bash.md
2025-08-26 23:03:07 +02:00

2.5 KiB

Shut Up!

echo blacklist pcspkr >  /etc/modprobe.d/nobeep.conf

Standard Visuals

  • cbonsai
  • asciiquarium
  • top
    • ZH4W

Another Monday!

  • cal --reform julian

Weather

curl wttr.in
curl -s wttr.in/Београд
curl wttr.in/Moon

ls

ls -X


vim

  • blog!
  • seriously, just write

watch

Watch Differences

  • watch -d stat "$file"
  • watch -d ip a

With Makefiles

watch --chgexit ping -c 1 dmz.rs && sleep 3 && unison -batch pir

Check Progress

watch 'ls **/*.pdf | column'

Watch Shell Scripts

watch -e ./script.sh

Slow Down

function slow(){
	ff=/tmp/bashpipe_$(date +%s)
	mkfifo $ff 2>/dev/null
	( cat $ff | perl -We 'use Time::HiRes;$|++;while(read(STDIN,$c,1)){Time::HiRes::usleep(15000);print $c;}' )& exec &> $ff
}

Safety?

  • no

htop?

  • no

speedtest?

  • YES

---

# Notes

```sh
alias no='$EDITOR .no.md'
function n(){
	[ -z "$1" ] && cat .no.md || echo $@ >> .no.md
}


URL Decoding

urldecode(){ : "${*//+/ }"; echo -e "${_//%/\\x}"; }

Send Text

function sendtext(){
	[ -f "$1" ] && \
	cat "$1" | nc termbin.com 9999 || \
	echo "$($1)" | nc termbin.com 9999
}

Readline

Put this in .inputrc.

set editing-mode vi
set keymap vi

More Readline vi

set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string "  "
set vi-cmd-mode-string " "
set keymap vi

More Readline


set match-hidden-files off
set show-all-if-ambiguous on
set show-all-if-unmodified on
set colored-stats on

"\C- ": shell-expand-line
"\C-x": glob-expand-word
Control-g: "g\n"
Control-y: "| ccze\n"
Control-o: "\C-u lfcd\n\C-u"
Control-l: "\C-u clear -x && ls\n"

Synchronization

Syncthing

  • 'Just works'

Unison

  • Fuck haskell
  • But actually it's good

column

column -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd

column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd | jq -r .table.[].user

Aliases

b

b () 
{ 
    eval "cd $(for d in $(seq 1 $1);
do
    printf ../;
done)"
}


eval

  • Don't

Clear Downloads

rm -rf ~/Downloads/*
echo "tmpfs $HOME/Downloads tmpfs defaults,size=1G 0 0" | sudo tee -a /etc/fstab
sudo systemctl daemon-reload # Only for systemd
sudo mount -a
mount | tail -1

The Best: yes

  • yes
  • yes no