Skip to content

Instantly share code, notes, and snippets.

View nirbhabbarat's full-sized avatar
🎯
Focusing

Nirbhab Barat nirbhabbarat

🎯
Focusing
  • Gurgaon
View GitHub Profile
@nirbhabbarat
nirbhabbarat / search_ec2_by_private_ip.py
Created June 29, 2021 05:36
Search ec2 by private_ip
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@nirbhabbarat
nirbhabbarat / ec2-export.sh
Last active November 6, 2020 14:33
ec2-export.sh
# export AWS_PROFILE=prod
for region in `aws ec2 describe-regions --output text | cut -f4`
do
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --region $region --output text --query 'Reservations[*].Instances[*].[InstanceId, InstanceType, State.Name, Placement.AvailabilityZone, PrivateIpAddress, PublicIpAddress, InstanceLifecycle, Platform, [Tags[?Key==`Name`].Value] [0][0] ]' >> ec2-instances.tsv
done
@nirbhabbarat
nirbhabbarat / getS3BucketSize.py
Created November 4, 2020 16:51 — forked from joehack3r/getS3BucketSize.py
Example Python for get S3 Bucket Size
#!/usr/bin/env python
# This is how I used to write Python scripts. I'm trying to improve:
# https://github.com/joehack3r/aws/blob/master/scripts/s3/getS3BucketSize.py
import argparse
import boto
# Arguments
parser = argparse.ArgumentParser(description='Calcualte S3 bucket size in GB')
@nirbhabbarat
nirbhabbarat / devops_best_practices.md
Created November 1, 2020 10:09 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud

#!/usr/bin/env bash
set -e
VERSION_INGRESS=0.13.0
[[ -d ~/Sites/ingress-nginx ]] || git clone [email protected]:kubernetes/ingress-nginx.git ~/Sites/ingress-nginx
cd ~/Sites/ingress-nginx
sh test/e2e/wait-for-nginx.sh || echo "ERROR: This will attempt to deploy a newer version, which does not work..."
kubectl set image \
deployments \
--namespace ingress-nginx \
--selector app=ingress-nginx \
@nirbhabbarat
nirbhabbarat / setup_selenium.sh
Created November 1, 2020 10:08 — forked from jpswade/setup_selenium.sh
Setup Selenium
brew install selenium-server-standalone
brew cask install chromedriver
selenium-server -p 4444
FROM php:7.3-apache
MAINTAINER James Wade <[email protected]>
# Install gd, iconv, mbstring, mcrypt, mysql, soap, sockets, zip, and zlib extensions
# see example at https://hub.docker.com/_/php/
RUN apt-get update && apt-get install -y \
libbz2-dev \
libfreetype6-dev \
libgd-dev \
libjpeg62-turbo-dev \
@nirbhabbarat
nirbhabbarat / json2csv.php
Created November 1, 2020 10:07 — forked from jpswade/json2csv.php
convert from a multi-dimensional json object to a flat csv table
<?php
/**
* @param string $jsonFilename
* @param string $csvFilename
* @return bool|int
*/
function json2csv($jsonFilename, $csvFilename)
{
$json = file_get_contents($jsonFilename);
@nirbhabbarat
nirbhabbarat / php7.4-fpm-alpine
Created November 1, 2020 10:07 — forked from jpswade/php7.4-fpm-alpine
PHP 7.4 PHP-FPM Alpine with core extensions gd
FROM php:7.4-fpm-alpine
# @see https://hub.docker.com/r/jpswade/php7.4-fpm-alpine
MAINTAINER Agent Software <[email protected]>
# Install gd, iconv, mbstring, mysql, soap, sockets, zip, and zlib extensions
# see example at https://hub.docker.com/_/php/
RUN apk add --update \
$PHPIZE_DEPS \
freetype-dev \
git \
@nirbhabbarat
nirbhabbarat / centos7-kube-install.md
Last active January 23, 2023 17:29
install kubernetes on centos 7 vagrant

Create CentOS 7

vagrant init centos/7
vagrant up

Disable SELinux & setup firewall rules

hostnamectl set-hostname 'k8s-master'
exec bash