logo

dotfiles

My dotfiles, one branch per machine
commit: 7cde8778b76849f5160f83d4e8f282a6d108a4b7
parent: afcf0c882983f715da7c9cb5aecd7a1993a09d9c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 26 Jun 2019 00:48:53 +0200

Move .common.sh to .profile

Diffstat:

D.bashrc3---
D.common.sh123-------------------------------------------------------------------------------
M.config/mpv/mpv.conf5+++--
M.mkshrc2--
M.profile117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 120 insertions(+), 130 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -1,3 +0,0 @@ -. ~/.common.sh - -set -o vi diff --git a/.common.sh b/.common.sh @@ -1,123 +0,0 @@ -# functions -get_git_branch() { - local branch - if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then - if [[ "$branch" == "HEAD" ]]; then - branch='detached*' - elif [[ "$branch" == $(hostname) ]]; then - branch='@.' - fi - - printf -- ' %s' "$branch" - else - echo '' - fi -} - -get_working_directory() { - pwd | sed "s|^$HOME|~|" -} - -# shell -host_ansi="33" -case $SHELL in - *ksh*) - # hack derived from ksh88(1), works in mksh, doesn't works in bash - export PS1=' ${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' - ;; - *bash*) - export PS1='\[\e[40;32m\]${USER}\[\e[${host_ansi}m\]$(hostname)\]\[\e[30;46m\]$(get_working_directory)$(get_git_branch)\[\e[0m\] ' - ;; - *) - # Don't even try escape codes, and so no powerline-style - export PS1='$USER${HOSTNAME:=$(hostname)} $(get_working_directory) $(get_git_branch) > ' - ;; -esac - -# Aliases -alias fuck='TF_ALIAS=fuck eval $(thefuck $(fc -ln -1))' -alias fuu='su -c "$(fc -ln -1)"' -alias git-story="git log --graph --abbrev-commit --decorate --format=format:'%C(cyan)%h%C(reset) %C(green)(%ad)%C(reset) %G?: %s %C(red)- %an %C(reset)%C(yellow)%d%C(reset)'" -alias git-st="git status --short --branch" -alias j='jobs -l' -alias la='ls -ahF' -alias ll='ls -alhF' -alias ls='ls -hF' -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 - -if [[ 0 -lt $(pgrep startx | wc -l) ]] -then - export DISPLAY=":0.0" -fi diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf @@ -1,6 +1,7 @@ # mpv --vo=help but null is put last and image is removed -vo = vdpau,opengl,wayland,xv,vaapi,x11,drm,tct,null -x11-netwm = yes +vo = vdpau,gpu,xv,vaapi,x11,drm,tct,null +# See if this causes issues in Xorg +gpu-context = wayland no-audio-display audio-file-auto = fuzzy sub-auto = fuzzy diff --git a/.mkshrc b/.mkshrc @@ -1,5 +1,3 @@ -. ~/.common.sh - set -o notify set -o markdirs set -o braceexpand diff --git a/.profile b/.profile @@ -1,6 +1,7 @@ # exports export BROWSER="badwolf:firefox:lynx" export EDITOR="$(which vis)" +export ENV="$HOME/.profile" export GIT_ALTERNATE_OBJECT_DIRECTORIES="${HOME}/Sources/git/git-object-directory/" unset GIT_OBJECT_DIRECTORY export GPGKEY='DDC9237C14CF6F4DD847F6B390D93ACCFEFF61AE' @@ -53,3 +54,119 @@ export XKB_DEFAULT_OPTIONS="compose:menu,grp:alt_shift_toggle" ## Fuck off nvidia export VDPAU_DRIVER=radeonsi export LIBVA_DRIVER_NAME=radeonsi + +# Aliases +alias fuck='TF_ALIAS=fuck eval $(thefuck $(fc -ln -1))' +alias fuu='su -c "$(fc -ln -1)"' +alias git-story="git log --graph --abbrev-commit --decorate --format=format:'%C(cyan)%h%C(reset) %C(green)(%ad)%C(reset) %G?: %s %C(red)- %an %C(reset)%C(yellow)%d%C(reset)'" +alias git-st="git status --short --branch" +alias j='jobs -l' +alias la='ls -ahF' +alias ll='ls -alhF' +alias ls='ls -hF' +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/")' +alias bash="SHELL=/bin/bash bash -l" + +# functions +get_git_branch() { + local branch + if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then + if [[ "$branch" == "HEAD" ]]; then + branch='detached*' + elif [[ "$branch" == $(hostname) ]]; then + branch='@.' + fi + + printf -- ' %s' "$branch" + else + echo '' + fi +} + +get_working_directory() { + pwd | sed "s|^$HOME|~|" +} + +# = functions = +# == prompt setup == +case $(hostname) in + NightmareMoon) host_ansi="33" ;; + hp2125) host_ansi="37" ;; + *) host_ansi="31" ;; +esac + +case $SHELL in + *ksh*) + # hack derived from ksh88(1), works in mksh, doesn't works in bash + export PS1=' ${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' + ;; + *bash*) + export PS1='\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)$(get_git_branch)\[\e[0m\] ' + ;; + *) + # Don't even try escape codes, and so no powerline-style + export PS1='$USER${HOSTNAME:=$(hostname)} $(get_working_directory) $(get_git_branch) > ' + ;; +esac + +# = helpers = +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 +} + +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 +} + +# startup + +gpg-connect-agent /bye # Make sure gpg-agent is started + +stty sane # I can haz urandom