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 / LICENCE SUBLIME TEXT
Created November 15, 2018 10:16
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@briskgopesh
briskgopesh / attach-elastic-network-interface.sh
Created November 26, 2018 13:27 — forked from amontalban/attach-elastic-network-interface.sh
Attach an ENI (Elastic Network Interface) to an instance
#!/usr/bin/env bash
# This script assigns Elastic Network Interface (ENI) passed as argument to current instance.
# The goal of this script is to attach an ENI to a single instance running in an ASG for example.
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
PROG_NAME=$(basename $0)
AWSCLI=$(which aws)
JQ=$(which jq)
@briskgopesh
briskgopesh / taint_module.sh
Created December 14, 2018 19:31 — forked from justinclayton/taint_module.sh
Terraform: taint all resources from one module
#!/bin/bash
module=$1
for resource in `terraform show -module-depth=1 | grep module.${module} | tr -d ':' | sed -e 's/module.${module}.//'`; do
terraform taint -module ${module} ${resource}
done
@briskgopesh
briskgopesh / aws_billing.sh
Created December 14, 2018 19:34 — forked from justinclayton/aws_billing.sh
Yesterday's AWS Costs
aws ce get-cost-and-usage \
--granularity DAILY \
--time-period Start=$(date -v-1d +%Y-%m-%d),End=$(date +%Y-%m-%d) \
--metrics UnblendedCost \
| jq -r '.ResultsByTime[].Total.UnblendedCost.Amount' \
| ruby -e 'puts "$#{gets.to_f.round(2)}"'
@briskgopesh
briskgopesh / YAML.sublime-settings
Created December 18, 2018 12:43 — forked from elomatreb/YAML.sublime-settings
Make Sublime Text format YAML files correctly
{
"translate_tabs_to_spaces": true,
"tab_size": 2
}
@briskgopesh
briskgopesh / Jenkinsfile
Created January 31, 2019 22:13 — forked from ysegorov/Jenkinsfile
Jenkinsfile example
#!/usr/bin/env groovy
// https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/build-test.groovy
// http://stackoverflow.com/a/40294220
// https://JENKINS_HOST/scriptApproval/ - for script approval
import java.util.Date
def isMaster = env.BRANCH_NAME == 'master'
def isDevelop = env.BRANCH_NAME == 'develop'

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@briskgopesh
briskgopesh / gist:144302759364335daccc7b0551bb869f
Created March 21, 2019 09:48 — forked from rkuzsma/gist:b9a0e342c56479f5e58d654b1341f01e
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@briskgopesh
briskgopesh / gpg_git_signing.md
Created April 8, 2019 14:56 — forked from janhoffmann/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@briskgopesh
briskgopesh / main.tf
Created April 10, 2019 12:32 — forked from brikis98/main.tf
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of