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 [ $# != 1 ]; then | |
echo "Usage: AWS_PROFILE=<aws-profile> ./$0 <region>" | |
exit 1 | |
fi | |
aws ec2 describe-availability-zones --region "$1" | jq -r '.AvailabilityZones[] | .ZoneId + "=" + .ZoneName' |
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 | |
for i in $(aws elbv2 describe-load-balancers --query 'LoadBalancers[*].LoadBalancerArn'| jq -r '.[]'); do | |
tgCount=$(aws elbv2 describe-target-groups --load-balancer-arn "$i" --query 'TargetGroups[*].TargetGroupArn' | jq -r '.[]'|wc -l) | |
if [ "$tgCount" -eq 0 ]; then | |
echo "No TG registered on LB: $i" | |
else | |
for t in $(aws elbv2 describe-target-groups --load-balancer-arn "$i" --query 'TargetGroups[*].TargetGroupArn' | jq -r '.[]'); do | |
instanceCount=$(aws elbv2 describe-target-health --target-group-arn "$t" --query 'TargetHealthDescriptions[*].[Target.Id,TargetHealth.State]' | jq -r '.[]' | wc -l) | |
if [ "$instanceCount" -eq 0 ]; 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
--- select indexes | |
SELECT tablename, indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' ORDER BY tablename, indexname; | |
--- list functions | |
\df public.* | |
--- list lastvalue | |
SELECT MAX(id) FROM <table name>; |
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
//gcc -static -std=c99 -Wall remove_old_data.c -I./src -L. -lbson -lmongoc -o remove_old_data | |
/* remove_old_data.c */ | |
#include "bson.h" | |
#include "mongo.h" | |
int main() { | |
bson_buffer bb; | |
bson cond; |
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
//scons | |
//gcc -static -std=c99 -Wall compressed_data.c -I./src -L. -lbson -lmongoc -o compressed_data | |
/* compressed_promiselog.c */ | |
#include "bson.h" | |
#include "mongo.h" | |
int main() { | |
bson b, key, setOp; | |
bson_buffer bb; |