Skip to content

Instantly share code, notes, and snippets.

View briskgopesh's full-sized avatar
✌️
Talent wins games, but teamwork and intelligence wins championships.

GOPESH CHAUDHARY briskgopesh

✌️
Talent wins games, but teamwork and intelligence wins championships.
  • Verloop.io
View GitHub Profile
@briskgopesh
briskgopesh / aws-cleanup.sh
Created August 25, 2020 13:55 — forked from willgarcia/aws-cleanup.sh
Delete all AWS resources (lambdas, cloudfront distribs, ec2, lb, api-gateways, ...)
#!/bin/bash
set -e
AWS_FUNCTIONS=$(aws lambda list-functions --query "Functions[].FunctionArn")
for func in $AWS_FUNCTIONS
do
CMD="aws lambda delete-function --function-name $func"
echo $CMD
$CMD
@briskgopesh
briskgopesh / vgoget.sh
Created August 25, 2020 07:57 — forked from rogpeppe/vgoget.sh
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"
@briskgopesh
briskgopesh / vgoget.sh
Created August 25, 2020 07:57 — forked from rogpeppe/vgoget.sh
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"
@briskgopesh
briskgopesh / cleanup-ecr.rb
Created August 23, 2020 14:04 — forked from dmerrick/cleanup-ecr.rb
Delete old ECR images
#!/usr/bin/env ruby
# this script will delete ECR images that are older than N days
require 'date'
require 'json'
# customize this script
repo = 'snapdocs'
delete_if_older_than = 60 # days
@briskgopesh
briskgopesh / apply-ecr-lifecycle-policy.sh
Created August 23, 2020 12:18 — forked from shcallaway/apply-ecr-lifecycle-policy.sh
Apply the same lifecycle policy to all AWS ECR repositories
#!/bin/bash
aws ecr describe-repositories | jq '.repositories[].repositoryName' | xargs -I {} aws ecr put-lifecycle-policy --repository-name {} --lifecycle-policy-text "file://policy.json"
@briskgopesh
briskgopesh / git-remote-rename.sh
Created August 13, 2020 12:18 — forked from jsborjesson/git-remote-rename.sh
Recursively updates git remotes when you've renamed an organization
#!/bin/sh
for i in $(find $PWD -maxdepth 1 -type d); do
cd $i
if [ -d .git ]; then
remotes=$(git remote -v)
if [[ "$remotes" =~ origin.git@github.com:myorg ]]; then
git remote set-url origin git@github.com:myneworg/$(basename `git rev-parse --show-toplevel`)
fi
fi
cd ..
import hudson.model.*
def q = Jenkins.instance.queue
q.items.each {
if (it =~ /deploy-to/) {
q.cancel(it.task)
}
}
@briskgopesh
briskgopesh / update-route53.sh
Created August 10, 2020 23:28 — forked from phybros/update-route53.sh
BASH Script to keep Route53 updated with your current external IP address
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID="enter zone id here"
# The CNAME you want to update e.g. hello.example.com
@briskgopesh
briskgopesh / reload.sh
Created August 6, 2020 16:36 — forked from philchristensen/reload.sh
Execute docker commands for particular containers
#!/bin/bash -x
WEBAPPS=$(docker ps | grep "philchristensen/insite:latest" | awk '{print $1}')
WORKERS=$(docker ps | grep "philchristensen/insite:worker" | awk '{print $1}')
BEATER=$(docker ps | grep "philchristensen/insite:beat" | awk '{print $1}')
find /opt/insite-web -name '*.pyc' -delete
echo "$WEBAPPS" | xargs -I ID docker exec ID pip install -r requirements.txt
date > /opt/insite-web/reload
@briskgopesh
briskgopesh / helpful-docker-commands.sh
Created August 6, 2020 04:14 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container