2018-03-14 14:36:23 +01:00
|
|
|
# Programming languages
|
|
|
|
|
|
|
|
## Go
|
|
|
|
export GOROOT="$HOME/opt/go"
|
|
|
|
export GOPATH="$HOME/opt/gopath"
|
|
|
|
PATH="$PATH:$GOPATH/bin:$GOROOT/bin"
|
|
|
|
|
|
|
|
## Node
|
|
|
|
PATH="$PATH:/home/simon/opt/node/bin"
|
|
|
|
|
|
|
|
## Python (pip)
|
|
|
|
PATH="$PATH:/home/simon/.local/bin"
|
|
|
|
|
|
|
|
## Dart
|
|
|
|
|
|
|
|
PATH="$PATH:/home/simon/opt/dart-sdk/bin"
|
|
|
|
|
|
|
|
## Lua
|
|
|
|
|
|
|
|
PATH="$PATH:$HOME/.luarocks/bin/"
|
|
|
|
|
|
|
|
# Misc
|
|
|
|
|
|
|
|
## Local binaries
|
|
|
|
|
|
|
|
PATH="$PATH:$HOME/bin"
|
|
|
|
|
|
|
|
# Ergonomic
|
|
|
|
|
|
|
|
## Battery percentage
|
|
|
|
alias batt="upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep percentage|awk '{print $2}'"
|
|
|
|
|
2018-03-14 14:53:15 +01:00
|
|
|
## Battery status (overwrites upstream function!)
|
|
|
|
|
|
|
|
function batterylinux () {
|
|
|
|
GRML_BATTERY_LEVEL=''
|
|
|
|
local batteries bat capacity
|
|
|
|
batteries=( /sys/class/power_supply/BAT*(N) )
|
|
|
|
if (( $#batteries > 0 )) ; then
|
|
|
|
for bat in $batteries ; do
|
|
|
|
if [[ -e $bat/capacity ]]; then
|
|
|
|
capacity=$(< $bat/capacity)
|
|
|
|
else
|
|
|
|
typeset -F energy_full=$(< $bat/energy_full)
|
|
|
|
typeset -F energy_now=$(< $bat/energy_now)
|
|
|
|
typeset -i capacity=$(( 100 * $energy_now / $energy_full))
|
|
|
|
fi
|
|
|
|
case $(< $bat/status) in
|
|
|
|
Charging)
|
2018-03-14 15:25:18 +01:00
|
|
|
GRML_BATTERY_LEVEL+="%F{blue}^%f"
|
2018-03-14 14:53:15 +01:00
|
|
|
;;
|
|
|
|
Discharging)
|
|
|
|
if (( capacity < 20 )) ; then
|
2018-03-14 15:25:18 +01:00
|
|
|
GRML_BATTERY_LEVEL+="%F{red}!v%f"
|
2018-03-14 14:53:15 +01:00
|
|
|
else
|
2018-03-14 15:25:18 +01:00
|
|
|
GRML_BATTERY_LEVEL+="%F{yellow}v%f"
|
2018-03-14 14:53:15 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) # Full, Unknown
|
2018-03-14 15:25:18 +01:00
|
|
|
GRML_BATTERY_LEVEL+="%F{green}=%f"
|
2018-03-14 14:53:15 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
GRML_BATTERY_LEVEL+="${capacity}%%"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-14 14:36:23 +01:00
|
|
|
## Upload to transfer.sh
|
|
|
|
transfer() {
|
|
|
|
if [ $# -eq 0 ];then
|
|
|
|
echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
tmpfile=$(mktemp -t transferXXX)
|
|
|
|
if tty -s;then
|
|
|
|
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
|
|
|
|
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
|
|
|
|
else
|
|
|
|
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile
|
|
|
|
fi
|
|
|
|
cat $tmpfile
|
|
|
|
rm -f $tmpfile
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
## Touchpad enabling/disabling
|
|
|
|
function touchpad() {
|
|
|
|
touchpad="SynPS/2 Synaptics TouchPad"
|
|
|
|
if [[ $1 == "disable" ]];then
|
|
|
|
xinput disable "$touchpad"
|
|
|
|
else
|
|
|
|
xinput enable "$touchpad"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Fancy stuff
|
|
|
|
|
|
|
|
## dircolors
|
|
|
|
eval "$(dircolors -b $HOME/.dircolors)"
|
|
|
|
|
|
|
|
## Color switcher
|
|
|
|
alias dynamic-colors="~/.dynamic-colors/bin/dynamic-colors"
|
|
|
|
|
|
|
|
# Bugs
|
|
|
|
|
|
|
|
## silversearcher-ag and not apt-get
|
|
|
|
unalias ag
|
|
|
|
|
|
|
|
# Program aliases/env
|
|
|
|
|
|
|
|
## Aliases for programs
|
|
|
|
alias atom="/home/simon/opt/atom/atom"
|
|
|
|
alias tearstop="compton --backend=glx"
|
|
|
|
alias vobsub2srt="docker run -v $PWD:/data --rm -it vobsub2srt vobsub2srt"
|
|
|
|
alias apktool="java -jar ~/opt/apktool_2.3.1.jar"
|
|
|
|
alias mpvhdr="mpv --tone-mapping=hable"
|
|
|
|
|
|
|
|
## Environment variables
|
|
|
|
export HVSC_BASE="$HOME/Dokumente/sound/HVSC/"
|
|
|
|
export ESP_ROOT="$HOME/projekte/esp8266/esp-open-sdk"
|
|
|
|
export ANDROID_HOME="$HOME/projekte/android/sdk"
|