funky color + updates

This commit is contained in:
Peter Kingswell 2022-08-14 12:29:46 -04:00
commit e47ef872e3
3 changed files with 112 additions and 3 deletions

24
.vscode/settings.json vendored
View file

@ -2,5 +2,25 @@
"python.testing.promptToConfigure": false,
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false
}
"python.testing.nosetestsEnabled": false,
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fbed80",
"activityBar.activeBorder": "#06b9a5",
"activityBar.background": "#fbed80",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#06b9a5",
"activityBarBadge.foreground": "#15202b",
"sash.hoverBorder": "#fbed80",
"statusBar.background": "#f9e64f",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#f7df1e",
"statusBarItem.remoteBackground": "#f9e64f",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#f9e64f",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#f9e64f99",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#f9e64f"
}

43
classkick-functions.zsh Normal file
View file

@ -0,0 +1,43 @@
function run_cicd_test_containers() {
echo "Starting local CI/CD tests at `date`"
echo "Running bandit..."
docker-compose run --no-deps --rm clever-sync-api python -m bandit -r . -x /tests/
RES2=$?
echo "Running black..."
docker-compose run --no-deps --rm clever-sync-api black . --check --line-length=120
RES4=$?
echo "Running flake8..."
docker-compose run --no-deps --rm clever-sync-api flake8 --config /app/dev-tools-config/.flake8 .
RES3=$?
# echo "Running pylint..."
# docker-compose run --no-deps --rm clever-sync-api pylint --rcfile /app/dev-tools-config/.pylintrc classkick
# RES2=$?
echo "Running isort..."
docker-compose run --no-deps --rm clever-sync-api isort . --profile black --line-length=120 --check
RES1=$?
echo "Running coverage..."
docker-compose run --no-deps --rm clever-sync-api pytest --cov .
RES5=$?
echo "Finished local CI/CD tests at `date`"
if [[ $RES1 -ne 0 || $RES2 -ne 0 || $RES3 -ne 0 || $RES4 -ne 0 || $RES5 -ne 0 ]]
then
return 1
fi
return 0
}
function run_cicd_fix_containers() {
echo "Starting CI/CD containers in 'fix mode' at `date`."
echo "Are you sure you want to continue?"
read
echo "Running black..."
docker-compose run --no-deps --rm clever-sync-api black . --line-length=120
RES4=$?
echo "Running isort..."
docker-compose run --no-deps --rm clever-sync-api isort . --profile black --line-length=120
RES1=$?
}

View file

@ -1,3 +1,5 @@
source ~/.oh-my-zsh/classkick-functions.zsh
function zsh_stats() {
fc -l 1 \
| awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
@ -324,7 +326,7 @@ function gfind-all() {
# $1 is search term, $2 is path
# rg --no-ignore --hidden "$@"
# even better is ag / silver searcher https://github.com/ggreer/the_silver_searcher
ag-no-pager --ignore-case --all-types --hidden --unrestricted --ignore-case --pager bat "$@"
ag-no-pager --ignore-case --hidden --ignore-case --pager bat "$@"
}
# the ol' gfind. Doesn't take a file pattern.
@ -391,12 +393,18 @@ function clean-slate() {
alias clr=clean-slate
alias cls=clean-slate
function print-hashes() {
repeat $1 echo -n "#" ; echo
}
function h() {
print-hashes 60
NUM_LINES=$1
if [ -z "$NUM_LINES" ]; then
NUM_LINES=35
fi
\history -$NUM_LINES
print-hashes 60
}
function psgr() {
@ -458,6 +466,12 @@ function git-show-all-stashes() {
git stash list | awk -F: '{ print "\n\n\n\n"; print $0; print "\n\n"; system("git stash show -p " $1); }'
}
# Check whether the supplied file is under SCM/git.
# Check whether the supplied file is under SCM/git.
function git-status() {
git ls-files | grep $1
}
# kill most recent container instance
alias docker-kill-latest='docker ps -l --format="{{.Names}}" | xargs docker kill'
@ -685,3 +699,35 @@ alias grep-ps-interactive="ppgrep"
alias interactive-kill="ppkill"
alias kill-interactive="ppkill"
alias kill-percol="ppkill"
# From https://apple.stackexchange.com/a/432408/100202 - sets the current iterm2
# tab to a random color
PRELINE="\r\033[A"
function random {
echo -e "\033]6;1;bg;red;brightness;$((1 + $RANDOM % 255))\a"$PRELINE
echo -e "\033]6;1;bg;green;brightness;$((1 + $RANDOM % 255))\a"$PRELINE
echo -e "\033]6;1;bg;blue;brightness;$((1 + $RANDOM % 255))\a"$PRELINE
}
function color {
case $1 in
green)
echo -e "\033]6;1;bg;red;brightness;57\a"$PRELINE
echo -e "\033]6;1;bg;green;brightness;197\a"$PRELINE
echo -e "\033]6;1;bg;blue;brightness;77\a"$PRELINE
;;
red)
echo -e "\033]6;1;bg;red;brightness;270\a"$PRELINE
echo -e "\033]6;1;bg;green;brightness;60\a"$PRELINE
echo -e "\033]6;1;bg;blue;brightness;83\a"$PRELINE
;;
orange)
echo -e "\033]6;1;bg;red;brightness;227\a"$PRELINE
echo -e "\033]6;1;bg;green;brightness;143\a"$PRELINE
echo -e "\033]6;1;bg;blue;brightness;10\a"$PRELINE
;;
*)
random
esac
}