Skip to content

Instantly share code, notes, and snippets.

@Reinis
Reinis / bits.bash
Last active November 8, 2021 20:14
Print bit pattern of a number in Bash
# Pretty print binary pattern of a number
pb() {
pn 2 4 "${1}"
}
# Pretty print octal value of a number
po() {
pn 8 3 "${1}"
}
@Reinis
Reinis / pwl.bash
Created November 21, 2019 14:19
Bash script to toggle Powerline segment visibility for tmux
#!/usr/bin/bash
#
# Dependencies:
# jq — JSON processing
# morutils — updating file in place using sponge
#
# TODO: Check for existence of the config file
config_file="${HOME}/.config/powerline/themes/tmux/default.json"