This file contains 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
# sqs (unit test) | |
# input: {"id": "data1"} | |
# push, pop, mark_complete, mark_pending | |
QUEUE="./queue.txt" | |
# echo "{\"id\":\"data1\"}" > queue.txt | |
# cat queue.txt | |
mypush() { | |
if [ -z "$1" ]; then |
This file contains 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 | |
#class RateLimiter { | |
# public: | |
# // rate is an integer num requests per second | |
# RateLimiter(int rate) { | |
# } | |
# bool IsAllowed() { | |
# //implement this |
This file contains 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 | |
if [ -z "$1" ]; then | |
echo "Missing org name" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "Missing action: clone,pull,search" | |
exit 1 | |
fi |
This file contains 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 | |
if [ -z "$1" ]; then | |
echo "Missing org name" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "Missing action: clone,pull" | |
exit 1 | |
fi |
This file contains 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 | |
rm -rf tmp | |
mkdir -p tmp | |
if [ -z "$1" ]; then | |
echo "Missing org name" | |
exit 1 | |
fi | |
if [ -z "$GIT_TOKEN" ]; then | |
echo "Missing git token" |
This file contains 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
# Goal: install java11, maven, gradle, kops and terraform in an empty ubuntu docker container | |
############################# From Host ############################# | |
# Remove previous tests if present | |
[ -n "$(docker ps -q --filter name=test-dependency-installer)" ] \ | |
&& docker rm -f $(docker ps -q --filter name=test-dependency-installer); | |
# Spin up empty docker ubuntu container | |
docker run -dit --name test-dependency-installer ubuntu:latest | |
docker exec -it $(docker ps -q --filter name=test-dependency-installer) /bin/bash | |
############################# From Host ############################# |
This file contains 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 |
This file contains 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 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 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) { |