Skip to content

Commit dfc0b5c

Browse files
committed
2024-04-27
1 parent f6d51a0 commit dfc0b5c

14 files changed

+387
-23
lines changed

.bash_aliases

+8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ alias mount_ui01fs='sshfs -o idmap=user eddaviso@hunt-ui-01.clg5.amp.ciscolabs.c
8787
# local directory aliases
8888
alias cd-ci="cd /opt/Data/Cisco"
8989
alias cd-ne="cd /opt/Data/Personal/NextCloud"
90+
alias cd-it="cd /opt/Data/Personal/NextCloud/Documents/IT"
91+
alias cd-fi="cd /opt/Data/Personal/NextCloud/Documents/Finance"
92+
alias cd-acct="cd /opt/Data/Personal/NextCloud/Documents/Finance/accounting"
93+
alias cd-itc="cd /opt/Data/Personal/NextCloud/Documents/IT\ Clients"
94+
alias cd-rpg="cd /opt/Data/Personal/NextCloud/Documents/IT\ Clients/RPG"
9095
alias cd-so="cd /opt/Data/Software"
9196

9297
#alias tmux="tmux -u"
@@ -109,5 +114,8 @@ alias dprunesys='docker system prune --all'
109114

110115

111116
alias lth='ls -alt | head'
117+
alias llt='ls -alt'
112118
alias lthh='ls -alth | head'
113119

120+
alias dm='sudo dmesg --time-format iso'
121+

.bash_profile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# .bash_profile
22
# User specific environment and startup programs
33

4-
export PATH=$PATH:$HOME/bin:$HOME/.local/bin:$HOME/.cargo/bin
4+
export PATH=$PATH:$HOME/bin:$HOME/.local/bin:$HOME/.cargo/bin:/opt/Data/Software/flutter/bin
5+
export GRASS_PYTHON=/usr/bin/python3
6+
export EDITOR=/usr/bin/vim
57

68
# Get the aliases and functions
79
if [ -f ~/.bashrc ]; then

.bashrc

+19-9
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ PROMPT_COMMAND="_update_ps1; history -a; history -c; history -r; ${PROMPT_COMMAN
179179
# setup atuin (history search from SQLITE DB)
180180
# curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh
181181
# echo '[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh' >> ~/.bashrc
182-
eval "$(atuin init bash)"
182+
#eval "$(atuin init bash)"
183183

184184

185185
# if test -n "$DESKTOP_SESSION"
@@ -216,14 +216,24 @@ alias dprune='docker image prune'
216216

217217
export LIBVA_DRIVER_NAME=iHD
218218

219-
PATH="/home/edavison/perl5/bin${PATH:+:${PATH}}"; export PATH;
220-
PERL5LIB="/home/edavison/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
221-
PERL_LOCAL_LIB_ROOT="/home/edavison/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
222-
PERL_MB_OPT="--install_base \"/home/edavison/perl5\""; export PERL_MB_OPT;
223-
PERL_MM_OPT="INSTALL_BASE=/home/edavison/perl5"; export PERL_MM_OPT;
219+
PATH="${PATH:+:${PATH}}"; export PATH;
220+
export PATH=$PATH:$HOME/bin
224221

225222
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
226223

227-
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
228-
export PATH=$PATH:$JAVA_HOME/bin
229-
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
224+
#export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
225+
#export PATH=$PATH:$JAVA_HOME/bin:$HOME/bin
226+
#export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
227+
228+
229+
# User specific aliases and functions
230+
if [ -d ~/.bashrc.d ]; then
231+
for rc in ~/.bashrc.d/*; do
232+
if [ -f "$rc" ]; then
233+
. "$rc"
234+
fi
235+
done
236+
fi
237+
238+
unset rc
239+

.bashrc.d/ssh-find-agent.bashrc

+258
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
4+
#
5+
# Released under one of the versions of the MIT License.
6+
#
7+
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
8+
#
9+
# Permission is hereby granted, free of charge, to any person obtaining a copy
10+
# of this software and associated documentation files (the "Software"), to deal
11+
# in the Software without restriction, including without limitation the rights
12+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
# copies of the Software, and to permit persons to whom the Software is
14+
# furnished to do so, subject to the following conditions:
15+
#
16+
# The above copyright notice and this permission notice shall be included in
17+
# all copies or substantial portions of the Software.
18+
#
19+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
# THE SOFTWARE.
26+
27+
sfa_init() {
28+
_ssh_agent_sockets=()
29+
_live_agent_list=()
30+
_live_agent_sock_list=()
31+
_sorted_live_agent_list=()
32+
33+
# Set $sfa_path array to the dirs to search for ssh-agent sockets
34+
sfa_set_path
35+
36+
if ! command -v 'timeout' &>/dev/null; then
37+
printf "ssh-find-agent.sh: 'timeout' command could not be found.\n"
38+
printf " Please install 'coreutils' via your system's package manager.\n"
39+
fi
40+
}
41+
42+
# Allow users to override the default path to search for ssh-agent sockets
43+
# The first of the variable found is used to set the path:
44+
# SSH_FIND_AGENT_PATH (colon separated dir list)
45+
# _TMPDIR_OVERRIDE for legacy compatibility
46+
# TMPDIR (if set) (plus /tmp due to ssh bug)
47+
sfa_set_path() {
48+
sfa_path=()
49+
if [[ -n "$SSH_FIND_AGENT_PATH" ]]; then
50+
IFS=':' read -r -a sfa_path <<<"$SSH_FIND_AGENT_PATH"
51+
else
52+
# Maintain backwards compatibility with the old _TMPDIR_OVERRIDE variable
53+
if [[ -n "$_TMPDIR_OVERRIDE" ]]; then
54+
sfa_path=("$_TMPDIR_OVERRIDE")
55+
else
56+
if [[ -n "$TMPDIR" ]]; then
57+
sfa_path=("/tmp" "$TMPDIR")
58+
else
59+
sfa_path=("/tmp")
60+
fi
61+
fi
62+
fi
63+
}
64+
65+
sfa_err() {
66+
# shellcheck disable=SC2059
67+
printf "$@" 1>&2
68+
}
69+
70+
sfa_debug() {
71+
if ((_DEBUG > 0)); then
72+
sfa_err "$@" 1>&2
73+
fi
74+
}
75+
76+
sfa_find_all_agent_sockets() {
77+
_ssh_agent_sockets=$(
78+
find "${sfa_path[@]}" -maxdepth 2 -type s -name agent.\* 2>/dev/null | grep '/ssh-.*/agent.*'
79+
find "${sfa_path[@]}" -maxdepth 2 -type s -name S.gpg-agent.ssh 2>/dev/null | grep '/gpg-.*/S.gpg-agent.ssh'
80+
find "${sfa_path[@]}" -maxdepth 2 -type s -name ssh 2>/dev/null | grep '/keyring-.*/ssh$'
81+
find "${sfa_path[@]}" -maxdepth 2 -type s -regex '.*/ssh-.*/agent..*$' 2>/dev/null
82+
)
83+
sfa_debug "$_ssh_agent_sockets"
84+
}
85+
86+
sfa_test_agent_socket() {
87+
local socket=$1
88+
local output
89+
output=$(SSH_AUTH_SOCK=$socket timeout 0.4 ssh-add -l 2>&1)
90+
result=$?
91+
92+
[[ "$output" == "error fetching identities: communication with agent failed" ]] && result=2
93+
sfa_debug $result
94+
95+
case $result in
96+
0 | 1 | 141)
97+
# contactible and has keys loaded
98+
{
99+
OIFS="$IFS"
100+
IFS=$'\n'
101+
# shellcheck disable=SC2207
102+
_keys=($(SSH_AUTH_SOCK=$socket ssh-add -l 2>/dev/null))
103+
IFS="$OIFS"
104+
}
105+
_live_agent_list+=("${#_keys[@]}:$socket")
106+
return 0
107+
;;
108+
2 | 124)
109+
# socket is dead, delete it
110+
sfa_err 'socket (%s) is dead, removing it.\n' "$socket"
111+
sfa_debug "rm -rf ${socket%/*}"
112+
rm -rf "${socket%/*}"
113+
;;
114+
125 | 126 | 127)
115+
sfa_err 'timeout returned <%s>\n' "$result" 1>&2
116+
;;
117+
*)
118+
sfa_err 'Unknown failure timeout returned <%s>\n' "$result" 1>&2
119+
;;
120+
esac
121+
122+
case $result in
123+
0 | 1)
124+
_live_agent_list+=("$_key_count:$socket")
125+
return 0
126+
;;
127+
esac
128+
129+
return 1
130+
}
131+
132+
sfa_verify_sockets() {
133+
for i in $_ssh_agent_sockets; do
134+
sfa_test_agent_socket "$i"
135+
done
136+
}
137+
138+
sfa_fingerprints() {
139+
local file="$1"
140+
while read -r l; do
141+
[[ -n "$l" && ${l##\#} = "$l" ]] && ssh-keygen -l -f /dev/stdin <<<"$l"
142+
done <"$file"
143+
}
144+
145+
sfa_print_choose_menu() {
146+
# find all the apparent socket files
147+
# the sockets go into $_ssh_agent_sockets[]
148+
sfa_find_all_agent_sockets
149+
150+
# verify each socket, discarding if dead
151+
# the live sockets go into $_live_agent_list[]
152+
sfa_verify_sockets
153+
sfa_debug '<%s>\n' "${_live_agent_list[@]}"
154+
155+
# shellcheck disable=SC2207
156+
IFS=$'\n' _sorted_live_agent_list=($(sort -u <<<"${_live_agent_list[*]}"))
157+
unset IFS
158+
159+
sfa_debug "SORTED:\n"
160+
sfa_debug ' <%s>\n' "${_sorted_live_agent_list[@]}"
161+
162+
local i=0
163+
local sock
164+
165+
for agent in "${_sorted_live_agent_list[@]}"; do
166+
i=$((i + 1))
167+
sock=${agent/*:/}
168+
if [[ "$1" = "-i" ]]; then
169+
_live_agent_sock_list[$i]=$sock
170+
171+
printf '#%i)\n' "$i"
172+
printf ' export SSH_AUTH_SOCK=%s\n' "$sock"
173+
# Get all the forwarded keys for this agent, parse them and print them
174+
SSH_AUTH_SOCK=$sock ssh-add -l 2>&1 |
175+
grep -v 'error fetching identities for protocol 1: agent refused operation' |
176+
while IFS= read -r key; do
177+
parts=("$key")
178+
key_size="${parts[0]}"
179+
fingerprint="${parts[1]}"
180+
remote_name="${parts[2]}"
181+
key_type="${parts[3]}"
182+
printf ' %s %s\t%s\t%s\n' "$key_size" "$key_type" "$remote_name" "$fingerprint"
183+
done
184+
else
185+
printf '%s\n' "$sock"
186+
fi
187+
done
188+
}
189+
190+
sfa_set_ssh_agent_socket() {
191+
case $1 in
192+
-c | --choose)
193+
sfa_print_choose_menu -i
194+
195+
((0 == ${#_live_agent_list[@]})) && {
196+
sfa_err 'No agents found.\n'
197+
return 1
198+
}
199+
200+
read -p "Choose (1-${#_live_agent_sock_list[@]})? " -r choice
201+
if [ "$choice" -eq "$choice" ]; then
202+
[[ -z "${_live_agent_sock_list[$choice]}" ]] && {
203+
sfa_err 'Invalid choice.\n'
204+
return 1
205+
}
206+
printf 'Setting export SSH_AUTH_SOCK=%s\n' "${_live_agent_sock_list[$choice]}"
207+
export SSH_AUTH_SOCK=${_live_agent_sock_list[$choice]}
208+
fi
209+
;;
210+
-a | --auto)
211+
# Choose the last one, as they are sorted numerically by how many keys they have
212+
sock=$(sfa_print_choose_menu | tail -n -1)
213+
[[ -z "$sock" ]] && return 1
214+
sfa_debug 'export SSH_AUTH_SOCK=%s\n' "$sock"
215+
export SSH_AUTH_SOCK=$sock
216+
;;
217+
*)
218+
sfa_usage
219+
;;
220+
esac
221+
222+
# set agent pid - this is unreliable as the pid may be of the child rather than the agent
223+
if [ -n "$SSH_AUTH_SOCK" ]; then
224+
export SSH_AGENT_PID=$(($(basename "$SSH_AUTH_SOCK" | cut -d. -f2) + 1))
225+
fi
226+
227+
return 0
228+
}
229+
230+
sfa_usage() {
231+
sfa_err 'ssh-find-agent <[-c|--choose|-a|--auto|-h|--help]>\n'
232+
return 1
233+
}
234+
235+
# Renamed for https://github.com/wwalker/ssh-find-agent/issues/12
236+
ssh_find_agent() {
237+
sfa_init
238+
239+
case $1 in
240+
-c | --choose | -a | --auto)
241+
sfa_set_ssh_agent_socket "$1"
242+
return $?
243+
;;
244+
-l | --list)
245+
sfa_print_choose_menu -i
246+
;;
247+
*)
248+
sfa_usage
249+
;;
250+
esac
251+
}
252+
253+
# Original function name is still supported.
254+
# https://github.com/wwalker/ssh-find-agent/issues/12 points out that I
255+
# should use ssh_find_agent() for best compatibility.
256+
ssh-find-agent() {
257+
ssh_find_agent "$@"
258+
}

.config/i3/config

+7-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ floating_modifier $mod
4646

4747
# start a terminal
4848
#bindsym $mod+Return exec i3-sensible-terminal
49-
bindsym $mod+Return exec st -t "Simple Terminal" -f "Source Code Pro:style=Semibold:size=10"
49+
#bindsym $mod+Return exec st -t "Simple Terminal" -f "Source Code Pro:style=Semibold:size=10"
50+
bindsym $mod+Return exec xterm
5051

5152
# kill focused window
5253
bindsym $mod+Shift+q kill
@@ -235,17 +236,17 @@ exec_always feh --bg-fill /home/edavison/Pictures/screen.png
235236
#bindsym $mod+p move worksace to output right
236237

237238
exec --no-startup-id lxpolkit
238-
exec picom
239239

240240
# lock screen
241241
# https://michaelabrahamsen.com/posts/custom-lockscreen-i3lock/
242-
exec xautolock -detectsleep -time 5 -locker "/usr/local/bin/lock_and_blur.sh" -notify 30 -notifier "notify-send -u critical -t 10000 -- 'locking screen in 30 seconds'"
242+
exec xautolock -detectsleep -time 5 -locker "/mnt/fedora/home/edavison/bin/lock_and_blur.sh" -notify 30 -notifier "notify-send -u critical -t 10000 -- 'locking screen in 30 seconds'"
243243

244-
# stream deck
244+
# startup apps
245+
exec picom
245246
exec ~/bin/run_streamdeck.sh
246-
247-
# rescuetime
248247
exec /usr/bin/rescuetime
248+
exec bluemon-applet
249+
exec vorta
249250

250251
# shutdown / restart / suspend...
251252
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (CTRL+s) shutdown

bin/clipboards

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# -selection selection to access ("primary", "secondary", "clipboard" or "buffer-cut")
44
# for i in "primary" "secondary" "clipboard" "buffer-cut" "zebra" "buffer-cut7"

bin/lock_and_blur.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
lighticon="$HOME/Pictures/padlock-light.png"
44
darkicon="$HOME/Pictures/padlock-dark.png"
55
tmpbg='/tmp/screen.png'
6-
image='/home/edavison/Pictures/screen.png'
6+
image="$HOME/Pictures/screen.png"
77

88
# copy lock image to tmpbg
99
cp $image $tmpbg
@@ -47,5 +47,5 @@ convert "$tmpbg" -filter Gaussian -thumbnail 20% -sample 500% "$tmpbg"
4747
convert "$tmpbg" "$icon" -gravity center -composite "$tmpbg"
4848

4949
# lock the screen with the color parameters
50-
/usr/bin/i3lock "${PARAM[@]}" -i "$tmpbg"
50+
/usr/bin/env i3lock "${PARAM[@]}" -i "$tmpbg"
5151

bin/net-both.sh

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ sudo route del -net 0.0.0.0 gw 10.7.124.217 dev enp0s13f0u1u2u3
1515
#sudo route add -net 0.0.0.0 gw 10.211.1.1 dev enp0s31f6
1616
sudo route add -net 0.0.0.0 gw 10.211.1.1 dev if-home
1717
sudo route add -net 0.0.0.0 gw 10.211.1.1 dev enp0s31f6
18+
19+
sudo route del -net 0.0.0.0 gateway 10.7.124.217 dev enp0s13f0u2u2u3
20+
1821
$HOME/bin/setup-cisco-routes-rev.sh
1922
route -n
2023

0 commit comments

Comments
 (0)