This repository has been archived on 2021-04-06. You can view files and clone it, but cannot push or open issues/pull-requests.
dotfiles/home/.zshrc.local

169 lines
3.8 KiB
Plaintext
Raw Normal View History

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
2018-03-21 20:31:01 +01:00
}
2018-03-14 14:36:23 +01:00
## 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"
2018-03-21 20:31:01 +01:00
## 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
}
2018-03-14 14:36:23 +01:00
# 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"
2018-03-28 01:24:21 +02:00
## 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
)
}