dot

packages and services management
Log | Files | Refs | README

commit fbdc662e4d5986f1877ed53b862bbb82d0fafa63
parent c24f86afd791bf39d371dd58c13a69834592a77b
Author: josuah <mail@josuah.net>
Date:   Sat,  8 Oct 2016 15:00:21 -0400

Merge branch 'master' of http://github.com/josuah/Config

Diffstat:
Mshell/.pam_environment | 54+++++++++++++++++++++++++++++++-----------------------
Mshell/.profile | 164+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
2 files changed, 124 insertions(+), 94 deletions(-)

diff --git a/shell/.pam_environment b/shell/.pam_environment @@ -1,35 +1,43 @@ -# * | + # * | # ---. ,--. --.-. ,--. ---. . , , .,-- ,--. ---. --.-. ,--. ---. |-- # | | ,--| | | | |--' | | \ / | | | | | | | | | |--' | | | -# |--' `--` ' ' ' `--' ' ' ' ' ' `--' ' ' ' ' ' `--' ' ' ' 2016-10-08 +# |--' `--` ' ' ' `--' ' ' ' ' ' `--' ' ' ' ' ' `--' ' ' ' 2016-10-05 #-|----------------------------------------------------------------------------- -# Environment variables - +# Environment variables put at the right place EMAIL OVERRIDE="mail@josuah.net" -# COMMANDS 2016-09-21 + +# COMMANDS +#------------------------------------------------------------------------------- + +EDITOR OVERRIDE=vim +ALTERNATE_EDITOR OVERRIDE=vi +VISUAL OVERRIDE=${EDITOR} +FCEDIT OVERRIDE=${EDITOR} +PAGER OVERRIDE="less -Ri" +BROWSER OVERRIDE=w3m +FILTER OVERRIDE=peax + + +# DIRECTORIES #------------------------------------------------------------------------------- -EDITOR DEFAULT=vim -ALTERNATE_EDITOR DEFAULT=vi -VISUAL DEFAULT=${EDITOR} -FCEDIT DEFAULT=${EDITOR} -PAGER DEFAULT="less -Ri" -BROWSER DEFAULT=w3m -FILTER DEFAULT=peax +MAIL OVERRIDE=@{HOME}/Mail/INBOX +CONFIG OVERRIDE=@{HOME}/Config +LOCAL OVERRIDE=@{HOME}/.local +ENV OVERRIDE=@{HOME}/.profile +XDG_CONFIG_HOME OVERRIDE=@{HOME}/.config +XDG_CACHE_HOME OVERRIDE=@{HOME}/.cache +XDG_DATA_HOME OVERRIDE=@{HOME}/.local/share +ABDUCO_SOCKET_DIR OVERRIDE=${XDG_CACHE_HOME}/ -# DIRECTORIES 2016-09-21 +# PATHS #------------------------------------------------------------------------------- -CONFIG DEFAULT=@{HOME}/Config -MAIL DEFAULT=@{HOME}/Mail/INBOX -LOCAL DEFAULT=@{HOME}/.local -ENV DEFAULT=@{HOME}/.profile -MANPATH DEFAULT=${MANPATH}:${PREFIX}/share/man:${PREFIX}/man -LD_LIBRARY_PATH DEFAULT=${PREFIX}/lib -XDG_CONFIG_HOME DEFAULT=@{HOME}/.config -XDG_CACHE_HOME DEFAULT=@{HOME}/.cache -XDG_DATA_HOME DEFAULT=@{HOME}/.local/share -ABDUCO_SOCKET_DIR DEFAULT=${XDG_CACHE_HOME}/ +PATH OVERRIDE=${LOCAL}/bin:${CONFIG}/bin:${PATH} +MANPATH OVERRIDE=${LOCAL}/share/man:${LOCAL}/man:${MANPATH} +CPATH OVERRIDE=${LOCAL}/include:${CPATH} +LD_LIBRARY_PATH OVERRIDE=${LOCAL}/lib:${LD_LIBRARY_PATH} +LD_RUN_PATH OVERRIDE=${LOCAL}/lib:${LD_LIBRARY_PATH} diff --git a/shell/.profile b/shell/.profile @@ -1,24 +1,29 @@ #!/bin/sh -# ,-- * | -# ---. .,-- ,--. |- , | ,--. -# | | | | | | | | |--' -# |--' ' `--' ' ' ' `--' 2016-10-08 -#-|----------------------------------------------------------------------------- -# Shell configuration, for any shell (dash, zsh, mksh, bash, busybox's ash...) +# ---. ,-- * | +# | | .,-- ,--. |- , | ,--. +# |--' | | | | | | |--' +# | ' `--' ' ' ' `--' 2016-10-05 +# ' ---------------------------------------------------------------------------- +# Shell configuration for any shell (dash, zsh, mksh, bash, busybox's ash...) # VARIABLES #------------------------------------------------------------------------------- -# Parse and merge ~/.pam_environment - -[ -z "$CONFIG" ] && eval << EOF -$(sed -r '/^ *#/ d; /^ *$/ d; s/@/$/g; s/ *([^ ]*) *[^ ]*=/\1=/' \ - ~/.pam_environment) -EOF -export PATH="$CONFIG/bin:$LOCAL/bin:$PATH" -export PS1='$(ps1)' -export PS2='| ' +# Parse and merge ~/.pam_environment +if [ -z "$CONFIG" ] +then IFS=' +' + for l in $(sed -r ' + /^ *(#.*|\s*)$/ d # Remove comments and empty lines + s/@/$/g # Convert variable notation. + s/ *([^ ]*) *[^ ]*=/\1=/ # Remove aditionnal pam keywords. + ' ~/.pam_environment) + do eval "$l" + printf '%s\n' "$l" + done + unset IFS +fi # Black Red Green Yellow Blue Purple Cyan White THEMES="\ @@ -59,6 +64,10 @@ P0191d1b P19C6363 P260b48a P3dfaf8f P4506070 P5dc8cc3 P68cd0d3 P7dcdccc\ P8709080 P9dca3a3 PAbfebbf PBf0dfaf PC94bff3 PDec93d3 PE93e0e3 PFffffff\ " +# Prompt +export PS1='$(ps1)' +export PS2='| ' + # ALIAS 2016-10-05 #------------------------------------------------------------------------------- @@ -73,16 +82,17 @@ alias t='tmux attach &>/dev/null || tmux new' alias f='find . -type f ! -path "*/.git/*" | fzf --margin=3,6' alias d='find . -type d ! -path "*/.git/*" | fzf --margin=3,6' alias c='cd "$(find . -maxdepth 4 -mindepth 1 -type d | fzf --margin=3,6)"' -alias a='buffers attach' -alias r='buffers run' alias g='grep --color=always' -alias lines='find . -name "*.[ch]" | xargs wc -l' alias myip='curl icanhazip.com' +alias lines='find . -name "*.[ch]" | xargs wc -l' # FUNCTIONS 2016-10-05 #------------------------------------------------------------------------------- + +# APPEARANCE + ps1() { code="$?" @@ -95,29 +105,47 @@ ps1() [ "$TMUX" ] && tmux refresh-client -S } -h() +theme() { - for field in $@; do local cmd="$cmd $field"; done - tmp="$(mktemp)" - eval "$cmd 2>&1 | tee "$tmp" | $PAGER" - tee < "$tmp" + printf "$(printf %s "$THEMES" | sed -n "/${1-$( + printf '%s' "$THEMES" | sed 's/ .*$//' | fzf --margin=10,20 + )}/ s/P/\\\\033]P/g p")" + + clear } -light() +color() { - printf '%s\n' "$1" | sudo tee "$( - sudo find -L /sys/class/backlight/ -maxdepth 2 -name brightness - )" + for in in in in + do + for i in 1 2 3 4 5 6 7 + do printf ' \033[3%sm██\033[1mâ–ˆ\033[0m\033[3%sm██' $i $i + done + printf '\n' + done + } -mnt() + +# MANAGE PROJECTS + +gitall() { - sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" + find "$HOME" -name '.git' -type d | while read git + do + git="${git%/*}" + printf '\n\n\033[1m%s\033[0m\n' "~${git#$HOME}" + cd "$git" + git status --porcelain + cd "$HOME" + done } -weather() +buildit() { - curl -4 "wttr.in/$1" + [ -f './autogen.sh' ] && ./autogen.sh + [ -f './configure' ] && ./configure --prefix="$PREFIX" + make && make clean PREFIX=$PREFIX install clean } extract() @@ -140,6 +168,25 @@ extract() esac } + +# INTERACTION + +h() +{ + for field in $@; do local cmd="$cmd $field"; done + tmp="$(mktemp)" + eval "$cmd 2>&1 | tee "$tmp" | $PAGER" + tee < "$tmp" +} + +weather() +{ + curl -4 "wttr.in/$1" +} + + +# RENAMING FILES + # # Remove spaces and other nasty characters from $1, recursively # @@ -174,25 +221,6 @@ remove_prefix() done } -gitall() -{ - find "$HOME" -name '.git' -type d | while read git - do - git="${git%/*}" - printf '\n\n\033[1m%s\033[0m\n' "~${git#$HOME}" - cd "$git" - git status --porcelain - cd "$HOME" - done -} - -buildit() -{ - [ -f './autogen.sh' ] && ./autogen.sh - [ -f './configure' ] && ./configure --prefix="$PREFIX" - make && make clean PREFIX=$PREFIX install clean -} - # # FrameBuffer Video player based on mplayer # @@ -207,6 +235,21 @@ fbv() mplayer -vm -vo fbdev2 "$video" -vf scale -zoom -x "$x" -y "$y" } + +# HARDWARE + +light() +{ + printf '%s\n' "$1" | sudo tee "$( + sudo find -L /sys/class/backlight/ -maxdepth 2 -name brightness + )" +} + +mnt() +{ + sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" +} + rotate() { case "$1" in @@ -217,27 +260,6 @@ rotate() esac | sudo tee /sys/class/graphics/fbcon/rotate_all > /dev/null } -theme() -{ - printf "$(printf %s "$THEMES" | sed -n "/${1-$( - printf '%s' "$THEMES" | sed 's/ .*$//' | fzf --margin=10,20 - )}/ s/P/\\\\033]P/g p")" - - clear -} - -color() -{ - for in in in in - do - for i in 1 2 3 4 5 6 7 - do printf ' \033[3%sm██\033[1m█\033[0m\033[3%sm██' $i $i - done - printf '\n' - done - -} - # STARTUP 2016-10-05 #-------------------------------------------------------------------------------