This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
convertsecs() { | |
((h=${1}/3600)) | |
((m=(${1}%3600)/60)) | |
((s=${1}%60)) | |
printf "%02d:%02d:%02d\n" $h $m $s | |
} | |
started=$(date +%s) | |
current=$started |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# testing cm-queue.sh from: https://gist.github.com/mathew-fleisch/9743d9801cc2ce3bd6aa678b49cd8ea6 | |
ns=default | |
cmqueue=test-queue | |
cmkey=queue | |
function setup_test() { | |
echo "Setting up queue..." | |
./cm-queue.sh $ns $cmqueue $cmkey delete \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ns=$1 | |
cm=$2 | |
cmkey=$3 | |
# actions: getfirst, getlast, getall, getyaml, shift, pop, prepend, append, delete | |
action=$4 | |
cmval=$5 | |
k="kubectl -n $ns" | |
jp="jsonpath='{.data.$cmkey}'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
get_dirs() { | |
dir=$(realpath $1) | |
for d in $dir/*/; do | |
if [[ -d $d ]]; then | |
du -sh $d | |
get_dirs $d | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get maximum multiple of all possible values in array of integers | |
// [1, 2 , 5 , 0, 100] 500 | |
let arr = [-300, -10, 1, 2 , 5 , 0, 100, 99] | |
// let arr = [-3000, -10, 1, 2 , 5 , 0, 100, 99] | |
// let arr = [-3000, 10, 1, 2 , 5 , 0, 100, 99] | |
function getHighestMultiple(arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage="usage: decode-all-kubernetes-secrets.sh [context] [namespace]" | |
context=${1:-} | |
namespace=${2:-} | |
if [[ -z "$context" ]]; then | |
echo "Missing context" | |
echo "$usage" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shellcheck disable=SC2086 | |
set -eou pipefail | |
_git_token="${GIT_TOKEN:-}" | |
repo_owner="${1:-}" | |
repo_name="${2:-}" | |
git_tag="${3:-}" | |
asset_filename="${4:-}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get population of california by county (json) | |
POPULATION_URL=https://www.california-demographics.com/counties_by_population | |
POPULATION=$(curl -s $POPULATION_URL | tr '\n' ' ' | sed -e 's/\s\s*/ /g' | sed -e 's/.*th>//g' | sed -e 's/<td colspan.*//'g | sed -e 's/<tr>/\n/g' | sed -e 's/.*demographics">/"/g' | sed -e 's/<\/a.*<td>\ /":/g' | sed -e 's/\ <\/td.*//g' | sed -e 's/,//g' | sed -e 's/<\/tr>//g' | tr '\n' ',' | sed -e 's/^\s*,//g' | sed -e 's/,\s*$//g' | sed -e 's/\ County//g' | sed -e 's/\(.*\)/{\1}/g' | jq --slurp -c '.[]') | |
# echo "population: $POPULATION_URL" | |
# echo "$POPULATION" | |
# echo "------------------------------" | |
# Get totals infected for each county | |
DATA_SOURCE=926fd08f-cc91-4828-af38-bd45de97f8c3 |
NewerOlder