config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit b1299c200c8472854dcc86a2b906124a925974a0
parent 47977fac7a08165145a798800e2a58159e62fe98
Author: jacob@thinkpad <jacobouno@protonmail.com>
Date:   Wed,  3 Jun 2020 11:16:19 -0700

Remove unused aliases and functions, fix indenting

Diffstat:
Maliases/.aliases | 180+++++++++++++++++++++++++------------------------------------------------------
1 file changed, 57 insertions(+), 123 deletions(-)

diff --git a/aliases/.aliases b/aliases/.aliases @@ -1,6 +1,6 @@ -#vim: filetype=sh +# vim: filetype=sh # Jacob Edwards -# created: Feb 10, 2020, updated: Apr 28, 2020 +# created: 2020.02.10, updated: 2020.06.03 # shell aliases and functions, specificaly for archlinux and OpenBSD @@ -8,169 +8,103 @@ # aliases # #---------# - -# source private aliases if [ -f "$HOME/.aliases-private" ]; then - . "$HOME/.aliases-private" + . "$HOME/.aliases-private" fi - if [ $(uname) = "OpenBSD" ]; then - alias xenodm="doas xenodm" - # pkg - alias pkg_add="doas /usr/sbin/pkg_add -xV" - alias pa="pkg_add" - alias pi="pkg_info" - alias pq="pi -Q" + alias xenodm="doas xenodm" + alias pkg_add="doas /usr/sbin/pkg_add -xV" + alias pa="pkg_add" + alias pi="pkg_info" + alias pq="pi -Q" elif [ $(uname) = "Linux" ]; then - alias pacman="pa" - alias pq="pa -Ss" - alias pi="pa -Si" - alias sys="systemctl" - alias suspend="sys suspend" + alias pacman="pa" + alias pq="pa -Ss" + alias pi="pa -Si" + alias sys="systemctl" + alias suspend="sys suspend" fi - -# superuser -alias doas="doas " +alias doas="doas -- " alias sudo="sudo -E " - -# expand aliases alias man="man " -# use extended regex +alias nvim="nvim -p" alias sed="sed -E" alias grep="egrep" - -# simple shorthand alias meta="exiftool" - -# disable default mpv bindings alias mpv="mpv --no-input-default-bindings" - -# kill only exact procces names alias pkill="pkill -x" - -# list what port sshd listens on alias ssh-port="grep -Ei '^port' /etc/ssh/sshd_config || echo 'port 22'" - -# display current date and time in filesystem friendly format alias now="date +%Y%m%d-%H%M%S" -# locations -alias sl="cd ~/src/suckless/" -alias n="cd $NOTES" -alias src="cd ~/own/src/" -alias ss="cd ~/own/r/" - -# 1 char +# shorten +alias f="nvim" alias l="$PAGER" -alias f="$EDITOR" -alias nvim="nvim -p" -alias n="nvim" -alias v="vim" +alias df="locate" +alias g="grep" # git -alias g="git" -alias gd="g diff" +alias gd="git diff" +alias ga="git add" +alias gc="git commit" +alias gP="git push" +alias gp="git pull" +alias gl="git log" alias gdc="gd --cached" -alias ga="g add" -alias gc="g commit" -alias gP="g push" -alias gp="g pull" -alias gl="g log" #-----------# # functions # #-----------# -# start tmux if no other command is specified -#ssh() { -# if [ -z $2 ]; then -# /usr/bin/ssh -t "$@" "tmux a || tmux new" -# else -# /usr/bin/ssh "$@" -# fi -#} - - # get working directory wd() { - local home="$(printf $HOME | sed -E 's/\//\\\//g')" - pwd | sed "s/$home/~/g" + local home="$(printf $HOME | sed -E 's/\//\\\//g')" + pwd | sed "s/$home/~/g" } - # open note for the day daily() { - time="$(date +%H%M)" - # counts as the previous day until six - if ! [ "$time" -gt 0 -a "$time" -lt 600 ]; then - date="$(date +%Y/%m/%d)" - else - date="$(date +%Y/%m)/" - day="$(expr "$(date +%d)" - 1)" - - if [ "$day" -lt 10 ]; then - date="$date/0$day" - else - date="$date/$day" - fi - fi - - if [ ! -e "$NOTES/daily/$date" ]; then - printf "$(date +%d/%m/%Y)\n\n$( date '+%R')" >> "$NOTES/daily/$date" - else - printf "\n\n$(date '+%R')" >> "$NOTES/daily/$date" - fi - - note "daily/$date" -} - - -# get frame in given video at given time -snap() { - ffmpeg -ss $2 -i $1 -loglevel 8 -frames:v 1 $3 -} - - -# convert video to grayscale -grayscale() { - ffmpeg -i $1 -vf format=gray $2 + time="$(date +%H%M)" + # counts as the previous day until six + if ! [ "$time" -gt 0 -a "$time" -lt 600 ]; then + date="$(date +%Y/%m/%d)" + else + date="$(date +%Y/%m)/" + day="$(expr "$(date +%d)" - 1)" + if [ "$day" -lt 10 ]; then + date="$date/0$day" + else + date="$date/$day" + fi + fi + + if [ ! -e "$NOTES/daily/$date" ]; then + printf "$(date +%d/%m/%Y)\n\n$( date '+%R')" >> "$NOTES/daily/$date" + else + printf "\n\n$(date '+%R')" >> "$NOTES/daily/$date" + fi + + note "daily/$date" } - -# get window name wm_name() { - id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')" - xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 2 + id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')" + xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 2 } - -# get window class wm_class() { - id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')" - xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 4 + id="$(xprop -root | grep '_NET_ACTIVE_WINDOW' -m1 | awk -F '# ' '{print $2}')" + xprop -id "$id" | grep 'WM_CLASS' -m1 | cut -d '"' -f 4 } - # search all history for `regex` hs() { - if [ -n "$2"]; then - fc -n -l 0 | grep "$1" | tail -n 20 - else - fc -n -l 0 | grep "$1" | tail -n "$2" - fi -} - - -# edit `regex` command in $EDITOR, then run it -re() { - if [ -z "$1" ]; then - fc -e "$EDITOR" - else - local index="$(fc -l 0 | grep "$1" | tail -n 1 | awk '{print $1}')" - fc -e "$EDITOR" $index - fi + if [ -n "$2"]; then + fc -n -l 0 | grep "$1" | tail -n 20 + else + fc -n -l 0 | grep "$1" | tail -n "$2" + fi }