Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
jaytaylor / RichSQL.scala
Created Mar 12, 2020
Jay's RichSQL.scala from 2012
View RichSQL.scala
/*
* RichSQL.scala
*
* @note I originally found this at
* http://scala.sygneca.com/code/simplifying-jdbc. Since sourcing it I have
* made some improvements.
* -Jay T.
*/
import java.sql.ResultSet
@jaytaylor
jaytaylor / golang_linux_quick_install.md
Last active Mar 8, 2020
Golang Linux quick installer
View golang_linux_quick_install.md
cat > /tmp/install-go.sh << 'EOF'
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset

if [ "${1:-}" = '-v' ]; then
    echo 'INFO: Verbose debug output enabled' 1>&2
@jaytaylor
jaytaylor / ._python_programming_snippets.md
Last active Feb 10, 2020
Jay's Python programming snippets quick reference
View ._python_programming_snippets.md

Python programming snippets

Quick references to common and useful python best-practices programming snippets and boilerplate.

@jaytaylor
jaytaylor / multiline-mutator-v1.awk
Last active Jan 15, 2020
Multi-line search and inject new variable into helm templates.
View multiline-mutator-v1.awk
#
# Multi-line search and inject new variable into helm templates.
#
# n.b. Works somewhat dynamically.
#
BEGIN {
insertion = "{{- include \"bots.k8s-envvars\" . | indent 8 }}"
expr_seq[0] = " +envFrom: *$"
expr_seq[1] = "^{prefix1}( )?- configMapRef: *$"
@jaytaylor
jaytaylor / ubuntu-18.04-web-server-init.sh
Created Nov 3, 2019
Common Ubuntu server setup for LAMP-ish configuration.
View ubuntu-18.04-web-server-init.sh
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
if [ "$1" = '-v' ] ; then
set -o xtrace
shift
fi
@jaytaylor
jaytaylor / java-format-cleanup.sh
Created Oct 8, 2019
Perl-based Java codebase aesthetics format scrubber.
View java-format-cleanup.sh
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
for f in $(find . -name '*.java'); do
perl \
-0 \
-i \
@jaytaylor
jaytaylor / math.sh
Created Aug 8, 2019
Math functions from python as bash "builtins".
View math.sh
#!/usr/bin/env bash
##
#
# @author Jay E. Taylor <jay@jaytaylor.com>
#
# @description Math functions for bash!
#
##
@jaytaylor
jaytaylor / ._bash_shell_programming_snippets.md
Last active Sep 15, 2020
Jay's Bash shell programming snippets quick reference
View ._bash_shell_programming_snippets.md
@jaytaylor
jaytaylor / ._base64-url-shortener-poc.md
Last active May 10, 2020
URL shortener Base-62 encoder / decoder C++ Proof-of-Concept
View ._base64-url-shortener-poc.md
@jaytaylor
jaytaylor / fix-helm-k8s-missing-priorityClass.md
Created Jun 28, 2019
Manual fix for missing priorityClass after helm upgrade
View fix-helm-k8s-missing-priorityClass.md

Problem Statement

I've been hitting cases where kubernetes cluster actions are blocked due to priorityClass being absent after a helm install --upgrade.

For example:

  Type     Reason        Age                  From                    Message
  ----     ------        ----                 ----                    -------
  Warning  FailedCreate  3m (x1405 over 11h)  statefulset-controller  create Pod elasticsearch-data-2 in StatefulSet elasticsearch-data failed error: pods "elasticsearch-data-2" is forbidden: no PriorityClass with name elasticsearch-data was found```
You can’t perform that action at this time.