initial stuff

This commit is contained in:
Erik Stambaugh 2024-06-11 10:12:11 -07:00
commit e4a77209ed
5 changed files with 626 additions and 0 deletions

51
.alacritty.toml Normal file
View file

@ -0,0 +1,51 @@
[colors.bright]
black = "#666666"
blue = "#7aa6da"
cyan = "#70c0b1"
green = "#49fa3a"
magenta = "#c377d8"
red = "#d54e53"
white = "#eaeaea"
yellow = "#e7c547"
[colors.cursor]
cursor = "#ff9900"
text = "#ff9900"
[colors.dim]
green = "#47bc34"
[colors.normal]
black = "#1d1f21"
blue = "#6182be"
cyan = "#6abeb7"
green = "#65ed58"
magenta = "#b274bb"
red = "#cc4444"
white = "#c5c8c6"
yellow = "#f0c654"
[cursor.style]
blinking = "Always"
shape = "Block"
[env]
TERM = "xterm-256color"
[font]
builtin_box_drawing = true
size = 11.0
[font.normal]
family = "Hack Nerd Font"
[[keyboard.bindings]]
action = "Paste"
key = "Insert"
mods = "Shift"
[selection]
save_to_clipboard = true
[window]
startup_mode = "Maximized"

303
.bashrc Normal file
View file

@ -0,0 +1,303 @@
# how about unfucking the terminal
case "$TERM" in
rxvt-cygwin-native)
TERM=rxvt
;;
esac
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
HISTSIZE=100000
HISTFILESIZE=200000
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
## enable programmable completion features (you don't need to enable
## this, if it's already enabled in /etc/bash.bashrc and /etc/profile
## sources /etc/bash.bashrc).
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
# . /etc/bash_completion
#fi
############# my stuff
#if [ -z "$SSH_AUTH_SOCK" ] ; then
# eval `ssh-agent`
# ssh-add
#fi
USER=`whoami`
PATH="$(echo ~)/bin:$PATH:$(echo ~)/apps/bin"
# I like to know if this shell is the child of an editor
PARENTPROC=$(ps -o command= -c $PPID 2>/dev/null)
PARENTSTR=""
GLYPH_VIM=""
GLYPH_PRE=""
GLYPH_SEP=""
GLYPH_JOB=""
GLYPH_JOB=""
GLYPH_EXIT=""
COLOR_VIM="255 255 64"
COLOR_BG="70 70 70"
ANSI_RESET="\001\033[0m\002"
fgcolor() {
echo "\001\033[38;2;${1};${2};${3}m\002"
}
bgcolor() {
echo "\001\033[48;2;${1};${2};${3}m\002"
}
if [[ $PARENTPROC == 'vim' ]] || [[ $PARENTPROC == 'view' ]]; then
PARENTSTR="$(bgcolor $COLOR_BG)$(fgcolor $COLOR_VIM) ${GLYPH_VIM} ${ANSI_RESET}$(fgcolor $COLOR_BG)${GLYPH_SEP} ${ANSI_RESET}"
fi
SHELLUSER=$USER
if [ "$SHELLUSER" == 'erikstambaugh' ]; then
SHELLUSER=es
fi
pwaws() {
grep aws ~/passwords | tail -1 | sed -e 's/.* //'| pbcopy
}
pw365() {
grep 365 ~/passwords | tail -1 | sed -e 's/.* //'| pbcopy
}
ps1_jobs() {
J=$(jobs)
if [[ -n $J ]]; then
echo -ne "\001\033[38;2;192;192;64m\002\001\033[38;2;64;64;64m\033[48;2;192;192;64m\002${GLYPH_JOB} \001\033[0m\033[38;2;192;192;64m\002\001\033[0m\002 "
fi
}
ps1_git() {
BRANCH=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //' | cut -c 1-25)
[[ $(echo $BRANCH | wc -c) -ge 15 ]] && BRANCH=${BRANCH}"⋯"
if [[ -n $BRANCH ]]; then
if [[ -z $(git status --porcelain) ]]; then
echo -e "\001\033[38;2;0;64;128m\002\001\033[38;2;255;192;128m\033[48;2;0;64;128m\002 ${BRANCH}\001\033[0m\033[38;2;0;64;128m\002\001\033[0m\002 "
else
echo -e "\001\033[38;2;128;0;92m\002\001\033[38;2;255;255;192m\033[48;2;128;0;92m\002 ${BRANCH}\001\033[0m\033[38;2;128;0;92m\002\001\033[0m\002 "
#echo "$(fgcolor 128 0 92)$(fgcolor 255 255 192)$(bgcolor 128 0 92) ${BRANCH}${ANSI_RESET}\033[38;2;128;0;92m\002\001\033[0m\002 "
fi
fi
}
# 
# 
# 
# 
# 
# x
# 
# 
# 
# 
# 
# 
# 
ps1_exitstr() {
EC=$?
if [[ $EC -ne 0 ]]; then
#echo -ne "$(fgcolor 192 0 0)${GLYPH_PRE}$(fgcolor 0 0 0)$(bgcolor 192 0 0)${GLYPH_EXIT} $?${ANSI_RESET}$(fgcolor 192 0 0)${GLYPH_SEP} "
echo -ne "\001\033[38;2;192;0;0m\002${GLYPH_PRE}\001\033[38;2;0;0;0m\033[48;2;192;0;0m\002${GLYPH_EXIT}\001\033[38;2;255;255;255m\002 ${EC}\001\033[0m\033[38;2;192;0;0m\002${GLYPH_SEP} "
fi
}
ps1_path() {
#pwd | sed -e 's/.*\/work\/tickets/⋯/' -e "s/$(echo $HOME | sed -e 's/\//\\\//g')/~/"
#pwd | sed -e 's/.*\/work\/tickets/ /' -e "s/$(echo $HOME | sed -e 's/\//\\\//g')/~/"
pwd | sed -e 's/.*\/work\/tickets\/*/ /' -e "s/$(echo $HOME | sed -e 's/\//\\\//g')/~/" -e 's/\([^ ]\)$/\1\//'
}
if [ $USER == 'erik' ] || [ $USER == 'erikstambaugh' ]; then
PS1="${PARENTSTR}\$(ps1_exitstr)\$(ps1_jobs)"'$(ps1_git)'"$(fgcolor 0 192 255)${SHELLUSER}@\h:$(fgcolor 0 255 127)\$(ps1_path)${ANSI_RESET}\$ "
elif [ $USER == 'root' ]; then
PS1="${PARENTSTR}\$(ps1_exitstr)\$(ps1_jobs)"'$(ps1_git)'"$(fgcolor 255 72 64)${SHELLUSER}@\h:$(fgcolor 0 255 127)\$(ps1_path)${ANSI_RESET}# "
# PS1="${PARENTSTR}"'$(ps1_exitstr)$(ps1_git)'"\[$(fgcolor 255 72 64)\]${SHELLUSER}@\h:\[$(fgcolor 0 255 127)\]\w\[${ANSI_RESET}\]# "
else
PS1="${PARENTSTR}\$(ps1_exitstr)\$(ps1_jobs)"'$(ps1_git)'"$(fgcolor 255 255 0)${SHELLUSER}@\h:$(fgcolor 0 255 127)\$(ps1_path)${ANSI_RESET}\$ "
# PS1="${PARENTSTR}"'$(ps1_exitstr)$(ps1_git)'"\[$(fgcolor 255 255 0)\]${SHELLUSER}@\h:\[$(fgcolor 0 255 0)\]\w\[${ANSI_RESET}\]\$ "
fi
#export PS1 PATH LD_LIBRARY_PATH
EDITOR=vim
LANG=en_US.UTF-8
export PS1 PATH HISTSIZE HISTFILESIZE EDITOR LANG
if [ -e /usr/local/bin/gls ]; then
alias ls='/usr/local/bin/gls --color=auto'
else
alias ls='ls --color=auto'
fi
alias sagi='sudo apt-get install'
for LOCALPROFILE in /home/$USER/.bash_local_profile /Users/$USER/.bash_local_profile; do
if [ -e $LOCALPROFILE ]; then
. $LOCALPROFILE
fi
done
# let's fix sorting once and for all
export LC_COLLATE=C
# tab complete known hosts
# http://mybrainhurts.com/blog/2008/11/ssh-tab-completion-on-knownhosts.html
# requires: HashKnownHosts no
SSH_COMPLETE=( $(cat ~/.ssh/known_hosts 2>/dev/null | cut -f 1 -d " " | \sed -e s/,.*//g | uniq ) ) complete -o default -W "${SSH_COMPLETE[*]}" ssh
set -o vi
ccc() {
tmux new-window "_ccc $@"
}
_ccc() {
HOSTS=$(echo $@ | sed -e 's/ -- .*//')
ARGS="$(echo $@ | grep -q -- ' -- ' && echo $@ | sed -e 's/.* -- //')"
for I in $HOSTS; do
tmux splitw "ssh $ARGS $I"
sleep 0.1
tmux select-layout tiled
done
tmux set-window-option synchronize-panes on
exit
}
# http://stackoverflow.com/a/10660730
rawurlencode() {
local string="$@"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
BROWSER=$(which links2 2>/dev/null || which links 2>/dev/null || which w3m 2>/dev/null || which lynx 2>/dev/null || echo "echo NO BROWSER:")
google() {
GOOGLE_Q=$(rawurlencode "$@")
URL="https://www.google.com/search?q=${GOOGLE_Q}"
CMD="$BROWSER $URL"
$CMD
echo $CMD
}
trivia() {
LINE=
while [[ -z $LINE ]]; do
LINE=$(curl -s -L https://en.wikipedia.org/wiki/Special:Random?action=raw \
| grep -E '^[0-9a-zA-Z]' \
| head -1 \
| sed -E \
-e "s/'''//g" `# triple quotes ` \
-e 's/\[\[([^]]+\|)?([^]]+)\]\]/\2/g' `# replace links with their name ` \
-e 's/\{\{[^\}]+\}\}//g' `# remove double-curly blocks ` \
-e 's/\[\[|\]\]//g' `# strip any remaining link marks ` \
-e 's/\([^)]+\)//g' `# remove parentheticals ` \
-e "s/''//g" `# strip double-quotes ` \
-e 's/<[^>]+>//g' `# remove HTML/XML tags ` \
-e 's/\[[^]]*\]//g' `# remove double-square blocks` \
-e 's/\. .*//' `# cut down to first sentence (hopefully) ` \
-e 's/ +,/,/g' `# fix spaces before commas; wtf people ` \
-e 's/ +/ /g' `# fix double spaces ` \
)
done
QUESTION=$(echo "$LINE" | sed -E -e 's/(.*) [^ ]+$/\1 ___?/')
ANSWER=$(echo "$LINE" | sed -E -e 's/.* ([^ ]+)$/\1/')
echo -n "$QUESTION "
read A
if [[ $(echo $A | tr A-Z a-z | sed -e 's/[^a-z0-9]//g') == $(echo $ANSWER | tr A-Z a-z | sed -e 's/[^a-z0-9]//g') ]]; then
echo "Correct."
else
echo -e "Wrong. The answer is: $ANSWER"
fi
}
old_trivia() {
LINE=$(curl -s -L https://en.wikipedia.org/wiki/Special:Random \
| grep '^<p' \
| sed -E \
-e 's/<[^>]*>//g' `# strip HTML tags ` \
-e 's/^ +//' `# leading spaces` \
-e 's/ +$//' `# trailing spaces` \
| grep -v '^$' \
| head -1 \
| sed -E \
-e 's/\&[^;]+//' `# &amp; etc. ` \
-e 's/^[^0-9a-zA-Z]+//' `# leading non-alnum` \
-e 's/ *\([^)]+\)//g' `# parentheticals` \
-e 's/ *\[[^]]*\]//g' `# square braces` \
-e 's/\. .*//' `# everything past first sentence` \
| grep -v '^$' \
| head )
QUESTION=$(echo "$LINE" | sed -E -e 's/(.*) [^ ]+$/\1 ___?/')
ANSWER=$(echo "$LINE" | sed -E -e 's/.* ([^ ]+)$/\1/')
echo -n "$QUESTION "
read A
if [[ $(echo $A | tr A-Z a-z | sed -e 's/[^a-z0-9]//g') == $(echo $ANSWER | tr A-Z a-z | sed -e 's/[^a-z0-9]//g') ]]; then
echo "Correct."
else
echo -e "Wrong. The answer is: $ANSWER"
fi
}
termpipe() {
PIPE=$(mktemp -u)
mkfifo $PIPE
xterm -e less -f $PIPE &
cat >$PIPE
rm $PIPE
}

5
.gitconfig Normal file
View file

@ -0,0 +1,5 @@
[user]
email = erik@erikstambaugh.com
name = Erik Stambaugh
[init]
defaultBranch = main

122
.tmux.conf Executable file
View file

@ -0,0 +1,122 @@
# A lot of this depends on a nerd-font being installed:
# https://github.com/ryanoasis/nerd-fonts
set -g default-terminal "screen-256color"
set -g status-interval 5
set-option -g history-limit 10000
# force truecolor
set-option -ga terminal-overrides ",xterm-256color:Tc"
bind-key e setw synchronize-panes on
bind-key E setw synchronize-panes off
bind-key C-b last-window
bind-key b send-prefix
bind-key c new-window -c "#{pane_current_path}"
bind-key C-c new-window -c "#{pane_current_path}"
bind-key C new-window
# lots of this was snagged from https://github.com/midnightcodr/my_tmux_conf/blob/master/.tmux.conf
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
bind C-j split-window -f -v -l 10 -c "#{pane_current_path}"
bind C-l split-window -f -h -l 30 -c "#{pane_current_path}"
#bind -r ^ resize-pane -U 5
#bind -r < resize-pane -L 1
#bind -r > resize-pane -R 1
#bind -r + resize-pane -U 1
#bind -r - resize-pane -D 1
bind-key -r -T prefix + resize-pane -U 1
bind-key -r -T prefix - resize-pane -D 1
bind-key -r -T prefix < resize-pane -L 1
bind-key -r -T prefix > resize-pane -R 1
bind-key -r -T prefix ^ resize-pane -U 1
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
bind-key M-Up resize-pane -U 10
bind-key M-Down resize-pane -D 10
bind-key M-Left resize-pane -L 10
bind-key M-Right resize-pane -R 10
#bind-key -r -T prefix C-Up resize-pane -U
#bind-key -r -T prefix C-Down resize-pane -D
#bind-key -r -T prefix C-Left resize-pane -L
#bind-key -r -T prefix C-Right resize-pane -R
# Set status bar
set-option -g status-bg "#112233"
set -g status-fg "#009900"
set -g status-left '#[bg=colour31,fg=colour255] #h #[fg=colour31,bg=#112233] '
#set -g status-right '#[fg=colour88] #[fg=colour206,bg=colour88] #(cut -d" " -f1-3 /proc/loadavg) #[fg=colour135]#[fg=colour15,bg=colour135] %m/%d %H:%M '
#set -g status-right '#[fg=colour88] #[fg=colour206,bg=colour88] #(uptime | sed -e "s/.*: //" -e "s/,//g") #[fg=colour135]#[fg=colour15,bg=colour135] %m/%d %H:%M '
#set -g status-right '#[fg=colour57] #[fg=colour206,bg=colour57] #(uptime | sed -e "s/.*: //" -e "s/,//g") #[fg=colour135]#[fg=colour15,bg=colour135] %m/%d %H:%M '
#iset -g status-right '#[fg=colour54] #[fg=colour205,bg=colour54] #(printf "%%-3s" `test -e ~/bin/pomodoro && pomodoro status -c`) #[fg=colour57] #[fg=colour140,bg=colour57] #(uptime | sed -e "s/.*: //" -e "s/,//g") #[fg=colour135]#[fg=colour15,bg=colour135] %m/%d %H:%M '
#set -g status-right '#[fg=#660044] #[fg=colour205,bg=#660044] #(printf "%%-3s" `test -e ~/bin/pomodoro && pomodoro status -c`) #[fg=#663399] #[fg=colour140,bg=#663399] #(uptime | sed -e "s/.*: //" -e "s/,//g") #[fg=#9933cc]#[fg=colour15,bg=#9933cc] %m/%d %H:%M '
#set -g status-right '#[fg=#660044] #[fg=colour205,bg=#660044] #(printf "%%-3s" `test -e ~/bin/pomodoro && pomodoro status -c`) #[fg=#552288] #[fg=colour140,bg=#552288] #(test -e ~/bin/tmux-diskmon && tmux-diskmon) #[fg=#663399] #[fg=colour140,bg=#663399] #(uptime | sed -e "s/.*: //" -e "s/,//g" -e "s/ 0\./ ./g" -e "s/^0//") #[fg=#7744aa]#[fg=colour15,bg=#7744aa] %m/%d %H:%M '
set -g status-right '#[fg=#2a2a2a] #[fg=colour205,bg=#2a2a2a] #(printf "%%-3s" `test -e ~/bin/pomodoro && pomodoro status -c`) #[fg=#223388] #[fg=colour140,bg=#223388] #(test -e ~/bin/tmux-diskmon && tmux-diskmon)#[fg=#334499] #[fg=colour140,bg=#334499] #(uptime | sed -e "s/.*: //" -e "s/,//g" -e "s/ 0\./ ./g" -e "s/^0//" -e "s/\\.00/0/g") #[fg=#4455aa]#[fg=colour15,bg=#4455aa] %m/%d %H:%M '
set -g status-right-length 60
set -g status-left-length 40
if-shell "uname | grep -q Darwin" "set -g status-left '#[bg=#77ddaa,fg=colour0]  #h #[fg=#77ddaa,bg=#112233] '"
if-shell "uname | grep -q Linux" "set -g status-left '#[bg=colour31,fg=colour255]  #h #[fg=colour31,bg=#112233] '"
#if-shell "lsb_release -si | grep -q Ubuntu" "set -g status-left '#[bg=colour130,fg=colour255]  #h #[fg=colour130,bg=#112233] '"
if-shell "lsb_release -si | grep -q Ubuntu" "set -g status-left '#[bg=colour130,fg=colour255]  #h #[fg=colour130,bg=#112233] '"
if-shell "lsb_release -si | grep -q Raspbian" "set -g status-left '#[bg=#ff0066,fg=colour255]  #h #[fg=#ff0066,bg=#112233] '"
#if-shell "hostname | grep -q lechuck" "set -g status-left '#[bg=colour094,fg=colour255] ☠ #h #[fg=colour094,bg=#112233] '"
#if-shell "hostname | grep -q meathook" "set -g status-left '#[bg=colour021,fg=colour255] ☠ #h #[fg=colour021,bg=#112233] '"
#if-shell "hostname | grep -q lechuck" "set -g status-left '#[bg=colour094,fg=colour255]  #h #[fg=colour094,bg=#112233] '"
#if-shell "hostname | grep -q lechuck" "set -g status-left '#[bg=#996633,fg=colour255]  #h #[fg=#996633,bg=#112233] '"
if-shell "hostname | grep -q lechuck" "set -g status-left '#[bg=#996633,fg=colour255]☠ #h #[fg=#996633,bg=#112233] '"
#if-shell "hostname | grep -q meathook" "set -g status-left '#[bg=colour021,fg=colour255]  #h #[fg=colour021,bg=#112233] '"
#if-shell "hostname | grep -q meathook" "set -g status-left '#[bg=#1111ff,fg=colour255]  #h #[fg=#1111ff,bg=#112233] '"
if-shell "hostname | grep -q meathook" "set -g status-left '#[bg=#1111ff,fg=colour255]👻 #h #[fg=#1111ff,bg=#112233] '"
## 24 bit stuff
#set -g default-terminal "xterm-256color"
#set -ga terminal-overrides ",xterm-256color:Tc"
# Highlight active window
#set-window-option -g window-status-current-fg colour46
#set-window-option -g window-status-current-attr bright
#set-window-option -g window-status-current-format "#[bg=colour232,fg=#112233] #[bg=colour232,fg=colour10]#I:#W #[bg=#112233,fg=colour232]"
set-window-option -g window-status-current-format "#[bg=#000011,fg=#112233] #[bg=#000011,fg=#bbffbb]#I:#W #[bg=#112233,fg=#000011]"
set-window-option -g window-status-format "#I:#W "
#set-window-option -g window-status-last-format "#[bg=colour232,fg=colour234] #[bg=colour232,fg=colour10]#I:#W #[bg=colour234,fg=colour232]"
# Inactive windows get low-contrast; active window sharper
#set -g window-active-style 'fg=colour255,bg=default'
set -g window-style 'fg=colour246,bg=#152030'
set -g window-active-style 'fg=colour255,bg=black'
# Automatically set window title
set-option -g set-titles on
setw -g automatic-rename off
set-option -g set-titles-string "#h: #W"
set-option -g allow-rename off
setw -g monitor-activity off
set -g visual-activity on
# vi key bindings
setw -g mode-keys vi
#bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
# moving panes around - http://unix.stackexchange.com/questions/14300/moving-tmux-window-to-pane
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"

145
bin/lb Executable file
View file

@ -0,0 +1,145 @@
#!/bin/bash
COLOR_DIR="\033[38;5;39m"
COLOR_DIRMARK="\033[38;5;242m"
COLOR_QUIET="\033[38;5;238m"
COLOR_RESET="\033[0m"
PCT_COLORS="
90:\033[38;5;196m
80:\033[38;5;160m
70:\033[38;5;202m
60:\033[38;5;214m
50:\033[38;5;220m
40:\033[38;5;226m
30:\033[38;5;154m
20:\033[38;5;118m
10:\033[38;5;121m
5:\033[38;5;123m
"
function pad () {
LEN=$1
shift
OUT="$@"
OUTLEN=$(echo -n "$OUT" | wc -c)
while [ $OUTLEN -lt $LEN ]; do
OUT=" $OUT"
OUTLEN=$(( OUTLEN + 1 ))
done
echo -n "$OUT"
}
function pct () {
A=$(( $(( 1000 * $1 )) / $2 ))
B=$(( $A / 10 ))
C=$(( $A - $(( 10 * $B)) ))
for CC in $PCT_COLORS; do
THRESHOLD=$(echo $CC | sed -e 's/:.*//')
COLOR=$(echo $CC | sed -e 's/.*://')
if [ $B -ge $THRESHOLD ]; then
echo -n -e "$COLOR"
break
fi
done
pad 4 "$B.$C"
}
MAXDIVIDE=1073741824 # expressed as KB
DIVIDENAMES=( TB GB MB KB )
function humanizekb () {
AMT=$1
I=0
D=$MAXDIVIDE
while [ $AMT -lt $D ]; do
D=$(( D / 1024 ))
I=$(( I + 1 ))
done
echo -n "$(( AMT / D )) ${DIVIDENAMES[$I]}"
}
function getloc {
(
LOCATION=$1
INDENT=$2
SKIPCOUNT=0
pushd "$LOCATION" > /dev/null
while read ITEM; do
BYTES=$(du -skx "$ITEM" 2>/dev/null | awk '{print $1}')
test -z "$BYTES" && BYTES=0
WD_PCT=$(( $(( $(( 1000 * $BYTES )) / $BYTES_THISDIR )) / 10 ))
# only bother showing things that are >1% of wd
if [ $WD_PCT -ge 1 ]; then
ITEMTYPE=$(stat --format='%F' "$ITEM")
pad 7 $( humanizekb $BYTES )
echo -n " "
pct $BYTES $BYTES_THISDIR
echo -n "% wd"
echo -n -e "$COLOR_RESET"
echo -n ", "
pct $BYTES $BYTES_FS
echo -n "% fs"
echo -n -e "$COLOR_RESET, "
echo -n "$INDENT"
test -z "$INDENT" || echo -ne "${COLOR_DIRMARK}↳ ${COLOR_RESET}"
if [ "$ITEMTYPE" == "directory" ]; then
echo -ne "${COLOR_DIR}${ITEM}${COLOR_RESET}"
echo "/"
if [ $WD_PCT -ge 5 ]; then
getloc "$ITEM" "$INDENT "
fi
else
echo -n "$ITEM"
echo
fi
else
SKIPCOUNT=$(( SKIPCOUNT + 1 ))
fi
done < <( find . -maxdepth 1 -type d|grep -v ^\\.\$ |sort|sed 's/^\.\///'; ls -lrSh | grep ^- | sed -E -e 's/^([^ ]+ +){8}//' )
# pad 33 ""
# echo -e "${COLOR_QUIET}${INDENT}(${SKIPCOUNT} skipped)${COLOR_RESET}"
popd > /dev/null
)
}
BYTES_THISDIR=$(du -sk . 2>/dev/null | awk '{print $1}')
BYTES_FS=$(df -k . | tail -1 | awk '{print $2}')
getloc '.' ''