small pixel drawing of a pufferfish dotfiles

More prep for DO
j3s j3s@c3f.net
Sun, 27 Jun 2021 15:26:37 -0500
commit

0a28d008bc0a50e4edaa3ae43fe0b63ae2307e27

parent

93aaa83d2c31ef2ed928eb9e2853383fc83f601f

21 files changed, 30 insertions(+), 291 deletions(-)

jump to
M .config/sway/config.config/sway/config

@@ -251,3 +251,4 @@ }

} include /etc/sway/config.d/* +include ~/.config/sway/`hostname`
A .config/sway/zora

@@ -0,0 +1,1 @@

+output * bg /home/j3s/Pictures/whale.jpg fill
M .env.env

@@ -20,6 +20,15 @@ ;;

esac } +# yep still needed +if ls --version 2>&1 | grep -i gnu >/dev/null +then + alias ls='ls --color=auto ' +elif ls --version 2>&1 | grep -i busybox >/dev/null +then + alias ls='ls --color=auto ' +fi + if [ -z "${SSH_AGENT_PID}" ] then if ! [ -e /tmp/ssh-agent-$USER ]
D bin/MACC02VK5ECHTD7/aws-reset-pass

@@ -1,20 +0,0 @@

-#!/bin/sh -e - -die() { - # Print a message and exit with '1' (error). - echo "$1" - exit 1 -} - -[ "$1" ] || die "You must specify a new pass" - -newpass="$1" - -echo "Resetting password" -for a in browse cgraph; do - for e in test stage prod; do - echo "-> ${a}_${e}..." - aws --profile "${a}_${e}" iam update-login-profile --user-name jesse.olson --password "$newpass" - echo "done" - done -done
D bin/MACC02VK5ECHTD7/berksmass

@@ -1,5 +0,0 @@

-#!/bin/sh - -for i in test stage prod; do - CHEF_ENV=browse_$i bundle exec berks upload -done
D bin/MACC02VK5ECHTD7/brm

@@ -1,8 +0,0 @@

-#!/bin/sh -e -# -# Remove entire berks cache & start over - -rm -f Berksfile.lock -bundle exec berks install || rm -rf ~/.berkshelf/cookbooks -rm -f Berksfile.lock -bundle exec berks install
D bin/MACC02VK5ECHTD7/bua

@@ -1,15 +0,0 @@

-#!/bin/sh -e - -# purge berks -# rm -f Berksfile.lock -# bundle exec berks install - -envs="test stage prod" - -for env in $envs; do - CHEF_ENV=browse_$env bundle exec berks upload & -done - -wait - -echo "upload complete"
D bin/MACC02VK5ECHTD7/ec2e

@@ -1,26 +0,0 @@

-#!/bin/sh - -query="$1" -shift 2> /dev/null -case "$query" in - (i-*) filter="id=$query" ;; - (*) filter="name=$query" ;; -esac - -text=$( - printf "$*" | \ - sed -e 's/bpe/-p browse_prod -r us-east-1/g' | \ - sed -e 's/bpw/-p browse_prod -r us-west-2/g' | \ - sed -e 's/bse/-p browse_stage -r us-east-1/g' | \ - sed -e 's/bsw/-p browse_stage -r us-west-2/g' | \ - sed -e 's/bte/-p browse_test -r us-east-1/g' | \ - sed -e 's/btw/-p browse_test -r us-west-2/g' | \ - sed -e 's/cpe/-p cgraph_prod -r us-east-1/g' | \ - sed -e 's/cpw/-p cgraph_prod -r us-west-2/g' | \ - sed -e 's/cse/-p cgraph_stage -r us-east-1/g' | \ - sed -e 's/csw/-p cgraph_stage -r us-west-2/g' | \ - sed -e 's/cte/-p cgraph_test -r us-east-1/g' | \ - sed -e 's/ctw/-p cgraph_test -r us-west-2/g' -) - -awless list instances --columns id,zone,name,state,type,privateip --filter "${filter}" $text
D bin/MACC02VK5ECHTD7/how

@@ -1,63 +0,0 @@

-#!/bin/sh - -clone_url="ssh://git@git.bestbuy.com/~jesse.olson/howdocs-test.git" - -if [ ! "$#" -gt 0 ]; then - echo "Need a string to search for!" - exit 1 -fi - -# check for fzf & ripgrep-all, install if unfound -if ! fzf --version > /dev/null 2>&1; then - echo "fzf required. Install fzf via brew y/n? " - read -r - if [ "$REPLY" = "y" ]; then - brew install fzf - else - exit 1 - fi -fi - -if ! rg --version > /dev/null 2>&1; then - echo "ripgrep required. Install ripgrep via brew y/n? " - read -r - if [ "$REPLY" = "y" ]; then - brew install ripgrep - else - exit 1 - fi -fi - -# maybe todo: if there are staged changes, ask user to push them? - -# clone/update repository -if [ -d ~/howdocs ]; then - (cd ~/howdocs && git pull) -else - echo 'First run detected. Cloning repo...' - git clone "$clone_url" ~/howdocs -fi - -# fzf the directory -result=$(rg -S --files-with-matches --no-messages "$1" ~/howdocs \ - | fzf --preview "highlight -O ansi -l {} 2> /dev/null \ - | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' \ - || rg --ignore-case --pretty --context 10 '$1' {}") - -if [ "$result" = "" ]; then - echo 'no documents found' - exit 1 -fi - -# open up relevant file in vim for copy+pasting -if [ "$EDITOR" ]; then - "$EDITOR" "$result" -else - vim "$result" -fi - -# if file changed, save & commit changes & push -if ! (cd ~/howdocs && git diff-index --quiet HEAD --); then - echo "detected howdoc changes; pushing them:" - (cd ~/howdocs && git add --all && git commit -m '[Automated Commit]' && git push) -fi
D bin/MACC02VK5ECHTD7/j

@@ -1,22 +0,0 @@

-#!/bin/sh -query="$1" -shift 2> /dev/null - -text=$( - printf "$*" | \ - sed -e 's/bpe/-p browse_prod -r us-east-1/g' | \ - sed -e 's/bpw/-p browse_prod -r us-west-2/g' | \ - sed -e 's/bse/-p browse_stage -r us-east-1/g' | \ - sed -e 's/bsw/-p browse_stage -r us-west-2/g' | \ - sed -e 's/bte/-p browse_test -r us-east-1/g' | \ - sed -e 's/btw/-p browse_test -r us-west-2/g' | \ - sed -e 's/cpe/-p cgraph_prod -r us-east-1/g' | \ - sed -e 's/cpw/-p cgraph_prod -r us-west-2/g' | \ - sed -e 's/cse/-p cgraph_stage -r us-east-1/g' | \ - sed -e 's/csw/-p cgraph_stage -r us-west-2/g' | \ - sed -e 's/cte/-p cgraph_test -r us-east-1/g' | \ - sed -e 's/ctw/-p cgraph_test -r us-west-2/g' -) - -ip=$(awless --local list instances --filter state=running,name="$query" $text --format json | jq -r '.[] | [.PrivateIP] | .[]' | head -n1) -/usr/local/bin/ssh "$ip"
D bin/MACC02VK5ECHTD7/jmass

@@ -1,33 +0,0 @@

-#!/bin/bash -query="$1" -shift 2> /dev/null - -text=$( - printf "$*" | \ - sed -e 's/bpe/-p browse_prod -r us-east-1/g' | \ - sed -e 's/bpw/-p browse_prod -r us-west-2/g' | \ - sed -e 's/bse/-p browse_stage -r us-east-1/g' | \ - sed -e 's/bsw/-p browse_stage -r us-west-2/g' | \ - sed -e 's/bte/-p browse_test -r us-east-1/g' | \ - sed -e 's/btw/-p browse_test -r us-west-2/g' | \ - sed -e 's/cpe/-p cgraph_prod -r us-east-1/g' | \ - sed -e 's/cpw/-p cgraph_prod -r us-west-2/g' | \ - sed -e 's/cse/-p cgraph_stage -r us-east-1/g' | \ - sed -e 's/csw/-p cgraph_stage -r us-west-2/g' | \ - sed -e 's/cte/-p cgraph_test -r us-east-1/g' | \ - sed -e 's/ctw/-p cgraph_test -r us-west-2/g' -) - -ips=$(awless list instances --filter state=running,name="$query" $text --format json | jq -r '.[] | [.PrivateIP] | .[]') - -tmux set default-shell "/bin/sh" - -tmux new-window 'sleep 0.1' -while IFS= read -r i - do tmux split-window "ssh $i" - tmux select-layout tiled -done <<< "$ips" - -tmux set -u default-shell -tmux select-layout tiled -tmux setw synchronize-panes on
D bin/MACC02VK5ECHTD7/jws-ami

@@ -1,9 +0,0 @@

-#!/bin/sh - -TOKEN=$(grep token ~/.deploy/creds.yaml | sed 's/.*token: //g') - -for account in test stage prod cgraph_test cgraph_stage cgraph_prod; do - echo $account - curl -s -w "\n" --header "Authorization: Bearer $TOKEN" --header "Content-Type:application/json" "https://imr.monitoring.bestbuy.com/api/configuration/environments/$account" | - jq ".item.configuration.shared_$account.build_ami.centos" | grep us -done
D bin/MACC02VK5ECHTD7/jws-fetch

@@ -1,27 +0,0 @@

-#!/bin/sh - -date=$(date +%s) -for r in us-east-1 us-west-2; do - for p in browse cgraph shared; do - for e in test stage prod; do - dir="$HOME/.jws/${r}/${p}/${e}" - mkdir -p "$dir" - echo "Fetching ${r}/${p}/${e}" - aws ec2 describe-instances --profile "${p}_${e}" --region "$r" --output text --query "Reservations[*].Instances[*].{ - Instance:InstanceId, - Type:InstanceType, - AZ:Placement.AvailabilityZone, - Name:Tags[?Key==\`Name\`]|[0].Value, - pubIP:PublicIpAddress, - IP:PrivateIpAddress, - State:State.Name, - VPC:VpcId - }" | sed "s/$/ ${p}_${e}/" > "$dir/$date" & - # add profile to end for easy greppin' - # link current for other scripts - ln -fs "$dir/$date" "$dir/current" - done - done -done - -wait
D bin/MACC02VK5ECHTD7/jws-grep

@@ -1,9 +0,0 @@

-#!/bin/sh - -stuff=$(cat ~/.jws/*/*/*/current) - -for i in $@; do - stuff=$(echo "$stuff" | grep -i $i) -done - -echo "$stuff"
D bin/MACC02VK5ECHTD7/jws-ssh

@@ -1,26 +0,0 @@

-#!/bin/sh -# -# input: us-east-1a 172.29.71.236 i-0a7eb3896d61b4d22 Krakencld-app-ASG-A running m5.large None browse_test - -# if > 1 argument: run the given command on each remote system and stream the output -if ! [ -z "$1" ]; then - echo "establishing connections..." - while IFS='$\n' read -r i; do - echo $i - ip=$(echo "$i" | awk '{print $2}') - ssh "$ip" "$1" - done - exit 0 -fi - -# if no arguments: opens tmux panes to every remote host in list via ssh, sync panes -tmux set default-shell "/bin/sh" -tmux new-window 'sleep 0.2' -while IFS='$\n' read -r i; do - ip=$(echo "$i" | awk '{print $2}') - tmux split-window "ssh $ip" - tmux select-layout tiled -done -tmux set -u default-shell -tmux select-layout tiled -tmux setw synchronize-panes on
D bin/MACC02VK5ECHTD7/rvm-shell

@@ -1,1 +0,0 @@

-/bin/sh
D bin/MACC02VK5ECHTD7/terraform

@@ -1,3 +0,0 @@

-#!/bin/sh - -AWS_PROFILE=cgraph_prod /usr/local/bin/terraform $@
D bin/MACC02VK5ECHTD7/uop

@@ -1,11 +0,0 @@

-#!/bin/sh -e -# -# pushes commits, makes PR, merges PR, uploads cookbooks - -# bail if git branch is master -# bail if git status is not settled - -git push -u origin HEAD -prnumber=$(bundle exec stash pull-request master | awk -F'pull-requests/' '{print $NF}') -bundle exec rake merge "$prnumber" -brm && bua
M bin/prompt.gobin/prompt.go

@@ -3,8 +3,9 @@

import ( "fmt" "os" - "os/exec" "strings" + "syscall" + "time" ) func main() {

@@ -15,16 +16,13 @@ var parts []string

if strings.HasPrefix(cwd, home) { cwd = "~" + cwd[len(home):] } + var sysinfo syscall.Sysinfo_t + syscall.Sysinfo(&sysinfo) + uptime := time.Duration(sysinfo.Uptime) * time.Second + fmt.Printf("[%d:%02d:%02d] %s ", int64(uptime.Hours()), + int64(uptime.Minutes()) % 60, int64(uptime.Seconds()) % 60, + host) - out, err := exec.Command("git", "branch", "--show-current").Output() - if err != nil { - out = []byte("^(;,;)^\n") - } - branchname := strings.TrimSuffix(string(out), "\n") - - fmt.Printf("\033[92m[%s]\033[0m ", host) - - fmt.Printf("\033[94m") parts = strings.Split(cwd, "/") for i, part := range parts { if i == len(parts)-1 {

@@ -37,7 +35,4 @@ fmt.Printf("/")

} } } - fmt.Printf("\033[0m") - - fmt.Printf(" (%s)", branchname) }
A bin/zora/statusbar

@@ -0,0 +1,11 @@

+#!/bin/sh + +while true +do + battery="🐟 $(cat /sys/class/power_supply/BAT0/capacity)%" + wifi="🐡 $(nmcli ge status | grep -v STATE | awk '{print $1}')" + time=$(date +"%A %Y-%m-%d %I:%M %p") + time="🦈 $time $(date -u +"(%H:%M UTC)")" + printf "%s | %s | %s\n" "${wifi}" "${battery}" "${time}" + sleep 10 +done