2015-03-13 09:08:23 +01:00
|
|
|
HISTFILE=~/.zsh_history
|
2020-04-02 09:41:06 +02:00
|
|
|
HISTSIZE=5000
|
|
|
|
SAVEHIST=5000
|
2015-03-12 07:33:04 +01:00
|
|
|
setopt append_history # append
|
|
|
|
setopt hist_ignore_all_dups # no duplicate
|
2016-10-31 08:08:48 +01:00
|
|
|
setopt hist_ignore_space # ignore space prefixed commands
|
2015-03-12 07:33:04 +01:00
|
|
|
setopt hist_reduce_blanks # trim blanks
|
|
|
|
setopt inc_append_history # add commands as they are typed, don't wait until shell exit
|
|
|
|
setopt share_history # share hist between sessions
|
2015-06-01 20:18:19 +02:00
|
|
|
setopt ignoreeof # don't exit the shell on ^D (EOF)
|
2015-03-12 07:33:04 +01:00
|
|
|
|
|
|
|
# emacs bindings
|
|
|
|
bindkey -e
|
|
|
|
# make delete key work
|
|
|
|
bindkey "^[[3~" delete-char
|
|
|
|
bindkey "^[3;5~" delete-char
|
|
|
|
|
|
|
|
# autocomplete
|
|
|
|
autoload -Uz compinit
|
|
|
|
compinit
|
|
|
|
|
|
|
|
# OS-specific things
|
2021-01-20 08:28:07 +01:00
|
|
|
if [[ "$OSTYPE" =~ ^linux.*$ ]]; then
|
2018-08-27 13:42:00 +02:00
|
|
|
PATH=~/.local/bin:$PATH
|
2018-05-31 20:56:47 +02:00
|
|
|
|
|
|
|
# System Node.js with local "global" package prefix, for DSpace build environment:
|
|
|
|
# $ npm config set prefix ~/.node_modules
|
|
|
|
# $ npm install -g bower grunt grunt-cli
|
|
|
|
PATH=$PATH:~/.node_modules/bin
|
2020-02-10 13:00:41 +01:00
|
|
|
|
|
|
|
if [[ -n $WAYLAND_DISPLAY ]]; then
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
export KITTY_ENABLE_WAYLAND=1
|
|
|
|
export QT_QPA_PLATFORM=wayland-egl
|
|
|
|
export CLUTTER_BACKEND=wayland
|
|
|
|
# 2020-02-10: https://github.com/swaywm/sway/wiki#issues-with-java-applications
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
fi
|
2015-05-05 10:39:45 +02:00
|
|
|
fi
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2016-11-05 14:08:06 +01:00
|
|
|
alias ls='ls -F --color=auto'
|
2015-05-09 17:21:45 +02:00
|
|
|
alias less='less -R' # preserves colors in GNU coreutils' `less`
|
|
|
|
|
2020-07-10 12:49:58 +02:00
|
|
|
# selenized dircolors
|
|
|
|
# see: https://github.com/jan-warchol/selenized/tree/master/other-apps/dircolors
|
|
|
|
export LS_COLORS="$LS_COLORS:ow=1;7;34:st=30;44:su=30;41"
|
|
|
|
|
2015-05-10 11:32:50 +02:00
|
|
|
|
2015-03-12 07:33:04 +01:00
|
|
|
# Environment
|
2015-03-13 09:09:01 +01:00
|
|
|
export PS1='[%n@%m: %~]$ '
|
2015-05-05 10:39:45 +02:00
|
|
|
export EDITOR=vim
|
|
|
|
export PAGER=less
|
2015-03-12 07:33:04 +01:00
|
|
|
|
2015-09-05 19:52:16 +02:00
|
|
|
# resize images using GraphicsMagick
|
2015-08-30 16:58:36 +02:00
|
|
|
#
|
2017-01-20 10:49:47 +01:00
|
|
|
# $ smartresize DSC_0788.JPG 1920x1080 outputdir [quality]
|
2015-08-30 16:58:36 +02:00
|
|
|
#
|
2015-09-05 19:52:16 +02:00
|
|
|
# Similar to the one from SmashingMagazine, but ported to GraphicsMagick
|
2015-08-30 16:58:36 +02:00
|
|
|
# see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
|
|
|
|
smartresize() {
|
2016-11-19 17:01:25 +01:00
|
|
|
if [[ -z $4 ]]; then QUALITY=82; else QUALITY=$4; fi
|
|
|
|
|
|
|
|
gm mogrify -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 2x0.5+0.7+0 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace Line -strip -output-directory $3 $1
|
2015-09-02 22:51:31 +02:00
|
|
|
}
|
|
|
|
|
2016-03-17 22:01:40 +01:00
|
|
|
# optimize jpeg using GraphicsMagick
|
|
|
|
#
|
|
|
|
# $ jpegoptimize DSC_0788.JPG outputdir [quality]
|
|
|
|
#
|
|
|
|
# Similar to smartresize above, but just optmizes the jpeg
|
|
|
|
jpegoptimize() {
|
|
|
|
if [[ -z $3 ]]; then QUALITY=82; else QUALITY=$3; fi
|
|
|
|
|
2016-08-14 22:04:01 +02:00
|
|
|
gm mogrify -filter Triangle -define filter:support=2 -unsharp 2x0.5+0.7+0 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -interlace Line -strip -output-directory $2 $1
|
2016-03-17 22:01:40 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 10:44:21 +01:00
|
|
|
# generate random password 15 characters long
|
|
|
|
# See: https://unix.stackexchange.com/questions/230673/how-to-generate-a-random-string
|
2016-03-07 11:39:25 +01:00
|
|
|
genpass() {
|
2017-01-11 10:44:21 +01:00
|
|
|
</dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 15 ; echo
|
2016-03-07 11:39:25 +01:00
|
|
|
}
|
|
|
|
|
2017-06-07 11:17:01 +02:00
|
|
|
# set GPG TTY
|
|
|
|
export GPG_TTY=$(tty)
|
2017-06-11 08:44:29 +02:00
|
|
|
|
2017-06-07 11:17:01 +02:00
|
|
|
# Refresh gpg-agent tty in case user switches into an X Session
|
|
|
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
2016-11-19 16:59:36 +01:00
|
|
|
|
2017-08-01 13:27:58 +02:00
|
|
|
# Speed up JVM start for short-lived Java programs
|
|
|
|
# See: https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
|
|
|
|
export MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
|
2015-03-12 07:33:04 +01:00
|
|
|
export PATH
|
2015-05-05 10:40:42 +02:00
|
|
|
export MANPATH
|