From 53b55b4b10ef6344a882402d5dcaf11d87b78d3f Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sat, 19 Mar 2022 19:27:36 +0100 Subject: Initial commit --- .bash/aliases.bash | 154 +++++++++++++++++ .bash/exec.bash | 10 ++ .bash/prompt.bash | 129 +++++++++++++++ .bash/vars.bash | 73 ++++++++ .bash_profile | 11 ++ .bashrc | 43 +++++ .flake8 | 11 ++ .forbidden_modules | 2 + .gitconfig | 74 +++++++++ .gitignore | 20 +++ .gitmodules | 6 + .perlcriticrc | 12 ++ .profile | 13 ++ .pylintrc | 7 + .tmux.conf | 1 + .tmux.conf.local | 439 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 13 ++ bin/ssh-agent-launcher | 48 ++++++ bin/sxs | 35 ++++ tmux-gpakosz | 1 + tmux-yank | 1 + 21 files changed, 1103 insertions(+) create mode 100644 .bash/aliases.bash create mode 100644 .bash/exec.bash create mode 100644 .bash/prompt.bash create mode 100644 .bash/vars.bash create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .flake8 create mode 100644 .forbidden_modules create mode 100644 .gitconfig create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .perlcriticrc create mode 100644 .profile create mode 100644 .pylintrc create mode 120000 .tmux.conf create mode 100644 .tmux.conf.local create mode 100644 README.md create mode 100755 bin/ssh-agent-launcher create mode 100755 bin/sxs create mode 160000 tmux-gpakosz create mode 160000 tmux-yank diff --git a/.bash/aliases.bash b/.bash/aliases.bash new file mode 100644 index 0000000..de3d616 --- /dev/null +++ b/.bash/aliases.bash @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# vim:syntax=sh + +# This file actually has aliases _and_ functions. + +if [ "$TERM" != "dumb" ];then + eval "$(dircolors -b)" + alias ls="ls --color=auto" + alias grep="grep --color=auto" + alias egrep="egrep --color=auto" +fi +alias cls=' echo -ne "\033c"' +alias pip-update="sudo pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip install -U" +alias matrix='cmatrix -sbu6 -C cyan' +command -v colordiff >/dev/null 2>&1&&alias diff="colordiff" +command -v colormake >/dev/null 2>&1&&alias make="colormake" +alias perllint="perl -Mstrict -Mdiagnostics -cw" +alias scredit='gimp "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"' +alias scrview='pqiv -i "${SCRSHDIR}/$(ls -rt1 $SCRSHDIR/|tail -n1)"' +alias fuck='sudo $(history -p \!\!)' +alias x509-out='openssl x509 -text -certopt no_version,no_pubkey,no_sigdump,no_aux,no_header -noout -in' +alias psgrep='ps -fp "$(pgrep -d, -x ssh-agent)"' +# ----- CHOO CHOO ----- # +if command -v sl >/dev/null;then + alias sl='sl -e' + alias LS='LS -e' +fi +# ----- LIBVIRT ----- # +alias vl="virsh list --all --title" +alias vnl="virsh net-list --all" +# shellcheck disable=SC2154 +alias vifl='for i in $(virsh list --name --all);do echo $i;virsh domiflist $i;done' +# shellcheck disable=SC2154 +alias vifl='for i in $(virsh list --name --all);do echo $i;virsh domiflist $i;done' +alias v='vnl;vl;vifl' +# ----- BYOBU/TMUX ----- # +alias ba='byobu has -t "$BSNAME" >/dev/null 2>&1 &&byobu list-sessions&&sleep 1&&byobu attach-session -t "$BSNAME"||printf "No session called %b!\\n" "$BSNAME"' +alias bl="byobu list-sessions" +alias bo="byobu list-sessions \; list-windows" +alias tc='tmux save-buffer -|xclip -i&&echo "tmux buffer copied"' +# ----- NETWORK ----- # +alias openports='ss --all --numeric --processes --ipv4 --ipv6' +alias myip4='curl -k "https://diagnostic.opendns.com/myip"' +alias myip6='curl -6 "https://icanhazip.com"' +# ----- MEDIA ----- # +alias dvdb='dvdbackup -i /dev/dvd1 -M' +alias dvdburn='brasero' +alias dosbox='export SDL_VIDEO_X11_DGAMOUSE=0;dosbox;unset SDL_VIDEO_X11_DGAMOUSE' +alias mdf2iso="iat" +alias bin2iso="iat" +alias replaygain='mp3gain -s i' +alias jackdrc="/usr/bin/jackd -T -u -dalsa -r48000 -p1024 -n2 -D -Chw:CODEC &>/dev/null &" +alias html2png="cutycapt" +# ----- WM ----- # +alias startgnome="sxs gnome" +alias startkde="sxs kde" +alias starte16="sxs e16" +alias startxmonad="sxs xmonad" +# ----- SSH ----- # +alias saa="source ~/.ssh/sshenv;ssh-add >/dev/null 2>&1;ssh-add -l" +alias sshr='ssh -o StrictHostKeyChecking=no' +alias sshk='ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no' +# ----- FS ----- # +xstat() { + for target in "${@}";do + inode=$(ls -di "${target}"|cut -d ' ' -f 1) + fs=$(df "${target}"|tail -n 1|awk '{print $1}') + crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null | grep -oP 'crtime.*--\s*\K.*') + printf "%s\t%s\n" "${crtime}" "${target}" + done +} +# ----- GRAFANA ----- # +if command -v grafana-cli >/dev/null;then + alias gfpi='sudo grafana-cli plugins install' + alias gfpl='sudo grafana-cli plugins list' + alias gfplr='sudo grafana-cli plugins list-remote' + alias gfrs="sudo systemctl restart grafana-server.service;systemctl is-active grafana-server.service;sudo ss -pantl|grep :3000" +fi +alias gfs="systemctl is-active grafana-server.service&&sudo ss -pantl|grep :3000" +# ----- ZE PASSWORDS ----- # +if [ -r "/etc/os-release" ];then + osid="$(grep ^ID /etc/os-release|awk -F= '{print $2}'|tail -n1)" + case "$osid" in + fedora|centos|rhel*) + alias mkpsk="makepasswd -c '1234567890abcdef' -l 64" + alias mkpw="makepasswd -c 'qwertzuiopasdfghjkyxcvbnmQWERTZUPASDFGHJKLYXCVBNM23456789#!_' -l 24" + ;; + *suse*) + alias mkpsk="mimimi :(" + alias mkpw="mimimi :(" + ;; + *) + alias mkpsk="makepasswd --string='1234567890abcdef' --chars='64'" + alias mkpw="makepasswd --string='qwertzuiopasdfghjkyxcvbnmQWERTZUPASDFGHJKLYXCVBNM23456789#!_' --chars='24'" + ;; + esac + unset osid +fi +# ----- GPG -----# +alias gpg='gpg --expert' +gpg-expmaster() { + FRETVAL=0 + HELPTXT="Exports all secrets to master file\nUSAGE:\t${FUNCNAME[0]} outputfile key-id" + [ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\ + [ -z "$2" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\ + gpg2 --armour --output "$1" --export-secret-key "$2"||FRETVAL=$((FRETVAL+1)) + return "$FRETVAL" +} +gpg-exppaper() { + FRETVAL=0 + HELPTXT="Exports all secrets to paper\nUSAGE:\t${FUNCNAME[0]} key-id" + [ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\ + gpg2 --export-secret-key "$1"|paperkey|lpr||FRETVAL=$((FRETVAL+1)) + return "$FRETVAL" +} +gpg-removekey() { + FRETVAL=0 + HELPTXT="Removes a key ID from keystore\nUSAGE:\t${FUNCNAME[0]} key-id" + [ -z "$1" ]&&echo -e "$HELPTXT"&&FRETVAL=$((FRETVAL+1))||\ + gpg-connect-agent "DELETE_KEY $1" /bye||FRETVAL=$((FRETVAL+1)) + return "$FRETVAL" +} +# ----- CERTIFICATES ----- # +alias certmgr='certutil -d sql:${HOME:?}/.pki/nssdb' +alias certlist="certmgr -L" +alias certshow="certmgr -L -n" +# ----- APPLICATION CONTROL ----- # +alias browser-set='xdg-settings set default-web-browser' +alias browser-get='xdg-settings get default-web-browser' +# ----- CONTAINERS ----- # +if command -v podman >/dev/null;then + alias pcl="podman container list" + alias pclj="podman container list --format json" + alias pnl="podman network ls" + alias ppl="podman pod list" + alias pplj="podman pod list --format json" + alias pvl="podman volume list" + alias pvlj="podman volume list --format json" + alias pci="podman container inspect" + alias pni="podman network inspect" + alias ppi="podman pod inspect" + alias pvi="podman volume inspect" + alias pcr="podman container rm" + alias pnr="podman network rm" + alias ppr="podman pod rm" + alias pvr="podman volume rm" + alias pcs="podman container start" + alias pnc="podman network connect" + alias pps="podman pod start" + # d=destroy, kvm's term for "stop vigorously" :-) + alias pcd="podman container stop" + alias pnd="podman network disconnect" + alias ppd="podman pod stop" +fi diff --git a/.bash/exec.bash b/.bash/exec.bash new file mode 100644 index 0000000..cabf2d8 --- /dev/null +++ b/.bash/exec.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# vim:syntax=sh +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize +set bell-style visible + +# because on some hosts the login path is fucked, unset in .local +# if it causes irritation: +cd ~ || cd || exit 151 diff --git a/.bash/prompt.bash b/.bash/prompt.bash new file mode 100644 index 0000000..a78f2ed --- /dev/null +++ b/.bash/prompt.bash @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +# vim:syntax=sh:ts=4 + +# ----- PROMPT COLOURS ----- # +fgcolor () { + #echo "\\[\\033[38;5;"$1"m\\]" + echo "\033[38;5;${1}m" +} +bgcolor () { + #echo "\\[\\033[48;5;"$1"m\\]" + echo "\033[48;5;${1}m" +} +# This is Solaris bash compatible, so we cannot use + here for "at least once) but instead use the +# stupid old asterisk (*). Well, here hetting "no digits" practically won't hurt. +MYUID="$(id|sed 's/.*uid=\([0-9]*\).*/\1/g')";export MYUID +# ...because "empty" will hit the "any" condition in the end :) +case "$MYUID" in + 0) + case "$OSNAME" in + debian) FGC1="fgcolor 88";FGC2="fgcolor 25";FGC3="fgcolor 38";; + arch) FGC1="fgcolor 88";FGC2="fgcolor 24";FGC3="fgcolor 240";; + redhat|fedora) FGC1="fgcolor 160";FGC2="fgcolor 88";FGC3="fgcolor 203";; + # with the advent of Rocky, we'll match the time to SUSE's blue and the hostname to + # the colour of Geeko: + #*suse|aix) FGC1="fgcolor 88";FGC2="fgcolor 22";FGC3="fgcolor 41";; + *sles*) FGC1="fgcolor 88";FGC2="fgcolor 22";FGC3="fgcolor 83";; + *suse|aix) FGC1="fgcolor 88";FGC2="fgcolor 30";FGC3="fgcolor 83";; + *centos*) FGC1="fgcolor 88";FGC2="fgcolor 25";FGC3="fgcolor 208";; + *solaris) FGC1="fgcolor 88";FGC2="fgcolor 31";FGC3="fgcolor 124";; + ubuntu) FGC1="fgcolor 88";FGC2="fgcolor 130";FGC3="fgcolor 215";; + rasp*) FGC1="fgcolor 88";FGC2="fgcolor 253";FGC3="fgcolor 126";; + rocky) FGC1="fgcolor 88";FGC2="fgcolor 22";FGC3="fgcolor 41";; + *) FGC1="fgcolor 88";FGC2="fgcolor 240";FGC3="fgcolor 244";; + esac + ;; + *) + case "$OSNAME" in + debian) FGC1="fgcolor 25";FGC2="fgcolor 253";FGC3="fgcolor 38";; + arch) FGC1="fgcolor 24";FGC2="fgcolor 253";FGC3="fgcolor 239";; + redhat|fedora) FGC1="fgcolor 88";FGC2="fgcolor 253";FGC3="fgcolor 203";; + #*suse|aix) FGC1="fgcolor 22";FGC2="fgcolor 253";FGC3="fgcolor 41";; + *sles*) FGC1="fgcolor 22";FGC2="fgcolor 253";FGC3="fgcolor 83";; + *suse|aix) FGC1="fgcolor 30";FGC2="fgcolor 253";FGC3="fgcolor 83";; + *centos*) FGC1="fgcolor 25";FGC2="fgcolor 253";FGC3="fgcolor 208";; + *solaris) FGC1="fgcolor 31";FGC2="fgcolor 253";FGC3="fgcolor 124";; + ubuntu) FGC1="fgcolor 130";FGC2="fgcolor 253";FGC3="fgcolor 215";; + rasp*) FGC1="fgcolor 53";FGC2="fgcolor 253";FGC3="fgcolor 126";; + rocky) FGC1="fgcolor 22";FGC2="fgcolor 253";FGC3="fgcolor 41";; + *) FGC1="fgcolor 240";FGC2="fgcolor 253";FGC3="fgcolor 244";; + esac + ;; +esac +# make it possible to draw user-defined colours +# shellcheck disable=SC1090 +[ -r "${BBD}/prompt.bash.local" ] && source "${BBD}/prompt.bash.local" + +# ----- USER SEP. AND HOSTNAME ----- # +UHSEP="@" +[ -n "$TMUX_PANE" ]&&UHSEP="[T]" +[ -n "$BYOBU_WINDOW_NAME" ]&&UHSEP="[B]" +[ "$(hostname -s)" == "monitoring" ]&&PHN="$(hostname -f)"||PHN="$(hostname -s)" + +# ----- ASSEMBLE THE PROMPT COMMAND ADDITION ----- # +__prompt_command() { + local EXIT="$?" + if [ "$EXIT" -lt 10 ];then + local EXIT2="00$EXIT" + elif [ "$EXIT" -lt 100 ];then + local EXIT2="0$EXIT" + else + local EXIT2="$EXIT" + fi + case "$MYUID" in + 0) + PS1="\\# \[$(tput bold)\]\[$($FGC1)\]\\u\[$($FGC2)\]@$PHN \[$($FGC3)\]\\w \[$(tput sgr0)\]" + ;; + *) + PS1="\\# \[$(tput bold)\]\[$($FGC1)\]\t \[$($FGC2)\]\\u$UHSEP\[$($FGC3)\]$PHN \\w \[$(tput sgr0)\]" + ;; + esac + if command -v __git_ps1 >/dev/null 2>&1;then PS1+="$(__git_ps1 "%s ")";fi + if [ "$EXIT" -eq 0 ];then + PS1+="\[\033[0;32m\]# " + elif [ "$EXIT" -eq 255 ]||[ "$EXIT" -eq 127 ];then + PS1+="\[\033[0;33m\]$EXIT2 # " + elif [ "$EXIT" -eq 130 ];then + PS1+="\[\033[0;35m\]$EXIT2 # " + else + PS1+="\[\033[0;31m\]$EXIT2 # " + fi + PS1+="\[\033[0m\]" +} + +# ----- ADD __prompt_command() TO $PROMPT_COMMAND ----- # +if ! printf "%b" "$PROMPT_COMMAND" | grep '__prompt_command' >/dev/null;then + case "$TERM" in + # adding in "screen" because tmux + xterm|xterm-color|xterm-256color|rxvt*|screen-256color|screen) + if [ -n "$PROMPT_COMMAND" ];then + export PROMPT_COMMAND="__prompt_command;${PROMPT_COMMAND}" + else + export PROMPT_COMMAND="__prompt_command" + fi + ;; + *) + if [ -n "$PROMPT_COMMAND" ];then + export PROMPT_COMMAND="__prompt_command;${PROMPT_COMMAND}" + else + export PROMPT_COMMAND="__prompt_command" + fi + ;; + esac +fi +# ----- ADD SSH ENV FILE TO PROMPT_COMMAND ----- # +if [ -r "$SSHENVFILE" ];then + if ! printf "%b" "$PROMPT_COMMAND" | grep "source $SSHENVFILE" >/dev/null;then + # we don't need to check whether PROMPT_COMMAND is set as after the paragraph + # above, something will be definitely set. + PROMPT_COMMAND="${PROMPT_COMMAND};source $SSHENVFILE" + fi +fi +# ----- HISTORY SUBMISSION IN $PROMPT_COMMAND ----- # +if ! printf "%b" "$PROMPT_COMMAND"|grep 'history -a' >/dev/null;then + if [ -n "$PROMPT_COMMAND" ];then + export PROMPT_COMMAND="$PROMPT_COMMAND;history -a;history -c;history -r" + else + export PROMPT_COMMAND="history -a;history -c;history -r" + fi +fi diff --git a/.bash/vars.bash b/.bash/vars.bash new file mode 100644 index 0000000..dddc831 --- /dev/null +++ b/.bash/vars.bash @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# vim:syntax=sh + +# default Byobu session name +export BSNAME="CHANGEME" +# default screenshot target. Feel free to override in .local. +export SCRSHDIR="${HOME}/Pictures" +# variable for SSH environment file +export SSHENVFILE="${HOME}/.ssh/sshenv" + +# ----- SHELL ----- # +for pa in "/usr/local/bin" "${HOME}/bin";do + if ! printf "%b" "$PATH"|grep -P "^${pa}:|:${pa}:" >/dev/null;then + export PATH="${pa}:${PATH}" + fi +done +# $OSNAME +if [ -r "/etc/os-release" ];then + OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1)" +elif [ -r "/etc/redhat-release" ];then + grep -P "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat" + grep -P "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora" + grep -P "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +elif [ -r "/etc/SuSE-release" ];then + OSNAME="oldsuse" +elif [ -r "/etc/release" ];then + head -n1 /etc/release 2> /dev/null|grep -i solaris > /dev/null && OSNAME="solaris" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +else + [ "$(oslevel -s >/dev/null 2>&1|wc -l)" -gt 0 ]&&OSNAME="aix" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +fi +declare -x GPG_TTY +GPG_TTY="$(tty)" +export e='2.718281828459045' +if command -v bc >/dev/null;then + declare -x pi + pi="$(echo "scale=64; 4*a(1)" | bc -l)" +fi + +# ----- GIT ----- # +# git on the command line +export GIT_PS1_SHOWDIRTYSTATE=1 +export GIT_PS1_SHOWSTASHSTATE=1 +export GIT_PS1_SHOWUNTRACKEDFILES=1 + +# ----- LESS FOR EVERYTHING ----- # +if command -v less >/dev/null;then + # coloured mapages + export LESS_TERMCAP_mb=$'\E[01;31m' + export LESS_TERMCAP_md=$'\E[01;31m' + export LESS_TERMCAP_me=$'\E[0m' + export LESS_TERMCAP_se=$'\E[0m' + export LESS_TERMCAP_so=$'\E[01;44;33m' + export LESS_TERMCAP_ue=$'\E[0m' + export LESS_TERMCAP_us=$'\E[01;32m' + # make less more friendly for non-text input files, see lesspipe(1) + [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" + export SYSTEMD_PAGER="less" + export LESSANSIENDCHARS="m" + export LESSANSIMIDCHARS="0123456789:;[?!\"'#%()*+ " +fi +# ----- MISC ----- # +# nopaste +export NOPASTE_SERVICES='pastebin nopaste' +export NOPASTE_NICK='CHANGEME' +# libvirt +export LIBVIRT_DEFAULT_URI="qemu:///system" +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..126f880 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,11 @@ +# .bash_profile + +# Set umask to something world-unreadable in any case +umask 027 + +# Get the aliases and functions +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +# User specific environment and startup programs diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..c0cae3d --- /dev/null +++ b/.bashrc @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# vim:syntax=sh +# .bash main folder. also required in .bash/prompt.sh. +export BBD="${HOME}/.bash" + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return +# don't put duplicate lines in the history. See bash(1) for more options +export HISTCONTROL=ignoredups +# If the sysadmins do not care about history timestamps, let us do that: +[ -z "$HISTTIMEFORMAT" ] && export HISTTIMEFORMAT="%F %T " +# same philosophy, other history settings: +[ -z "$HISTSIZE" ] && export HISTSIZE=10240 +[ -z "$HISTCONTROL" ] && export HISTCONTROL=ignoredups +# stuff before $BBD +# shellcheck disable=SC1090 +[ -r "${HOME}/.byobu/prompt" ] && source "${HOME}/.byobu/prompt" +# shellcheck disable=SC1091 +[ -r "/usr/share/bash-completion/bash_completion" ] && source "/usr/share/bash-completion/bash_completion" + +# The above is absolutely mandatory imho. Now for the rest. +# Do we have our base directory? +[ ! -x "$BBD" ] && return +MYKERN="$(uname -s)" +for i in vars aliases exec prompt;do + # shellcheck disable=SC1090 + if [ -r "${BBD}/${i}.bash" ];then + source "${BBD}/${i}.bash" + else true + fi + if [ "$MYKERN" == "Linux" ];then + # shellcheck disable=SC1090 + if [ -r "${BBD}/${i}.linux.bash" ];then + source "${BBD}/${i}.linux.bash" + else true + fi + fi + # shellcheck disable=SC1090 + if [ -r "${BBD}/${i}.bash.local" ];then + source "${BBD}/${i}.bash.local" + else true + fi +done diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..dd10c5c --- /dev/null +++ b/.flake8 @@ -0,0 +1,11 @@ +# vim:syntax=dosini +[flake8] +count = True # Ausgeben der Gesamt-Fehleranzahl +# show-source = True +# W191: tabs instead of spaces (screw you!), E401: multiple imports on a single line +ignore = W191,E401 +max-line-length = 100 +# Do test for docstrings. Laziness sucks. +doctests = True +# use only if flake8-colors is installed: +format = format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s diff --git a/.forbidden_modules b/.forbidden_modules new file mode 100644 index 0000000..4f95ba0 --- /dev/null +++ b/.forbidden_modules @@ -0,0 +1,2 @@ +Switch Use if, elsif instead of the deprecated Switch module +Fatal Use autodie instead of Fatal diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..831bc32 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,74 @@ +[color] + diff = auto + status = auto + branch = auto + ui = auto +# To determine user and GPG key ID, we source this file: +[include] + path = ~/.gitconfig.local +# ...with the following content: +## vim:syntax=gitconfig +#[user] +# name = John McDoe III +# email = fekyourspam@example.com +# signingkey = 1FEDBEEFC0DEDBAD +[log] + date = iso +[alias] + st = status + lg = log -p + dc = diff --cached + lol = log --graph --decorate --pretty=format:'%C(auto)%h %G? %d %s%Creset' --abbrev-commit + lola = log --graph --decorate --pretty=format:'%C(auto)%h %G? %d %s%Creset' --abbrev-commit --all + ls = ls-files + compactlog = log --pretty=format:"%h%x09%an%x09%ad%x09%s" --date=short + # check out existing remote branch, e.g. origin/branchname + cb = checkout --track + co = checkout + cob = checkout -b + c = commit --verbose + ca = commit --verbose --all + s = status --short + l = log --color --graph --pretty=format:'%C(auto)%h %G? %d %s%Creset' + gi = init --bare + gs = init --bare --shared + aa = add --all --verbose + ap = add -p + up = pull --rebase=preserve + fa = fetch --all --verbose + gr = grep --break --heading --line-number + d = diff + ds = diff --stat + dc = diff --cached + la = "!git config -l|grep alias|cut -c 7-|sort|sed \"s/^\\([^=]\\+\\)=/\\1€/g\"|sed \"s|€/|@/|g;s|ts€|ts@|g;s|^la.*|la€|g\"|column -ts€" + alias = "!git config -l|grep alias|cut -c 7-|sort" + cs = "!GPG_TTY=$(tty) git commit -S --verbose" + csa = "!GPG_TTY=$(tty) git commit -S --verbose --all" + csp = "!GPG_TTY=$(tty) git commit -S -pv" + tag = "!GPG_TTY=$(tty) git tag -s" + tty = "!export GPG_TTY=$(tty)" + puv = push --verbose + puff = "!git puv" + pl = pull -tpf + p = pull -tpf + branchpull = remote update origin --prune + branchremdel = push origin --delete + ba = branch --list --all +[push] + default = simple +[core] + editor = vim + fileMode = true +[merge] + tool = vimdiff +[mergetool] + keepBackup = false +[gui] + fontui = -family Hack -size 11 -weight normal -slant roman -underline 0 -overstrike 0 + fontdiff = -family Hack -size 11 -weight normal -slant roman -underline 0 -overstrike 0 +[commit] + gpgSign = true +#[gpg] +# program = /usr/bin/gpg2 +[http] + #proxy = http://10.0.0.1:3128/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b858474 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +* +!/.gitignore +!/.gitmodules +!/.bashrc +!/.bash_profile +!/.bash +/.bash/* +!/.bash/*bash +!/bin +!/bin/* +!/.flake8 +!/.forbidden_modules +!/.gitconfig +!/.perlcriticrc +!/.profile +!/.pylintrc +!/README.md +!/tmux-gpakosz +!/tmux-yank +!/.tmux.conf* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f595963 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "tmux-gpakosz"] + path = tmux-gpakosz + url = https://github.com/gpakosz/.tmux +[submodule "tmux-yank"] + path = tmux-yank + url = https://github.com/tmux-plugins/tmux-yank diff --git a/.perlcriticrc b/.perlcriticrc new file mode 100644 index 0000000..9d8fe76 --- /dev/null +++ b/.perlcriticrc @@ -0,0 +1,12 @@ +# vim:syntax=dosini +severity = 5 +#verbose = 11 +#verbose = %f: [%p] %m at line %l, column %c.\n%d\n +verbose = %f: [%p] %m at line %l, column %c.\n +theme = core + +[TestingAndDebugging::RequireUseWarnings] +severity = 5 + +[Modules::ProhibitEvilModules] +modules_file = .forbidden_modules diff --git a/.profile b/.profile new file mode 100644 index 0000000..e96906d --- /dev/null +++ b/.profile @@ -0,0 +1,13 @@ +# Expectation: .bash_profile exists then this file isn't read at all. +# Reality: well... .profile not being looked at at all _can_ happen. + +# Set umask to something world-unreadable in any case +umask 027 + +# include .bash_profile - if we arrived here at all, it's important to do :-) +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bash_profile" ]; then + . "$HOME/.bash_profile" + fi +fi diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..d66e5a2 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,7 @@ +# vim:syntax=dosini +[MASTER] +jobs=2 + +[FORMAT] +indent-string='\t' +max-line-length=100 diff --git a/.tmux.conf b/.tmux.conf new file mode 120000 index 0000000..b73d733 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1 @@ +tmux-gpakosz/.tmux.conf \ No newline at end of file diff --git a/.tmux.conf.local b/.tmux.conf.local new file mode 100644 index 0000000..b6b0f3d --- /dev/null +++ b/.tmux.conf.local @@ -0,0 +1,439 @@ +# vim:syntax=tmux +# Procedure: +# 1. Disabling Gregory's vi-copy-mode and instead using tmux-yank. The latter covers all +# specialties e.g. WSL on hosts where your employer or customer forces you to use an OS +# not desihned for IT work +# 2. Style borders +# 3. Assign keys +# 4. Better colours + +# -- navigation ---------------------------------------------------------------- + +# if you're running tmux within iTerm2 +# - and tmux is 1.9 or 1.9a +# - and iTerm2 is configured to let option key act as +Esc +# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys +# then uncomment the following line to make Meta + arrow keys mapping work +#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D" + + +# -- windows & pane creation --------------------------------------------------- + +# new window retains current path, possible values are: +# - true +# - false (default) +tmux_conf_new_window_retain_current_path=false + +# new pane retains current path, possible values are: +# - true (default) +# - false +tmux_conf_new_pane_retain_current_path=true + +# new pane tries to reconnect ssh sessions (experimental), possible values are: +# - true +# - false (default) +tmux_conf_new_pane_reconnect_ssh=false + +# prompt for session name when creating a new session, possible values are: +# - true +# - false (default) +tmux_conf_new_session_prompt=false + + +# -- display ------------------------------------------------------------------- + +# RGB 24-bit colour support (tmux >= 2.2), possible values are: +# - true +# - false (default) +tmux_conf_24b_colour=false + +# default theme +tmux_conf_theme_colour_1="#080808" # dark gray +tmux_conf_theme_colour_2="#303030" # gray +tmux_conf_theme_colour_3="#8a8a8a" # light gray +tmux_conf_theme_colour_4="#00afff" # light blue +tmux_conf_theme_colour_5="#ffff00" # yellow +tmux_conf_theme_colour_6="#080808" # dark gray +tmux_conf_theme_colour_7="#e4e4e4" # white +tmux_conf_theme_colour_8="#080808" # dark gray +tmux_conf_theme_colour_9="#ffff00" # yellow +tmux_conf_theme_colour_10="#ff00af" # pink +tmux_conf_theme_colour_11="#5fff00" # green +tmux_conf_theme_colour_12="#8a8a8a" # light gray +tmux_conf_theme_colour_13="#e4e4e4" # white +tmux_conf_theme_colour_14="#080808" # dark gray +tmux_conf_theme_colour_15="#080808" # dark gray +tmux_conf_theme_colour_16="#d70000" # red +tmux_conf_theme_colour_17="#e4e4e4" # white +tmux_conf_theme_colour_18="#0087d7" # custom blue 1 +tmux_conf_theme_colour_19="#444444" # custom grey 1 + +# window style +tmux_conf_theme_window_fg="default" +tmux_conf_theme_window_bg="default" + +# highlight focused pane (tmux >= 2.1), possible values are: +# - true +# - false (default) +tmux_conf_theme_highlight_focused_pane=false + +# focused pane colours: +tmux_conf_theme_focused_pane_bg="$tmux_conf_theme_colour_18" + +# pane border style, possible values are: +# - thin (default) +# - fat +tmux_conf_theme_pane_border_style=thin + +# pane borders colours: +tmux_conf_theme_pane_border="$tmux_conf_theme_colour_19" +tmux_conf_theme_pane_active_border="$tmux_conf_theme_colour_4" + +# pane indicator colours (when you hit + q) +tmux_conf_theme_pane_indicator="$tmux_conf_theme_colour_4" +tmux_conf_theme_pane_active_indicator="$tmux_conf_theme_colour_4" + +# status line style +tmux_conf_theme_message_fg="$tmux_conf_theme_colour_1" +tmux_conf_theme_message_bg="$tmux_conf_theme_colour_5" +tmux_conf_theme_message_attr="bold" + +# status line command style ( : Escape) +tmux_conf_theme_message_command_fg="$tmux_conf_theme_colour_5" +tmux_conf_theme_message_command_bg="$tmux_conf_theme_colour_1" +tmux_conf_theme_message_command_attr="bold" + +# window modes style +tmux_conf_theme_mode_fg="$tmux_conf_theme_colour_1" +tmux_conf_theme_mode_bg="$tmux_conf_theme_colour_5" +tmux_conf_theme_mode_attr="bold" + +# status line style +tmux_conf_theme_status_fg="$tmux_conf_theme_colour_3" +tmux_conf_theme_status_bg="$tmux_conf_theme_colour_1" +tmux_conf_theme_status_attr="none" + +# terminal title +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W" + +# window status style +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3" +tmux_conf_theme_window_status_bg="$tmux_conf_theme_colour_1" +tmux_conf_theme_window_status_attr="none" +tmux_conf_theme_window_status_format="#I #W" +#tmux_conf_theme_window_status_format="#{circled_window_index} #W" +#tmux_conf_theme_window_status_format="#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}" + +# window current status style +# - built-in variables are: +# - #{circled_window_index} +# - #{circled_session_name} +# - #{hostname} +# - #{hostname_ssh} +# - #{hostname_full} +# - #{hostname_full_ssh} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1" +tmux_conf_theme_window_status_current_bg="$tmux_conf_theme_colour_4" +tmux_conf_theme_window_status_current_attr="bold" +tmux_conf_theme_window_status_current_format="#I #W" +#tmux_conf_theme_window_status_current_format="#{circled_window_index} #W" +#tmux_conf_theme_window_status_current_format="#I #W#{?window_zoomed_flag,🔍,}" + +# window activity status style +tmux_conf_theme_window_status_activity_fg="default" +tmux_conf_theme_window_status_activity_bg="default" +tmux_conf_theme_window_status_activity_attr="underscore" + +# window bell status style +tmux_conf_theme_window_status_bell_fg="$tmux_conf_theme_colour_5" +tmux_conf_theme_window_status_bell_bg="default" +tmux_conf_theme_window_status_bell_attr="blink,bold" + +# window last status style +tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4" +tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2" +tmux_conf_theme_window_status_last_attr="none" + +# status left/right sections separators +tmux_conf_theme_left_separator_main="" +tmux_conf_theme_left_separator_sub="|" +tmux_conf_theme_right_separator_main="" +tmux_conf_theme_right_separator_sub="|" +#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline +#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with +#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone +#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md + +# status left/right content: +# - separate main sections with "|" +# - separate subsections with "," +# - built-in variables are: +# - #{battery_bar} +# - #{battery_hbar} +# - #{battery_percentage} +# - #{battery_status} +# - #{battery_vbar} +# - #{circled_session_name} +# - #{hostname_ssh} +# - #{hostname} +# - #{hostname_full} +# - #{hostname_full_ssh} +# - #{loadavg} +# - #{mouse} +# - #{pairing} +# - #{prefix} +# - #{root} +# - #{synchronized} +# - #{uptime_y} +# - #{uptime_d} (modulo 365 when #{uptime_y} is used) +# - #{uptime_h} +# - #{uptime_m} +# - #{uptime_s} +# - #{username} +# - #{username_ssh} +tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} " +tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} " + +# status left style +tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8" +tmux_conf_theme_status_left_bg="$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11" +tmux_conf_theme_status_left_attr="bold,none,none" + +# status right style +tmux_conf_theme_status_right_fg="$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14" +tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17" +tmux_conf_theme_status_right_attr="none,none,bold" + +# pairing indicator +tmux_conf_theme_pairing="⚇" # U+2687 +tmux_conf_theme_pairing_fg="none" +tmux_conf_theme_pairing_bg="none" +tmux_conf_theme_pairing_attr="none" + +# prefix indicator +tmux_conf_theme_prefix="⌨" # U+2328 +tmux_conf_theme_prefix_fg="none" +tmux_conf_theme_prefix_bg="none" +tmux_conf_theme_prefix_attr="none" + +# mouse indicator +tmux_conf_theme_mouse="↗" # U+2197 +tmux_conf_theme_mouse_fg="none" +tmux_conf_theme_mouse_bg="none" +tmux_conf_theme_mouse_attr="none" + +# root indicator +tmux_conf_theme_root="!" +tmux_conf_theme_root_fg="none" +tmux_conf_theme_root_bg="none" +tmux_conf_theme_root_attr="bold,blink" + +# synchronized indicator +tmux_conf_theme_synchronized="⚏" # U+268F +tmux_conf_theme_synchronized_fg="none" +tmux_conf_theme_synchronized_bg="none" +tmux_conf_theme_synchronized_attr="none" + +# battery bar symbols +tmux_conf_battery_bar_symbol_full="◼" +tmux_conf_battery_bar_symbol_empty="◻" +#tmux_conf_battery_bar_symbol_full="♥" +#tmux_conf_battery_bar_symbol_empty="·" + +# battery bar length (in number of symbols), possible values are: +# - auto +# - a number, e.g. 5 +tmux_conf_battery_bar_length="auto" + +# battery bar palette, possible values are: +# - gradient (default) +# - heat +# - "colour_full_fg,colour_empty_fg,colour_bg" +tmux_conf_battery_bar_palette="gradient" +#tmux_conf_battery_bar_palette="#d70000,#e4e4e4,#000000" # red, white, black + +# battery hbar palette, possible values are: +# - gradient (default) +# - heat +# - "colour_low,colour_half,colour_full" +tmux_conf_battery_hbar_palette="gradient" +#tmux_conf_battery_hbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green + +# battery vbar palette, possible values are: +# - gradient (default) +# - heat +# - "colour_low,colour_half,colour_full" +tmux_conf_battery_vbar_palette="gradient" +#tmux_conf_battery_vbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green + +# symbols used to indicate whether battery is charging or discharging +tmux_conf_battery_status_charging="↑" # U+2191 +tmux_conf_battery_status_discharging="↓" # U+2193 +#tmux_conf_battery_status_charging="🔌" # U+1F50C +#tmux_conf_battery_status_discharging="🔋" # U+1F50B + +# clock style (when you hit + t) +# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right +tmux_conf_theme_clock_colour="$tmux_conf_theme_colour_4" +tmux_conf_theme_clock_style="24" + + +# -- clipboard ----------------------------------------------------------------- + +# in copy mode, copying selection also copies to the OS clipboard +# - true +# - false (default) +# on macOS, this requires installing reattach-to-user-namespace, see README.md +# on Linux, this requires xsel or xclip +tmux_conf_copy_to_os_clipboard=false + + +# -- user customizations ------------------------------------------------------- +# this is the place to override or undo settings + +# increase history size +#set -g history-limit 10000 + +# start with mouse mode enabled +#set -g mouse on + +# force Vi mode +# really you should export VISUAL or EDITOR environment variable, see manual +#set -g status-keys vi +#set -g mode-keys vi + +# replace C-b by C-a instead of using both prefixes +# set -gu prefix2 +# unbind C-a +# unbind C-b +# set -g prefix C-a +# bind C-a send-prefix + +# move status line to top +#set -g status-position top + + +# -- tpm ----------------------------------------------------------------------- + +# while I don't use tpm myself, many people requested official support so here +# is a seamless integration that automatically installs plugins in parallel + +# whenever a plugin introduces a variable to be used in 'status-left' or +# 'status-right', you can use it in 'tmux_conf_theme_status_left' and +# 'tmux_conf_theme_status_right' variables. + +# by default, launching tmux will update tpm and all plugins +# - true (default) +# - false +tmux_conf_update_plugins_on_launch=true + +# by default, reloading the configuration will update tpm and all plugins +# - true (default) +# - false +tmux_conf_update_plugins_on_reload=true + +# by default, reloading the configuration will uninstall tpm and plugins when no +# plugins are enabled +# - true (default) +# - false +tmux_conf_uninstall_plugins_on_reload=true + +# /!\ the tpm bindings differ slightly from upstream: +# - installing plugins: + I +# - uninstalling plugins: + Alt + u +# - updating plugins: + u + +# /!\ do not add set -g @plugin 'tmux-plugins/tpm' +# /!\ do not add run '~/.tmux/plugins/tpm/tpm' + +# to enable a plugin, use the 'set -g @plugin' syntax: +# visit https://github.com/tmux-plugins for available plugins +#set -g @plugin 'tmux-plugins/tmux-copycat' +#set -g @plugin 'tmux-plugins/tmux-cpu' +#set -g @plugin 'tmux-plugins/tmux-resurrect' +#set -g @plugin 'tmux-plugins/tmux-continuum' +#set -g @continuum-restore 'on' + +set -g status-left ' #[fg=#e0e0e0,bold,bg=#ff883e]□ #S ' +set -g status-right '#{?window_zoomed_flag,@,}# #{?client_prefix,#[bg=#c00000] ⌨ ,}#[fg=#a0a0a0,bg=#404040,bold] ↑ #(uptime-hms) #[fg=#808080,bg=#202020,bold] %Y-%m-%d #[fg=#a0a0a0,bg=#404040,bold] %H:%M:%S ' +bind -n M-left previous-window +bind -n M-right next-window +bind-key -n S-Left swap-window -t -1 +bind-key -n S-Right swap-window -t +1 +bind -n S-Left display-panes \; select-pane -L +bind -n S-Right display-panes \; select-pane -R +bind-key -n S-Up display-panes \; select-pane -U +bind-key -n S-Down display-panes \; select-pane -D +bind _ split-window -h +bind | split-window -v +tmux_pane_active_border_fg='colour45' +tmux_pane_active_border_bg=default +tmux_display_panes_colour='colour45' +set-option -g display-panes-active-colour colour45 +set-option -g display-panes-colour colour8 +set-option -g display-panes-time 500 +set-option -g display-time 1500 +set-option -g clock-mode-colour '#169b62' +set-option -g allow-rename off +tmux_conf_window_status_current_fg='#e0e0e0' +tmux_conf_window_status_current_bg='#169b62' +tmux_conf_window_status_current_attr='bold' +#setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F ' +setw -g window-status-current-format ' #[fg=#ff883e]#I#[fg=#e0e0e0]:#[fg=#e0e0e0]#W#[fg=#ff883e]#F ' +bind r source-file ~/.tmux.conf \; source-file ~/.tmux.conf.local \; display-message "$HOME/.tmux.conf reloaded!" +bind-key -n C-S-Down resize-pane -D +bind-key -n C-S-Up resize-pane -U +bind-key -n C-S-Left resize-pane -L +bind-key -n C-S-Right resize-pane -R +set -g pane-active-border-fg colour45 +set -g pane-active-border-bg default +set-option -g display-panes-active-colour colour45 +set-option -g display-panes-colour colour8 +run-shell ~/tmux-yank/yank.tmux + +# -- custom variables ---------------------------------------------------------- + +# to define a custom #{foo} variable, define a POSIX shell function between the +# '# EOF' and the '# "$@"' lines. Please note that the opening brace { character +# must be on the same line as the function name otherwise the parse won't detect +# it. +# +# then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the +# 'tmux_conf_theme_status_right' variables. + +# # /!\ do not remove the following line +# EOF +# +# # /!\ do not "uncomment" the functions: the leading "# " characters are needed +# +# weather() { +# curl -m 1 wttr.in?format=3 2>/dev/null +# sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval +# } +# +# online() { +# ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘' +# } +# +# "$@" +# # /!\ do not remove the previous line diff --git a/README.md b/README.md new file mode 100644 index 0000000..6728444 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# CONTENT + +Yet another (!) approach at building up a centralized configuration. + +Parts are old, parts are not done yet, we're getting there. + +## To-Dos + +* i3 config / sway config +* gpg config +* game launching stuff +* parallel-ssh and ansible +* ... diff --git a/bin/ssh-agent-launcher b/bin/ssh-agent-launcher new file mode 100755 index 0000000..0d116dc --- /dev/null +++ b/bin/ssh-agent-launcher @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +if [ -z "$SSHENVFILE" ];then + printf "SSHENVFILE not set, no target for SSH environment variables.\\n" >&2 + exit 1 +fi + +VERB=1 +KILLIT=0 +while getopts ":qf" SHOPT;do + case "$SHOPT" in + q) VERB=0;; + f) KILLIT=1;; + *) printf "WAT\n" >&2;exit 127;; + esac +done +shift "$(( OPTIND -1 ))" + +[ "$VERB" -eq 1 ]&&printf "[....] Starting SSH agent.\\033[s" +ROEDGROED="$(pgrep -U "$(whoami)" ssh-agent|grep -v grep|awk '{print $1}')" + +if [ -n "$ROEDGROED" ];then + if [ "$KILLIT" -eq 1 ];then + for i in $(echo "$ROEDGROED");do kill "$i" >/dev/null 2>&1||break;done + case "$?" in + 0);; + *) + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n" + exit 2 + ;; + esac + else + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[30;1mSKIP\\033[0m]\\033[u\\033[K (running, PID: %s)\\n" "$ROEDGROED" + exit 0 + fi +fi +ssh-agent >"$SSHENVFILE" 2>&1&&chmod 0600 "$SSHENVFILE" >/dev/null 2>&1 +case "$?" in + 0) + sed -i 's/^echo[^\;]*\;//g' "$SSHENVFILE" >/dev/null 2>&1 + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[32m OK \\033[0m]\\033[u\\033[K\\n" + exit 0 + ;; + *) + [ "$VERB" -eq 1 ]&&printf "\\033[666D[\\033[31mFAIL\\033[0m]\\033[u\\033[K\\n" + exit 1 + ;; +esac diff --git a/bin/sxs b/bin/sxs new file mode 100755 index 0000000..7e544ef --- /dev/null +++ b/bin/sxs @@ -0,0 +1,35 @@ +#!/bin/bash + +pidof -s xinit && exit 0 + +[ -z "$STXTARG" ] && STXTARG="$1" + +if [ -z "$STXTARG" ];then + read -p "Start: e16, xmonad, gnome or kde? " STXTARG + [ -z "$STXTARG" ] && STXTARG="xmonad" +fi + +case "$STXTARG" in + e16) + diff ~/.xsession-e16 ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-e16 ~/.xsession + ;; + xmonad) + diff ~/.xsession-xmonad ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-xmonad ~/.xsession + ;; + gnome) + diff ~/.xsession-gnome ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-gnome ~/.xsession + ;; + kde) + diff ~/.xsession-kde ~/.xsession &> /dev/null + [ "$?" -ne 0 ] && ln -sf .xsession-kde ~/.xsession + ;; + *) + echo "Sorry, I don't know $STXTARG as window manager." + exit 1 + ;; +esac + +startx diff --git a/tmux-gpakosz b/tmux-gpakosz new file mode 160000 index 0000000..9a2387c --- /dev/null +++ b/tmux-gpakosz @@ -0,0 +1 @@ +Subproject commit 9a2387c0c7aa8d12cff06d6be17251e8ebdfd034 diff --git a/tmux-yank b/tmux-yank new file mode 160000 index 0000000..1b1a436 --- /dev/null +++ b/tmux-yank @@ -0,0 +1 @@ +Subproject commit 1b1a436e19f095ae8f825243dbe29800a8acd25c -- cgit v1.2.3