Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
uses: actions/checkout@v7
- name: Run shellcheck on bin/ directory
run: |
# Check all files in bin/ directory (all are shell scripts)
find bin/ -type f -exec shellcheck {} \;
grep -lE '^#!.*(ba|z)?sh$' bin/* | xargs shellcheck
- name: Run shellcheck on oh-my-zsh custom directory
run: |
# Check .zsh files in custom directory
Expand All @@ -26,6 +25,12 @@ jobs:
if [ -d "link/oh-my-zsh/custom/hosts" ]; then
find link/oh-my-zsh/custom/hosts -name "*.zsh" -type f -exec shellcheck -s bash {} \;
fi
- name: Install zsh
run: |
sudo apt-get update && sudo apt-get install -y zsh
- name: Syntax check zsh scripts in bin/
run: |
grep -lE '^#!.*zsh$' bin/* | xargs -n1 zsh -n
go-test:
name: Go Tests
runs-on: ubuntu-latest
Expand Down
17 changes: 9 additions & 8 deletions bin/brewup
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /bin/zsh
#!/usr/bin/env bash

brew update
brew upgrade -y
brew cleanup

cd ~/Projects/dotfiles && \
git pull &&
brew bundle && \
git add Brewfile.lock.json && \
git ci -m 'update brewfile' && \
git push && \
cd -
(
cd ~/Projects/dotfiles &&
git pull &&
brew bundle &&
git add Brewfile.lock.json &&
git ci -m 'update brewfile' &&
git push
)

gcloud components update -q
1 change: 1 addition & 0 deletions bin/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /bin/zsh
# shellcheck disable=SC1071

set -x

Expand Down
4 changes: 2 additions & 2 deletions bin/daily
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/zsh
#!/usr/bin/env bash

cd ~/Projects/random
cd ~/Projects/random || exit 1

claude ~/Projects/random/Prompts/daily.md
4 changes: 2 additions & 2 deletions bin/dbr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/zsh
#!/usr/bin/env bash

docker run --rm -t $@ $(docker build -q .)
docker run --rm -t "$@" "$(docker build -q .)"

6 changes: 3 additions & 3 deletions bin/gifme
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ output="$HOME/Desktop/animated.gif"
# Set delay to be 20 unless we set $DELAY
delay=${DELAY-20}

convert -verbose -delay $delay -loop 0 -resize 500 -layers OptimizeTransparency \
$* $output
convert -verbose -delay "$delay" -loop 0 -resize 500 -layers OptimizeTransparency \
"$@" "$output"

# comment out if you don't need CloudApp.
cloudapp $output
cloudapp "$output"
2 changes: 1 addition & 1 deletion bin/git-adopt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/zsh
#!/usr/bin/env bash

function reset() {
git config --local --unset-all user.email
Expand Down
12 changes: 6 additions & 6 deletions bin/kubectl-ssh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ssh_node() {
node=$1
shift
if [ "$node" = "" ]; then
node=$(kubectl get node -o name $@ | sed 's/node\///' | tr '\n' ' ')
node=$(kubectl get node -o name "$@" | sed 's/node\///' | tr '\n' ' ')
node=${node::-1}

if [[ "$node" =~ " " ]]; then
Expand All @@ -19,7 +19,7 @@ ssh_node() {

ns=default
pod=$(
kubectl create -n $ns -o name $@ -f - <<EOF
kubectl create -n "$ns" -o name "$@" -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -53,14 +53,14 @@ EOF
)

deletePod() {
kubectl delete -n $ns $pod $@ --wait=false
kubectl delete -n "$ns" "$pod" "$@" --wait=false
}
trap deletePod EXIT

echo "Created $pod"
echo "Waiting for container to start..."
kubectl wait -n $ns --for=condition=Ready --timeout 60s $pod $@ >/dev/null
kubectl attach -n $ns -it $pod -c ssh-node $@
kubectl wait -n "$ns" --for=condition=Ready --timeout 60s "$pod" "$@" >/dev/null
kubectl attach -n "$ns" -it "$pod" -c ssh-node "$@"

}

Expand Down Expand Up @@ -112,7 +112,7 @@ fi
if [[ "$1" == node/* ]]; then
nodeName=${1:5}
shift
ssh_node $nodeName "$@"
ssh_node "$nodeName" "$@"
elif [ "$1" == "node" ]; then
shift
case "$1" in
Expand Down
2 changes: 1 addition & 1 deletion bin/screenshots
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/zsh
#!/usr/bin/env bash

mv -v ~/Desktop/Screen\ Recording* ~/Dropbox/Screenshots/
mv -v ~/Desktop/Screen\ Shot* ~/Dropbox/Screenshots/
Expand Down
10 changes: 5 additions & 5 deletions bin/set_ip
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#! /bin/zsh
#!/usr/bin/env bash

IP=$(curl -s 'https://api.ipify.org')
maindomain=$(expr match "$1" '.*\.\(.*\..*\)')
maindomain=$(expr "$1" : '.*\.\(.*\..*\)')
subdomain=${1%".$maindomain"}

if [[ -z "$IP" ]]; then
echo "IP is empty."
exit 1
fi

cd ~/Projects/icco.me/$maindomain/
mkdir -p ~/Projects/icco.me/"$maindomain"/
cd ~/Projects/icco.me/"$maindomain"/ || exit 1
git pull
mkdir -p ~/Projects/icco.me/$maindomain/
echo $IP > ~/Projects/icco.me/$maindomain/$subdomain
echo "$IP" > ~/Projects/icco.me/"$maindomain"/"$subdomain"
git add .
git diff --staged --quiet || git commit -m 'chore: set ip' && git push -u
70 changes: 19 additions & 51 deletions bin/suitup
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
sync_dir () {
f=$1

if [ -d $PROJ$f ]; then
if [ -d "$PROJ$f" ]; then
echo "--------> $f"
cd $PROJ$f;
cd "$PROJ$f" || return 2
rm -f .DS_Store
if [ -d $PROJ$f/.git/ ]; then
if [ -d "$PROJ$f/.git/" ]; then
git fetch --prune
branch=$(git symbolic-ref --short HEAD 2>/dev/null)
track=$(git for-each-ref --format='%(upstream:track)' "refs/heads/$branch" 2>/dev/null)
upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null)
upstream=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null)
if [ "$track" = "[gone]" ] || [ -z "$upstream" ]; then
remote=$(git config "branch.$branch.remote")
[ -n "$remote" ] || remote=origin
default=$(git symbolic-ref --short "refs/remotes/$remote/HEAD" 2>/dev/null) \
|| { git remote set-head "$remote" -a >/dev/null 2>&1 && default=$(git symbolic-ref --short "refs/remotes/$remote/HEAD" 2>/dev/null); }
if [ -n "$default" ] && [ "${default#$remote/}" != "$branch" ]; then
echo "Upstream for $branch is gone/unresolvable; switching to ${default#$remote/}."
git checkout "${default#$remote/}"
if [ -n "$default" ] && [ "${default#"$remote"/}" != "$branch" ]; then
echo "Upstream for $branch is gone/unresolvable; switching to ${default#"$remote"/}."
git checkout "${default#"$remote"/}"
fi
fi
git pull
git status -sb
return 0;
elif [ -d $PROJ$f/.svn/ ]; then
elif [ -d "$PROJ$f/.svn/" ]; then
svn up
return 0;
else
Expand All @@ -39,48 +39,16 @@ sync_dir () {
fi;
}

PROJ=~/Projects/
if [ -d $PROJ ]; then
echo "# ~/Projects --------------------------------------------------------------------------------"
for e in $(ls $PROJ | sort -f); do
sync_dir $e
if [ $? -eq 1 ]; then
echo "No known version control."
fi
done;
fi

PROJ=~/Sites/
if [ -d $PROJ ]; then
echo "# ~/Sites -----------------------------------------------------------------------------------"
for e in $(ls $PROJ | sort -f); do
sync_dir $e
if [ $? -eq 1 ]; then
echo "No known version control."
fi
done;
fi

PROJ=~/Work/
if [ -d $PROJ ]; then
echo "# ~/Work ------------------------------------------------------------------------------------"
for e in $(ls $PROJ | sort -f); do
sync_dir $e
if [ $? -eq 1 ]; then
echo "No known version control."
fi
done;
fi

PROJ=~/HFP/
if [ -d $PROJ ]; then
echo "# ~/HFP ------------------------------------------------------------------------------------"
for e in $(ls $PROJ | sort -f); do
sync_dir $e
if [ $? -eq 1 ]; then
echo "No known version control."
fi
done;
fi
for PROJ in ~/Projects/ ~/Sites/ ~/Work/ ~/logo.dev/; do
if [ -d "$PROJ" ]; then
printf '# %s %s\n' "${PROJ%/}" "--------------------------------------------------------------------------------"
while IFS= read -r e; do
sync_dir "$e"
if [ $? -eq 1 ]; then
echo "No known version control."
fi
done < <(find "$PROJ" -mindepth 1 -maxdepth 1 -exec basename {} \; | sort -f)
fi
done

echo "All Done!"
Loading