2018-03-14 14:36:23 +01:00
|
|
|
# Programming languages
|
|
|
|
|
|
|
|
## Go
|
2018-04-09 16:38:38 +02:00
|
|
|
export GOPATH="$HOME/go"
|
2019-02-11 15:07:15 +01:00
|
|
|
export PATH="$PATH:$GOPATH/bin"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
|
|
|
## Node
|
2018-10-10 22:25:44 +02:00
|
|
|
export NVM_DIR=$(realpath "$HOME/.nvm")
|
2018-10-10 22:11:34 +02:00
|
|
|
source "$NVM_DIR/nvm.sh"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
|
|
|
## Python (pip)
|
2019-02-11 15:07:15 +01:00
|
|
|
export PATH="/home/simon/.local/bin:$PATH"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
|
|
|
## Lua
|
|
|
|
|
2019-02-11 15:07:15 +01:00
|
|
|
export PATH="$PATH:$HOME/.luarocks/bin/"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
|
|
|
# Misc
|
|
|
|
|
|
|
|
## Local binaries
|
|
|
|
|
2019-02-11 15:07:15 +01:00
|
|
|
export PATH="$HOME/bin:$PATH"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
|
|
|
# Ergonomic
|
|
|
|
|
|
|
|
## Battery percentage
|
|
|
|
alias batt="upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep percentage|awk '{print $2}'"
|
|
|
|
|
|
|
|
## 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
|
2018-10-10 17:37:04 +02:00
|
|
|
xinput --set-prop "$touchpad" "libinput Send Events Mode Enabled" 1 1
|
|
|
|
notify-send "Touchpad" "Disabled"
|
2018-05-20 16:45:25 +02:00
|
|
|
|
2018-03-14 14:36:23 +01:00
|
|
|
else
|
2018-10-10 17:37:04 +02:00
|
|
|
xinput --set-prop "$touchpad" "libinput Send Events Mode Enabled" 0 0
|
|
|
|
notify-send "Touchpad" "Enabled"
|
2018-03-14 14:36:23 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-10-28 13:16:17 +01:00
|
|
|
## Terminal font
|
|
|
|
|
|
|
|
function tfont() {
|
|
|
|
(
|
|
|
|
[ -z "$1" ] && font="Terminess Powerline" || font="$1"
|
|
|
|
[ -z "$2" ] && fontsize=18 || fontsize="$2"
|
2018-10-29 13:58:36 +01:00
|
|
|
echo -en "\033]710;xft:$font:pixelsize=$fontsize\007"
|
2018-10-28 13:16:17 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-02-08 14:22:15 +01:00
|
|
|
## resync pulseaudio bluetooth connection
|
|
|
|
function btsync() {
|
|
|
|
(
|
|
|
|
card=$(pactl list cards short|grep -E -o 'bluez_card.*[[:space:]]')
|
|
|
|
pacmd set-card-profile $card off
|
|
|
|
pacmd set-card-profile $card a2dp_sink
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-03-14 14:36:23 +01:00
|
|
|
# Fancy stuff
|
|
|
|
|
|
|
|
## dircolors
|
|
|
|
eval "$(dircolors -b $HOME/.dircolors)"
|
|
|
|
|
2018-10-28 13:34:37 +01:00
|
|
|
## fzf
|
|
|
|
|
2018-12-10 23:10:06 +01:00
|
|
|
[ -e /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
|
2018-10-28 13:34:37 +01:00
|
|
|
|
2018-03-14 14:36:23 +01:00
|
|
|
## Color switcher
|
|
|
|
alias dynamic-colors="~/.dynamic-colors/bin/dynamic-colors"
|
|
|
|
|
2018-06-04 20:32:36 +02:00
|
|
|
## Timer
|
|
|
|
function timer() {
|
|
|
|
(
|
|
|
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
|
|
|
echo "USAGE: $0 [u|f] TIME/DURATION" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" != "u" ] && [ "$1" != "f" ]; then
|
|
|
|
echo "Invalid mode “$1” supplied. Valid modes are: u|f" >&2
|
|
|
|
return 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ "$1" = "u" ] && mode="until"
|
|
|
|
[ "$1" = "f" ] && mode="for"
|
|
|
|
|
|
|
|
gosleep --${mode} "$2"
|
|
|
|
|
|
|
|
if [ "$?" = 0 ]; then
|
|
|
|
echo "Press CTRL-C to stop the alarm…" >&2
|
|
|
|
echo -en "\a" # highlight window
|
2018-12-20 23:15:19 +01:00
|
|
|
paplay ~/Dokumente/sound/ringtones/Bergentrückung.wav
|
2018-06-04 20:32:36 +02:00
|
|
|
else
|
|
|
|
echo "The sleep command failed. Please check the options." >&2
|
|
|
|
return 3
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-02-09 21:21:30 +01:00
|
|
|
## Wallpaper switcher
|
|
|
|
function wp() {
|
|
|
|
(
|
|
|
|
if [ -z "$1" ] || ([ "$1" = "rand" ] && [ -z "$2" ]); then
|
2019-02-11 23:05:10 +01:00
|
|
|
echo "USAGE: $0 rand|restore|default [path]"
|
2019-02-09 21:21:30 +01:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if [ "$1" = "default" ];then
|
|
|
|
feh --bg-fill /usr/share/wallpapers/wallpaper.jpg
|
|
|
|
fi
|
|
|
|
if [ "$1" = "rand" ]; then
|
|
|
|
base="$HOME/Bilder/wallpaper"
|
|
|
|
rand=$(shuf -n1 -e $base/$2/*)
|
|
|
|
[ -z "$rand" ] || feh --bg-fill "$rand"
|
|
|
|
fi
|
2019-02-11 23:05:10 +01:00
|
|
|
if [ "$1" = "restore" ]; then
|
|
|
|
~/.fehbg
|
|
|
|
fi
|
2019-02-09 21:21:30 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-03-14 14:36:23 +01:00
|
|
|
# Program aliases/env
|
|
|
|
|
|
|
|
## Aliases for programs
|
2018-04-30 19:53:42 +02:00
|
|
|
if which exa 2>&1 >> /dev/null;then
|
|
|
|
alias exa="exa --git"
|
|
|
|
alias ls="exa"
|
|
|
|
fi
|
2018-06-21 13:54:22 +02:00
|
|
|
alias ipy="ipython3"
|
2018-07-22 00:53:09 +02:00
|
|
|
alias mc="$GOPATH/bin/mc"
|
|
|
|
alias mpvhdr="mpv --tone-mapping=hable"
|
|
|
|
alias rls="/bin/ls --color=auto"
|
2018-07-31 15:25:19 +02:00
|
|
|
alias shiori="docker exec shiori_shiori_1 shiori"
|
2018-07-22 00:53:09 +02:00
|
|
|
alias tearstop="compton --backend=glx"
|
2018-03-14 14:36:23 +01:00
|
|
|
|
2018-05-24 14:35:32 +02:00
|
|
|
function jitsi-meet() {
|
|
|
|
chromium --app="https://meet.jit.si/$1"
|
|
|
|
}
|
|
|
|
|
2019-03-21 23:13:55 +01:00
|
|
|
alias line="chromium --user-data-dir=$HOME/.line --app=chrome-extension://ophjlpahpchlmihnnnihgmmeilfjmjjc/index.html"
|
|
|
|
|
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-05-17 19:01:42 +02:00
|
|
|
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on' # force antialiasing in java
|
2018-03-28 01:24:21 +02:00
|
|
|
|
|
|
|
## include docker functions
|
|
|
|
source ~/.zshrc.docker
|
|
|
|
|
2018-03-28 17:25:59 +02:00
|
|
|
## drone ci
|
2018-05-18 21:42:42 +02:00
|
|
|
function drone-add-hub() {
|
2018-03-28 17:25:59 +02:00
|
|
|
(
|
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
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-05-18 21:42:42 +02:00
|
|
|
function drone-add-registry() {
|
|
|
|
(
|
|
|
|
drone secret add --name docker_username --value sbruder "$1"
|
|
|
|
drone secret add --name docker_password --value "$(pass show accounts/sbruderldap|head -n 1)" "$1"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-04-30 19:38:37 +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
|
2018-08-29 20:12:18 +02:00
|
|
|
$GOPATH/bin/drone $@
|
2018-03-28 17:25:59 +02:00
|
|
|
)
|
|
|
|
}
|
2018-05-18 21:42:42 +02:00
|
|
|
|
|
|
|
function docker-ls() {
|
|
|
|
(
|
|
|
|
DOCKER_LS_PASSWORD=$(pass show accounts/sbruderldap|head -n 1) ~/go/bin/docker-ls $@
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function docker-rm() {
|
|
|
|
(
|
|
|
|
DOCKER_LS_PASSWORD=$(pass show accounts/sbruderldap|head -n 1) ~/go/bin/docker-rm $@
|
|
|
|
)
|
|
|
|
}
|