Skip to content

Instantly share code, notes, and snippets.

View shaunmolloy's full-sized avatar

Shaun Molloy shaunmolloy

View GitHub Profile
@shaunmolloy
shaunmolloy / uuid
Created July 29, 2022 11:07
generate a uuid in bash
#!/usr/bin/env bash
# uuid
UUID=$(cat /proc/sys/kernel/random/uuid)
echo $UUID
@shaunmolloy
shaunmolloy / short-uuid
Last active July 29, 2022 11:11
short-uuid - generate a short uuid in bash
#!/usr/bin/env bash
# short-uuid
UUID=$(cat /proc/sys/kernel/random/uuid)
SHORT_UUID=$(echo $UUID | sed "s/-//g")
SHORT_UUID=${SHORT_UUID:0:10}
echo $SHORT_UUID
#!/usr/bin/env bash
# time-npm-start
URL="http://localhost:3000/"
spinner() {
I=$(( (I+1) %4 ))
printf "\r${SPIN:$I:1} $1"
}
@shaunmolloy
shaunmolloy / vim-session
Last active June 1, 2023 14:34
vim-session - fzf vim session from aliases
#!/usr/bin/env bash
vim_session() {
if [ ! -f ~/.bash_aliases ]; then
echo "No ~/.bash_aliases file found"
return 1
fi
# Source aliases
shopt -s expand_aliases
@shaunmolloy
shaunmolloy / upstream-merge
Created June 5, 2023 13:38
upstream-merge - merge in changes from upstream
#!/usr/bin/env bash
# Checkout to upstream-merge branch if we're not on one
BRANCH="$(git branch --show-current)"
if [[ ! "$BRANCH" =~ "upstream-merge" ]]; then
git checkout -b feature/upstream-merge
fi
# Fetch latest from upstream
git fetch upstream
for session in $(tmux ls | grep prefix | awk '{ print $1 }' | sed -e 's/:$//'); do tmux kill-session -t $session; done