# 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}'" ## 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) GRML_BATTERY_LEVEL+="%F{blue}^%f" ;; Discharging) if (( capacity < 20 )) ; then GRML_BATTERY_LEVEL+="%F{red}!v%f" else GRML_BATTERY_LEVEL+="%F{yellow}v%f" fi ;; *) # Full, Unknown GRML_BATTERY_LEVEL+="%F{green}=%f" ;; esac GRML_BATTERY_LEVEL+="${capacity}%%" done fi } ## 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" ## Screen settings function ränder() { case "$1" in "office") xrandr \ --output VGA-1 --off \ --output LVDS-1 --primary --mode 1280x800 --pos 0x721 --rotate normal \ --output HDMI-3 --mode 1920x1200 --pos 1280x0 --rotate normal \ --output HDMI-2 --off \ --output HDMI-1 --off \ --output DP-3 --off \ --output DP-2 --off \ --output DP-1 --off ;; "solo") xrandr \ --output VGA-1 --off \ --output LVDS-1 --primary --mode 1280x800 --rotate normal \ --output HDMI-3 --off \ --output HDMI-2 --off \ --output HDMI-1 --off \ --output DP-3 --off \ --output DP-2 --off \ --output DP-1 --off ;; "auto") xrandr --auto ;; *) echo "Invalid Preset" ;; esac feh --bg-fill ~/bg.jpg } # 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" ## include docker functions source ~/.zshrc.docker ## drone ci function drone-add-ci() { ( source ~/.drone-env drone registry add --repository $1 --hostname r.sbruder.de --username simon --password $DRONE_CI_PASSWORD ) }