Skip to content

Instantly share code, notes, and snippets.

View susovanpanja's full-sized avatar

Susovan Panja susovanpanja

  • Mohali
View GitHub Profile
@susovanpanja
susovanpanja / sns-publish
Created March 26, 2018 06:47 — forked from jeremypruitt/sns-publish
AWS Lambda function to publish to SNS topic
console.log('Loading function');
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2';
exports.handler = function(event, context) {
console.log("\n\nLoading handler\n\n");
var sns = new AWS.SNS();
sns.publish({
@susovanpanja
susovanpanja / cft-travis-sample.yml
Created April 10, 2018 12:38 — forked from grdnrio/cft-travis-sample.yml
Example Travis file for verifying CloudFormation templates
language: ruby
git:
submodules: false
env:
global:
- AWS_DEFAULT_REGION=eu-west-1
- secure: somestring
- secure: somestring
@susovanpanja
susovanpanja / wget-jdk-oracle-install-example.txt
Created June 11, 2018 08:10 — forked from sr75/wget-jdk-oracle-install-example.txt
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
The following characters have special meaning to the shell itself in some contexts and may need to be escaped in arguments:
` Backtick (U+0060 Grave Accent)
~ Tilde (U+007E)
! Exclamation mark (U+0021)
# Hash (U+0023 Number Sign)
$ Dollar sign (U+0024)
& Ampersand (U+0026)
* Asterisk (U+002A)
( Left Parenthesis (U+0028)
@susovanpanja
susovanpanja / mongodb-s3-backup.sh
Created February 11, 2019 12:26 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@susovanpanja
susovanpanja / clean_old_lambda_versions.py
Created June 28, 2019 10:45 — forked from tobywf/clean_old_lambda_versions.py
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@susovanpanja
susovanpanja / aws_cli_mfa_token.sh
Created September 18, 2019 15:55
MFA token to authenticate for AWS CLI
### What we are trying to achieve is this: (https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/) with automatic script ###
### Remember you need to install aws-cli and use aws configure to add the credentails, to run aws commands ###
### Also assuming you have enabled MFA on aws console and know how to generate MFA code using Authy/Google Authenticator/ etc.
#!/bin/bash -xe
# Getting temporary credentails from aws using MFA token from authy or google authenticator
ARN=arn:aws:iam::{Account ID}:mfa/{UserName}
# checking for aws path
@susovanpanja
susovanpanja / refresh-certs.sh
Created May 27, 2020 09:05 — forked from ktsakalozos/refresh-certs.sh
Refresh MicroK8s Certs
#!/bin/bash
set -eu
export SNAP_NAME="microk8s"
export SNAP_DATA="/var/snap/microk8s/current/"
export SNAP="/snap/microk8s/current/"
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
source $SNAP/actions/common/utils.sh
@susovanpanja
susovanpanja / resignation.txt
Created June 28, 2021 16:16 — forked from QuinnyPig/resignation.txt
Templated resignation letter
Dear BOSS,
Please accept this letter as formal notification that I am resigning from my position as JOB TITLE with COMPANY. My last day will be DATE OF LAST DAY.
Thank you so much for the opportunity to work in this position for the past DURATION. I’ve greatly enjoyed and appreciated the opportunities I’ve had to WTF DID YOU DO, and I’ve learned many things, all of which I will take with me throughout my career.
During my last two weeks, I’ll do everything possible to wrap up my duties and train other team members. Please let me know if there’s anything else I can do to aid during the transition.
I wish COMPANY continued success, and I hope to stay in touch in the future.
Sincerely,
#### This script is written to update your kubeconfig file for eks. It will first get sts token for the role, that is mapped
#### with EKS cluster kubernetes using aws_auth config map. And then update your kubeconfig file for the cluster.
#### Replace role-arn with the role that is mapped with EKS cluster kubernetes using aws_auth config map.
#### Ref: https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html
#!/bin/bash
echo $(whoami)