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

200 lines
4.6 KiB
Plaintext
Raw Normal View History

2018-03-14 14:36:23 +01:00
# Programming languages
## Go
2018-04-09 16:38:38 +02:00
export GOPATH="$HOME/go"
2018-03-29 23:00:45 +02:00
PATH="$PATH:$GOPATH/bin"
2018-03-14 14:36:23 +01:00
## Node
PATH="$PATH:/home/simon/opt/node/bin"
## Python (pip)
PATH="$PATH:/home/simon/.local/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 0x720 --rotate normal \
2018-03-21 20:31:01 +01:00
--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
;;
"officealt")
xrandr \
--output VGA-1 --off \
--output LVDS-1 --primary --mode 1280x800 --pos 0x1000 --rotate normal \
--output HDMI-3 --mode 1920x1200 --pos 1280x0 --rotate left \
--output HDMI-2 --off \
--output HDMI-1 --off \
--output DP-3 --off \
--output DP-2 --off \
--output DP-1 --off
;;
2018-03-21 20:31:01 +01:00
"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 2>/dev/null
2018-03-14 14:36:23 +01:00
# Program aliases/env
## Aliases for programs
alias tearstop="compton --backend=glx"
alias apktool="java -jar ~/opt/apktool_2.3.1.jar"
alias mpvhdr="mpv --tone-mapping=hable"
2018-04-09 16:38:38 +02:00
alias rls="/bin/ls --color=auto"
2018-04-30 19:53:42 +02:00
if which exa 2>&1 >> /dev/null;then
alias exa="exa --git"
alias ls="exa"
fi
alias presirandr="arandr; feh --bg-fill bg.jpg"
2018-05-15 21:29:04 +02:00
alias mc="~/bin/mc"
2018-03-14 14:36:23 +01:00
## 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
2018-03-28 22:59:19 +02:00
function drone-add-registry() {
(
2018-04-09 16:38:38 +02:00
drone secret add --name docker_username --value sbruder "$1"
drone secret add --name docker_password --value "$(pass show devops/docker|head -n 1)" "$1"
2018-03-28 22:59:19 +02:00
)
}
function drone-add-netlify() {
(
drone secret add --name netlify_key --value "$(pass show devops/netlify |grep Drone-Key|cut -d: -f2|tr -d ' ')" "$1"
)
}
2018-05-11 15:40:09 +02:00
function drone-add-s3() {
(
2018-05-15 21:29:04 +02:00
drone secret add --name aws_access_key_id --value "$(pass show management/minio/personal|grep User|cut -d: -f2|tr -d ' ')" "$1"
drone secret add --name aws_secret_access_key --value "$(pass show management/minio/personal|head -n 1)" "$1"
2018-05-11 15:40:09 +02:00
)
}
2018-03-28 22:59:19 +02:00
function drone() {
(
source ~/.drone-env
~/bin/drone $@
)
}