config

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

commit e120f569fec4d2c1a9bbbb0dd5d1285e47d8c246
parent 74c1ef640fcb9ae8830af15e61b3fd7b45402085
Author: jacob@nzxt <jacobouno@protonmail.com>
Date:   Tue, 14 Apr 2020 09:43:24 -0700

remove some aliases/functions, add some aliases/functions, sort ALL aliases/functions

Diffstat:
Maliases/.aliases | 150++++++++++++++++++++++++++++++++++++++-----------------------------------------
1 file changed, 73 insertions(+), 77 deletions(-)

diff --git a/aliases/.aliases b/aliases/.aliases @@ -1,41 +1,39 @@ -# vim filetype=sh - -# sources +# soure private aliases [ -f "$HOME/.aliases-private" ] && source "$HOME/.aliases-private" -[ -f "/home/$USER/.config/broot/launcher/bash/br" ] && source "/home/$USER/.config/broot/launcher/bash/br" -# GNU Coreutils / Basic Utilities +# default arguments +# sys alias startx="startx ~/.xinitrc" -alias pkill="pkill -x" alias sudo="sudo -E " -alias doas="doas -- " -alias grep="grep --color" -alias ls="ls --color=always" -alias tmux="tmux -u" +alias pkill="pkill -x" alias suspend="systemctl suspend" alias hibernate="systemctl hibernate" +# core +alias grep="egrep --color" alias sed="sed -E" - -# program extentions -alias pacman="pacman-wrapper" - -# locations -alias rs="cd ~/own/projects/rust-learning/" -alias logs="cd ~/own/text/logs/" -alias suck="cd ~/src/suckless/" - +alias tmux="tmux -u" +alias ls="ls --color=always" # etc -alias glava="glava &" +alias mpv="mpv --no-input-default-bindings" alias ncmpcpp="ncmpcpp -q" -alias screenshots="sxiv -t ~/media/screenshots/" +alias glava="glava &" -# add arguments -alias mpv="mpv --no-input-default-bindings" -# shortcuts/renaming +# rename alias meta="exiftool" alias vim="nvim" -alias gwg="xdotool getwindowgeometry "$( xdotool getactivewindow )"" +alias gwg='xdotool getwindowgeometry "$(xdotool getactivewindow)"' + + +# shorten +alias sys="systemctl" +alias ra="ranger" +alias pa="pacman" +alias nv="nvim" +alias l="$PAGER" +alias k="locate-edit" +alias s="doas -u $USER -- " + # git alias gd="git add . ; git diff --cached" @@ -45,21 +43,33 @@ alias gp="git push" alias gf="git pull" alias grs="git remote show" -# 1-3 char -alias exe="chmod +x *py" -alias sys="systemctl" -alias ra="ranger" -alias pa="pacman" -alias nv="nvim" -alias l="$PAGER" -alias k="locate-edit" +# location +alias rs="cd ~/own/projects/rust-learning/" +alias logs="cd ~/own/text/logs/" +alias s="cd ~/src/suckless/" + + +# extention +alias pacman="pacman-wrapper" -## one linefunctions +## one-line functions # delay execution of command by input * 60 seconds (must quote command) -t(){ sleep $( calc -d "$1" \* 60 ) ; $2 ;} +t(){sleep $(calc -d "$1" \* 60); $2 ;} + +# start tmux automaticly on ssh +ssh(){ /usr/bin/ssh -t "$@" "tmux a || tmux new" ;} + + + +## multi-line functions +# get working directory +wd(){ + local home="$(printf $HOME | sed -E 's/\//\\\//g')" + pwd | sed "s/$home/~/g" +} # find and edit fe(){ @@ -72,24 +82,7 @@ else fi } -# dictinary search -ds(){ curl "dict://dict.org/m:$1" ;} - -# dictionary define -d(){ curl "dict://dict.org/d:$1" ;} - -# get working directory -wd(){ - local home="$(printf $HOME | sed -E 's/\//\\\//g')" - pwd | sed "s/$home/~/g" -} - -# start tmux automaticly -ssh(){ /usr/bin/ssh -t "$@" "tmux a || tmux new" ;} - - -## multiline functions -# test if you can connect to host +# try connecting to host is_up(){ if [ "$( ping -c 1 -W 1.2 "$1" | tail -n 2 | head -n 1 | cut -d ',' -f 2 | awk '{print $1}' )" -ne 0 ]; then printf "$1 is up.\n" @@ -98,12 +91,14 @@ is_up(){ fi } -# -# open today's note +# 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 + if ! [ "$time" -gt 0 -a "$time" -lt 600 ]; then + date="$( date +%Y/%m/%d)" + else date="$(date +%Y/%m)/" day="$( expr "$(date +%d)" - 1 )" @@ -112,9 +107,6 @@ daily(){ else date="$date/$day" fi - - else - date="$( date +%Y/%m/%d)" fi if [ ! -e "$NOTES/daily/$date" ]; then @@ -126,11 +118,31 @@ daily(){ 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 +} + +# 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 +} + +# 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 +} -## history functions +## history functions # history search hs(){ if [ -n "$2"]; then @@ -159,22 +171,6 @@ re(){ fi } -# take snapshot in given video at given time -snap() { - ffmpeg -ss $2 -i $1 -loglevel 8 -frames:v 1 $3 -} -grayscale() { - ffmpeg -i $1 -vf format=gray $2 -} -# 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 -} -# 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 -} +# vim filetype=sh