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 | |
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
#!/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 | |
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 | |
#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
# 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
# Given an array of integers, return indices of the two numbers | |
# such that they add up to a specific target. | |
# You may assume that each input would have exactly one solution, | |
# and you may not use the same element twice. | |
# Example: [1,2,3,4], 7 -> 2,3 | |
# chmod +x get-sum-target-index-thing.sh && ./get-sum-target-index-thing.sh 7 1 2 3 4 | |
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
# ENV-DEPLOYMENT_ID-APP_NAME-INSTANCE_NUM.DOMAIN | |
# Prod-20160502-app-02.company.local | |
# Qa-20181001-app-02.company.local | |
# Qa-20181001-app-04.company.local | |
# Qa-20181002-myapp-01.company.local | |
# | |
# # ENV<TAB>APP_NAME<TAB>DEPLOYMENT_ID<TAB>COUNT_OF_INSTANCES | |
# Prod app 20160502 1 | |
# Qa app 20181001 2 | |
# Qa myapp 20181002 1 |
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 | |
# Methods for working with json in bash | |
# ************************************************************* # | |
# Setup | |
BUCKET_NAME=testbucket | |
OBJECT_NAME=testworkflow-2.0.1.jar | |
TARGET_LOCATION=/opt/test/testworkflow-2.0.1.jar |
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
matrix = [["(","("],[")",")"]] | |
matrix1 = [["(","("],["(",")"]] | |
matrix2 = [["(",")"],[")",")"]] | |
matrix3 = [["(",")"],["(",")"]] | |
console.log(`isBalanced(${JSON.stringify(matrix)}) => ${isBalanced(matrix)}`) | |
console.log(`isBalanced(${JSON.stringify(matrix1)}) => ${isBalanced(matrix1)}`) | |
console.log(`isBalanced(${JSON.stringify(matrix2)}) => ${isBalanced(matrix2)}`) | |
console.log(`isBalanced(${JSON.stringify(matrix3)}) => ${isBalanced(matrix3)}`) |