alpha
Login
or
Join now
j3s.sh
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
my dotz
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Add select bin scripts
author
j3s
date
6 years ago
(Nov 26, 2019, 9:22 AM -0600)
commit
7482308e
7482308e9599baa5fcae02d49f0e9c923be8be5d
parent
9d9217a0
9d9217a09d769eeaf6d2a86a3200fa339e0033bc
+126
6 changed files
Expand all
Collapse all
Unified
Split
bin
MACC02VK5ECHTD7
how
j
jmass
darkdepths
make-vm
n
short-pwd
+63
bin/MACC02VK5ECHTD7/how
Reviewed
···
1
1
+
#!/bin/sh
2
2
+
3
3
+
clone_url="ssh://git@git.bestbuy.com/~jesse.olson/howdocs-test.git"
4
4
+
5
5
+
if [ ! "$#" -gt 0 ]; then
6
6
+
echo "Need a string to search for!"
7
7
+
exit 1
8
8
+
fi
9
9
+
10
10
+
# check for fzf & ripgrep-all, install if unfound
11
11
+
if ! fzf --version > /dev/null 2>&1; then
12
12
+
echo "fzf required. Install fzf via brew y/n? "
13
13
+
read -r
14
14
+
if [ "$REPLY" = "y" ]; then
15
15
+
brew install fzf
16
16
+
else
17
17
+
exit 1
18
18
+
fi
19
19
+
fi
20
20
+
21
21
+
if ! rg --version > /dev/null 2>&1; then
22
22
+
echo "ripgrep required. Install ripgrep via brew y/n? "
23
23
+
read -r
24
24
+
if [ "$REPLY" = "y" ]; then
25
25
+
brew install ripgrep
26
26
+
else
27
27
+
exit 1
28
28
+
fi
29
29
+
fi
30
30
+
31
31
+
# maybe todo: if there are staged changes, ask user to push them?
32
32
+
33
33
+
# clone/update repository
34
34
+
if [ -d ~/howdocs ]; then
35
35
+
(cd ~/howdocs && git pull)
36
36
+
else
37
37
+
echo 'First run detected. Cloning repo...'
38
38
+
git clone "$clone_url" ~/howdocs
39
39
+
fi
40
40
+
41
41
+
# fzf the directory
42
42
+
result=$(rg -S --files-with-matches --no-messages "$1" ~/howdocs \
43
43
+
| fzf --preview "highlight -O ansi -l {} 2> /dev/null \
44
44
+
| rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' \
45
45
+
|| rg --ignore-case --pretty --context 10 '$1' {}")
46
46
+
47
47
+
if [ "$result" = "" ]; then
48
48
+
echo 'no documents found'
49
49
+
exit 1
50
50
+
fi
51
51
+
52
52
+
# open up relevant file in vim for copy+pasting
53
53
+
if [ "$EDITOR" ]; then
54
54
+
"$EDITOR" "$result"
55
55
+
else
56
56
+
vim "$result"
57
57
+
fi
58
58
+
59
59
+
# if file changed, save & commit changes & push
60
60
+
if ! (cd ~/howdocs && git diff-index --quiet HEAD --); then
61
61
+
echo "detected howdoc changes; pushing them:"
62
62
+
(cd ~/howdocs && git add --all && git commit -m '[Automated Commit]' && git push)
63
63
+
fi
+6
bin/MACC02VK5ECHTD7/j
Reviewed
···
1
1
+
#!/bin/sh
2
2
+
3
3
+
local query="$1"
4
4
+
shift 2> /dev/null
5
5
+
local ip=$(awless list instances --filter state=running,name="$query" "$@" --format json | jq -r '.[] | [.PrivateIP] | .[]' | head -n1)
6
6
+
/usr/local/bin/ssh "$ip"
+12
bin/MACC02VK5ECHTD7/jmass
Reviewed
···
1
1
+
#!/bin/bash
2
2
+
query="$1"
3
3
+
shift 2> /dev/null
4
4
+
ips=$(awless list instances --filter state=running,name="$query" "$@" --format json | jq -r '.[] | [.PrivateIP] | .[]')
5
5
+
tmux new-window 'ssh-trash-test'
6
6
+
7
7
+
while IFS= read -r i
8
8
+
do tmux split-window "ssh $i"
9
9
+
tmux select-layout tiled
10
10
+
done <<< "$ips"
11
11
+
12
12
+
tmux setw synchronize-panes on
+33
bin/darkdepths/make-vm
Reviewed
···
1
1
+
#!/bin/bash
2
2
+
3
3
+
if [[ $1 == "" || $1 == "--help" || $1 == "-h" ]]; then
4
4
+
echo "Usage: make-vm [vm-name] [options]"
5
5
+
echo "some options:"
6
6
+
echo " mem=<number-in-megabytes>"
7
7
+
echo " cpu=<cores>"
8
8
+
echo " disk=<gbytes>"
9
9
+
echo " env=<public|private>"
10
10
+
exit 1
11
11
+
fi
12
12
+
13
13
+
name="$1"
14
14
+
env="private"
15
15
+
disk="8" # in gb
16
16
+
mem="512" # in mb
17
17
+
cpu="1" # in cores
18
18
+
19
19
+
if [[ -e /vm/$name.xml || -e /dev/vg0/$name.disk ]]; then
20
20
+
echo 'vm/disk already exists'
21
21
+
exit 1
22
22
+
fi
23
23
+
24
24
+
echo "Carving $disk GB lv in /dev/vg0/$name.disk"
25
25
+
lvcreate -n "$name.disk" --size 8G vg0
26
26
+
27
27
+
echo "createing writing /vm/$name.xml"
28
28
+
touch "/vm/$name.xml"
29
29
+
virt-install -n $name -r 8192 \
30
30
+
$name $cpus $type $variant $disk $location $graphics $bus $network
31
31
+
32
32
+
qemu-system-x86_64 -hda /vm/vdisk.img -m 1024 -enable-kvm -netdev user,id=user.0 -device e1000,netdev=user.0 -soundhw ac97 -no-acpi -daemonize -usb -usbdevice tablet
33
33
+
+7
bin/n
Reviewed
···
1
1
+
#!/bin/sh
2
2
+
3
3
+
notefile="$HOME/sync/notes.md"
4
4
+
printf '\n' >> "$notefile"
5
5
+
date +"%Y-%m-%d %H:%M" >> "$notefile"
6
6
+
printf -- "----------------" >> "$notefile"
7
7
+
vim "+normal Go" +startinsert "$notefile"
+5
bin/short-pwd
Reviewed
···
1
1
+
#!/bin/sh
2
2
+
3
3
+
term=$(printf "$PWD" | sed -E 's|(\.?[^/])([^/]+)\/|\1/|g')
4
4
+
5
5
+
printf "\033[01;90m$term\e[0m"