Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sammcj committed Sep 20, 2023
1 parent 3ac860b commit 62135f5
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 631 deletions.
4 changes: 0 additions & 4 deletions 4-aliases.rc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ alias pa="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip i
# Second homebrew install with x86 arch
alias brew86="arch -x86_64 /usr/local/homebrew/bin/brew"

#shellcheck disable=SC2139
alias brewbackup="brew bundle dump --force --file=""${THIS_DIRECTORY}""/Brewfile-""${HOST}"""

# Git
# alias gbd="git branch -d" Moved to functions
#alias gitrb='for branch in $(git branch -r --merged | grep -v HEAD); do echo -e $(git show --format="%ci %cr %an" "$branch" | head -n 1) \\t$branch; done | sort -r'
Expand Down Expand Up @@ -97,7 +94,6 @@ alias dmesg="dmesg -LT"
alias cpuinfo="sysctl -n machdep.cpu.brand_string"
alias psql="/Applications/Postgres.app/Contents/Versions/latest/bin/psql"
alias fastmail_you_there_bro="openssl s_client -connect imap.fastmail.com:993 -crlf"

alias zmv='noglob zmv -W'

# MacOS shortcuts
Expand Down
3 changes: 1 addition & 2 deletions 5-exports.rc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# shellcheck disable=SC2148 disable=SC1090 shell=bash

### Exports ###
export SAM_CLI_TELEMETRY=0 # AWS SAM
export TELEMETRY=0 ENABLE_TELEMETRY=0 SEND_TELEMETRY=0 DO_NOT_TRACK=1 ANALYTICS=0 DISABLE_ANALYTICS=1 NO_ANALYTICS=1 # General catch-all
export SAM_CLI_TELEMETRY=0 TELEMETRY=0 ENABLE_TELEMETRY=0 SEND_TELEMETRY=0 DO_NOT_TRACK=1 ANALYTICS=0 DISABLE_ANALYTICS=1 NO_ANALYTICS=1 # General catch-all
export GREP_OPTIONS="--color"
# export LSCOLORS="ExFxCxDxBxegedabagacad"
export LS_COLORS="$(vivid generate dracula)"
Expand Down
78 changes: 74 additions & 4 deletions 9-functions.rc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ commit-hotfix() {
fi

command git commit $GIT_ARGS -m "Hotfix-${DATESTAMP} -- ${MESSAGE}"
command git push
}

function checkout-jira() {
Expand All @@ -166,7 +167,8 @@ function commit-jira() {
local GIT_ARGS=""
local MESSAGE="$*" # Set the commit message to the arguments passed to the function
if [[ -n $* ]]; then
GIT_ARGS="-n" # Add -n as a parameter to git if it's passed as an argument to the function
GIT_ARGS="-n" # Add -n as a parameter to git if it's passed as an argument to the function
MESSAGE="${*:2}" # Remove the first argument from the list of arguments
shift 1
fi

Expand All @@ -179,12 +181,12 @@ function commit-jira() {
echo "Would you like to add them? (y/n)"
read -r ADD_FILES
if [[ $ADD_FILES == "y" ]]; then
git add "$untracked_files"
command git add "$untracked_files"
fi
fi

command git add .
command git commit $GIT_ARGS -m "$(git rev-parse --abbrev-ref HEAD | cut -d'-' -f1 -f2) -- ${MESSAGE}"
command git push
}

# Outputs the name of the current branch
Expand Down Expand Up @@ -634,7 +636,7 @@ function s2a-keychain() {
--skip-prompt \
--password="$IDPPW" \
--profile="$INPUT_PROFILE"

# --skip-verify
export AWS_PROFILE="$INPUT_PROFILE"
export AWSCLIPARAMS="--profile=${INPUT_PROFILE}"
export AWS_DEFAULT_REGION=ap-southeast-2
Expand Down Expand Up @@ -1238,3 +1240,71 @@ npm_replace_registry() {
echo "Replaced $search_string with $replace_string in $file"
done
}

### Docker Compose ###
# Functions to help when working with docker-compose especially with multiple docker-compose files and profiles

# ddc() {
# local command="$1"
# shift
# local service_name="$1"
# shift
# local profile=""

# # Iterate through all docker-compose*.yaml files to find the profile
# for file in docker-compose*.yaml; do
# # Check if the specified service exists in the file
# if grep -q "^ $service_name:" "$file"; then
# # Extract profile name
# profile_name=$(awk -v service="$service_name" '$1 == service":" { getline; getline; print $3 }' "$file")
# profile_name="${profile_name#- }"
# profile_name="${profile_name%\"}"
# profile_name="${profile_name#\"}"
# if [[ ! -z "$profile_name" ]]; then
# profile="--profile $profile_name"
# fi
# break
# fi
# done

# # Run the docker-compose command
# docker-compose $profile $command "$service_name" "$@"
# }

function docker-network() {
docker ps -q | xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}' | sed 's/ \// /' | sort
}

dpup() {
pushd "$DOCKER_COMPOSE_DIR" || return
docker-compose --profile "$1" up -d "$1"
echo "----"
docker logs -f "$1"
popd
}

# Run docker-compose profiles on a remote (ssh) server
nas_dcup() {
local server="$1"
local profile="$2"
local service="$3"
local command="$4"

ssh "$server" "cd ${DOCKER_COMPOSE_DIR} && docker-compose --profile ${profile} ${command} ${service}"
}

# Yazi https://github.com/sxyazi/yazi
# https://github.com/sxyazi/yazi/tree/main/config/docs
function y() {
tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}

function brewbackup() {
# shellcheck disable=SC2139,SC2153
brew bundle dump --force --file="${THIS_DIRECTORY}/Brewfile-${HOST}"
}
35 changes: 32 additions & 3 deletions Brewfile-samm-digio-mbp.local
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tap "homebrew/cask-fonts"
tap "ibotta/public"
tap "jeffreywildman/virt-manager"
tap "jesseduffield/lazydocker"
tap "jstkdng/programs"
tap "kubecolor/tap"
tap "lindell/multi-gitter"
tap "makew0rld/tap"
Expand Down Expand Up @@ -155,10 +156,12 @@ brew "exercism"
brew "fd"
brew "sdl2"
brew "ffmpeg"
brew "ffmpegthumbnailer"
brew "gcc"
brew "fftw"
brew "fio"
brew "fnm"
brew "fx"
brew "fzf"
brew "gawk"
brew "genext2fs"
Expand Down Expand Up @@ -249,6 +252,7 @@ brew "parallel"
brew "pipx"
brew "platformio"
brew "podman"
brew "poppler"
brew "popt"
brew "pre-commit", link: false
brew "prettier"
Expand Down Expand Up @@ -285,7 +289,6 @@ brew "texi2html"
brew "tfenv"
brew "tflint"
brew "tfsec"
brew "thefuck"
brew "tig"
brew "tldr"
brew "tmate"
Expand All @@ -295,6 +298,7 @@ brew "trivy"
brew "ttyd"
brew "typescript"
brew "u-boot-tools"
brew "unar"
brew "universal-ctags"
brew "vale"
brew "vivid"
Expand All @@ -307,11 +311,13 @@ brew "wxwidgets"
brew "x86_64-elf-gdb"
brew "yarn"
brew "yasm"
brew "yazi"
brew "ykman"
brew "youtube-dl"
brew "yq"
brew "yt-dlp"
brew "zlib"
brew "zoxide"
brew "zsh"
brew "zsh-autosuggestions"
brew "zsh-completions"
Expand All @@ -326,6 +332,7 @@ brew "derailed/popeye/popeye"
brew "git-chglog/git-chglog/git-chglog"
brew "ibotta/public/sopstool"
brew "jeffreywildman/virt-manager/virt-viewer"
brew "jstkdng/programs/ueberzugpp"
brew "kubecolor/tap/kubecolor"
brew "lindell/multi-gitter/multi-gitter"
brew "makew0rld/tap/didder"
Expand Down Expand Up @@ -355,13 +362,16 @@ cask "drawio"
cask "drivedx"
cask "etrecheckpro"
cask "fedora-media-writer"
cask "font-b612-mono"
cask "font-blex-mono-nerd-font"
cask "font-hack-nerd-font"
cask "font-iosevka"
cask "font-monocraft"
cask "font-symbols-only-nerd-font"
cask "gitahead"
cask "hex-fiend"
cask "kekaexternalhelper"
cask "keyclu"
cask "kindle-previewer"
cask "knockknock"
cask "latest"
Expand Down Expand Up @@ -402,7 +412,6 @@ cask "virtualbuddy"
cask "webpquicklook"
cask "wine-stable"
cask "wineskin"
cask "xbar"
cask "xld"
mas "Amphetamine", id: 937984704
mas "Apple Configurator", id: 1037126344
Expand Down Expand Up @@ -473,6 +482,7 @@ vscode "Cardinal90.multi-cursor-case-preserve"
vscode "charliermarsh.ruff"
vscode "chouzz.vscode-better-align"
vscode "chris-towles.markdown-paste-image"
vscode "chrisbibby.hide-node-modules"
vscode "christian-kohler.npm-intellisense"
vscode "christian-kohler.path-intellisense"
vscode "chrmarti.regex"
Expand All @@ -498,9 +508,11 @@ vscode "esbenp.prettier-vscode"
vscode "ESPHome.esphome-vscode"
vscode "espressif.esp-idf-extension"
vscode "file-icons.file-icons"
vscode "fivethree.vscode-hugo-snippets"
vscode "formulahendry.auto-close-tag"
vscode "formulahendry.github-actions"
vscode "foxundermoon.shell-format"
vscode "geddski.macros"
vscode "GitHub.copilot"
vscode "GitHub.copilot-chat"
vscode "GitHub.copilot-labs"
Expand All @@ -512,29 +524,34 @@ vscode "GraphQL.vscode-graphql"
vscode "GraphQL.vscode-graphql-syntax"
vscode "griimick.vhs"
vscode "Gruntfuggly.todo-tree"
vscode "hashicorp.terraform"
vscode "hbenl.vscode-test-explorer"
vscode "hediet.vscode-drawio"
vscode "hilleer.yaml-plus-json"
vscode "HuggingFace.huggingface-vscode"
vscode "HitkoDev.vscode-remark-hugo"
vscode "IBM.output-colorizer"
vscode "idleberg.applescript"
vscode "inercia.vscode-k3d"
vscode "janisdd.vscode-edit-csv"
vscode "jasonnutter.vscode-codeowners"
vscode "jebbs.plantuml"
vscode "jeff-hykin.better-dockerfile-syntax"
vscode "jerrygoyal.shortcut-menu-bar"
vscode "johnsoncodehk.vscode-tsconfig-helper"
vscode "jsynowiec.vscode-insertdatestring"
vscode "kaellarkin.hugo-shortcode-syntax"
vscode "kakumei.ts-debug"
vscode "kasraghoreyshi.json-type-generator"
vscode "kddejong.vscode-cfn-lint"
vscode "keesschollaart.vscode-home-assistant"
vscode "kkangmj.vscode-markdown-extension"
vscode "Leathong.openscad-language-support"
vscode "liviuschera.noctis"
vscode "loganarnett.lambda-snippets"
vscode "lostintangent.vsls-whiteboard"
vscode "LouisWT.regexp-preview"
vscode "mads-hartmann.bash-ide-vscode"
vscode "mariomatheu.syntax-project-pbxproj"
vscode "MariusAlchimavicius.json-to-ts"
vscode "mark-tucker.aws-cli-configure"
vscode "me-dutour-mathieu.vscode-github-actions"
Expand All @@ -547,6 +564,7 @@ vscode "mohsen1.prettify-json"
vscode "mrmlnc.vscode-duplicate"
vscode "ms-azuretools.vscode-docker"
vscode "ms-kubernetes-tools.vscode-kubernetes-tools"
vscode "ms-python.isort"
vscode "ms-python.python"
vscode "ms-python.vscode-pylance"
vscode "ms-vscode-remote.remote-containers"
Expand Down Expand Up @@ -574,11 +592,14 @@ vscode "oven.bun-vscode"
vscode "paragdiwan.gitpatch"
vscode "PascalReitermann93.vscode-yaml-sort"
vscode "paulober.pico-w-go"
vscode "pflannery.vscode-versionlens"
vscode "phoenisx.gohugo"
vscode "platformio.platformio-ide"
vscode "pmneo.tsimporter"
vscode "pombadev.pbbs"
vscode "pomdtr.excalidraw-editor"
vscode "PulkitGangwar.nextjs-snippets"
vscode "q.typescript-mono-repo-import-helper"
vscode "qcz.text-power-tools"
vscode "quicktype.quicktype"
vscode "rangav.vscode-thunder-client"
Expand All @@ -588,10 +609,14 @@ vscode "redhat.vscode-yaml"
vscode "richie5um2.vscode-sort-json"
vscode "robertrossmann.remedy"
vscode "rusnasonov.vscode-hugo"
vscode "rvest.vs-code-prettier-eslint"
vscode "sdras.vue-vscode-snippets"
vscode "SebastianBille.iam-legend"
vscode "sidneys1.gitconfig"
vscode "smallcloud.codify"
vscode "smallcloud.refact"
vscode "snyk-security.snyk-vulnerability-scanner"
vscode "sswg.swift-lang"
vscode "stateful.runme"
vscode "steoates.autoimport"
vscode "streetsidesoftware.code-spell-checker"
Expand All @@ -602,6 +627,7 @@ vscode "tal7aouy.theme"
vscode "tamasfe.even-better-toml"
vscode "thomascsd.vscode-readme-pattern"
vscode "timonwong.shellcheck"
vscode "tsandall.opa"
vscode "tumido.cron-explained"
vscode "twxs.cmake"
vscode "usernamehw.errorlens"
Expand All @@ -610,10 +636,13 @@ vscode "VisualStudioExptTeam.intellicode-api-usage-examples"
vscode "VisualStudioExptTeam.vscodeintellicode"
vscode "vscode-icons-team.vscode-icons"
vscode "vsls-contrib.gatekeeper"
vscode "Vue.volar"
vscode "wayou.vscode-todo-highlight"
vscode "wfurphy.vscode-button-card-js"
vscode "wholroyd.jinja"
vscode "wix.vscode-import-cost"
vscode "XadillaX.viml"
vscode "xuanli.spice"
vscode "yoavbls.pretty-ts-errors"
vscode "yzhang.markdown-all-in-one"
vscode "ZainChen.json"
Loading

0 comments on commit 62135f5

Please sign in to comment.