logo

dotfiles

My dotfiles, one branch per machine
commit: d184271e563c4a5b44efeffb1e85231b8163b4ef
parent: 24dc91673d10d6b30879f70e58b9499022634988
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  5 Feb 2018 05:07:58 +0100

.common.sh: lazy commit

Diffstat:

M.common.sh113+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 90 insertions(+), 23 deletions(-)

diff --git a/.common.sh b/.common.sh @@ -14,40 +14,51 @@ get_git_branch() { fi } +get_working_directory() { + pwd | sed "s|^$HOME|~|" +} + # exports +export BROWSER="chromium:firefox:lynx" +export MOZ_ALLOW_GTK_DARK_THEME=true export DVTM_EDITOR="$(which vis)" -export EDITOR="$(which vim)" +export EDITOR="$(which ed)" export GPGKEY='4BBEBBAD' export GPG_TTY="$(tty)" -export GTK_IM_MODULE="uim" export HISTFILE="$HOME/.$(basename $SHELL)_history" export HISTSIZE="65536" -export LANG='en_US.UTF-8' -export LC_TIME='POSIX' -export LESS="-M -r" +export LANG="de_DE.UTF-8" +export LC_TIME='en_DK.UTF-8' # ISO-8601 PLZ export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:' export NNTPSERVER='news.free.fr' -export PAGER="$(which less)" -export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/games/bin:/usr/local/bin:/usr/local/sbin:/usr/local/inferno/Linux/386/bin:/opt/bin" -export PATH="$PATH:$HOME/.local/bin:$HOME/nalci\ finpe/bin:" -export PS1='$USER@$(hostname)$PWD$(get_git_branch) ' -export QT_IM_MODULE="uim" +export PATH="$(echo /{,usr/{,games/,local/,lib/llvm/{5,4}/,lib/plan9/}}{,s}bin | tr \ :)" +export PATH="$PATH:$HOME/.local/bin-glibc" +export PS1='$USER@$(hostname)$(get_working_directory)$(get_git_branch) ' +export QT_SELECT=5 export QT_STYLE_OVERRIDE=GTK+ export TERMINAL='st' export TZ='Europe/Berlin' export VIS_THEME=default-16 export XMODIFIERS="@im=uim" - +export SSH_AUTH_SOCK="${HOME}/.ssh/agent.sock" +export SSH_AGENT_PID=$(cat ${HOME}/.ssh/agent.pid) +export PASSWORD_STORE_ENABLE_EXTENSIONS=true unset VISUAL # Freedesktop shit -export XDG_DESKTOP_DIR="/dev/null" +export XDG_DESKTOP_DIR="/tmp/haelwenn-desktop" && mkdir $XDG_DESKTOP_DIR export XDG_DOWNLOAD_DIR="$HOME/Downloads" +# Input Method +export XMODIFIERS=@im=SCIM +export GTK_IM_MODULE="scim" +export QT_IM_MODULE="scim" + # Aliases alias fuck='TF_ALIAS=fuck eval $(thefuck $(fc -ln -1))' alias fuu='su -c "$(fc -ln -1)"' alias git-history="git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(cyan)%h%C(reset) %C(green)(%ar)%C(reset) %G?: %s %C(red)- %an %C(reset)%C(yellow)%d%C(reset)' --all" +alias git-st="git status --short --branch" alias j='jobs -l' alias la='ls -ahF' alias ll='ls -alhF' @@ -56,16 +67,72 @@ alias mv='mv -i' alias pscpu='ps -eo pid,user,pcpu,pmem,comm --sort -pcpu | head -20' alias psmem='ps -eo pid,user,pcpu,pmem,comm --sort -pmem | head -20' alias rm='rm -ri' +alias xstart='startx -- $(tty | sed "s/\/dev\/tty/vt/")' + +# Let’s spread the STANDARD EDITOR virus +alias ,p=ls +alias ,n=ls\ -l +alias ,l=ls\ -F +alias e=$EDITOR +alias t=cp\ -ri +alias r=cat +alias m=mv\ -i +alias M=mv\ -f +alias h=man + +ssh-start-agent() { + if [ $(ssh-add -l; echo ${?}) == '2' ]; then + rm -fr $SSH_AUTH_SOCK + eval $(ssh-agent -a ~/.ssh/agent.sock) + echo $SSH_AGENT_PID > ~/.ssh/agent.pid + ssh-add + else + echo 'SSH agent appear to be active' + fi +} + +ssh-tunnel() { + local port=${1:-443} + local server=${2:-hacktivis.me} + local target_port=${3:-22$port} + local target_host=${4:-localhost} + + echo "ssh -NL $target_port:$target_host:$port $server" + ssh -NL $target_port:$target_host:$port $server +} + +xdg-desktop-menu() { + echo $1 $2 $3 + if [$1 = 'install']; then + cp $2 ${XDG_DESKTOP_DIR:~/Desktop} + fi +} + +ssh-socks() { + local server=${1:-hacktivis.me} + local port=${2:-22443} + + echo "ssh -ND $port $server" + ssh -ND $port $server +} + +register() { + [ -n "$1" ] && (set -x; gandi forward create $1@hacktivis.me -d lanodan.delta@free.fr; pass generate -c $1 ) +} + +pmounts() { + awk 'BEGIN { print "Mountpoint Type Device Options" } { print $2 " " $3 " " $1 " " $4 | "sort"}' /proc/mounts | column -t -s\ +} + +grep-unicode() { + grep "$1" /usr/share/unicode-data/UnicodeData.txt | awk -F\; '{ system("unicode -t "$1); print FS "U+"$1 FS $2 }' | column -s\; -t +} +wtf-unicode() { + wat-unicode $(unicode -h "$1") +} + +wat-unicode() { + awk -F\; '{ if($1 == "'${1}'"){print "U+"$1 FS $2} }' /usr/share/unicode-data/UnicodeData.txt +} stty sane # I can haz urandom -# Start the gpg-agent if not already running -if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then - gpg-connect-agent /bye >/dev/null 2>&1 -fi - -# Set SSH to use gpg-agent -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh" -fi -export SSH_AUTH_SOCK=/home/haelwenn/.gnupg/S.gpg-agent.ssh