Skip to content

Instantly share code, notes, and snippets.

View deepak7093's full-sized avatar
💭
Building...

UniCode deepak7093

💭
Building...
View GitHub Profile
@deepak7093
deepak7093 / docker-cleanup-resources.md
Created April 19, 2018 08:42 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@deepak7093
deepak7093 / s3-keep-private.py
Created April 15, 2018 18:04
Lambda function for check public s3 buckets and modify them back to private
#!/usr/bin/env python3
## Get all s3 bucket list
def list_buckets(client):
try:
bucket_names = []
buckets = client.list_buckets()
@deepak7093
deepak7093 / Gearman.sh
Created March 22, 2018 13:03
Install and setup PHP gearman modules
# Install additional packages for compiling
apt-get update
sudo apt-get -y install gearman-job-server libgearman-dev php7.0-dev php-pear wget unzip re2c
apt-get -y install wget unzip re2c libgearman-dev
# Install from source
mkdir -p /tmp/install
cd /tmp/install
wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
@deepak7093
deepak7093 / nginx_pagespeed.sh
Created March 22, 2018 12:36
Nginx Pagespeed module compile for Nginx
#!/bin/bash
#[check the release notes for the latest version]
NPS_VERSION=1.13.35.2-stable
cd
wget https://github.com/apache/incubator-pagespeed-ngx/archive/v${NPS_VERSION}.zip
unzip v${NPS_VERSION}.zip
nps_dir=$(find . -name "*pagespeed-ngx-${NPS_VERSION}" -type d)
cd "$nps_dir"
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/}
@deepak7093
deepak7093 / jenkins_job_build_history.py
Created March 9, 2018 14:44
Check jenkins job build history by username
#!/usr/bin/env python
## Python fuction to find job run history
import jenkins
USERNAME = ''
PASSWORD = ''
def get_job_build():
server = jenkins.Jenkins('http://localhost:8080', username=USERNAME, password=PASSWORD)
print(server.jobs_count())
@deepak7093
deepak7093 / ansible-summary.md
Created March 1, 2018 07:42 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@deepak7093
deepak7093 / Enable_LB_Access_Logs.py
Created February 28, 2018 07:30
Python script to enable AWS load balancer access logs
import boto3
"""
## Pre-requsites: Need to add tag on loadbalancer as `Environment:Production`.
Name: Enable AccessLogs for production load-balancers
Author: Deepak Dalvi
Version: 1.0.0
"""
AWS_ACCESS_KEY = ''

Kafka Setup

  • Note: The below setup instructions are for a non-production systems. We do not recommend it to be use for production systems.

What is kafka

Apache kafka is an open source stream processing platform developed by apache software foundation.

Prerequisite

Kafka requires java and zookeeper installed on you machine. You can install it using the follwing commands:

provider "google" {
credentials = "${file("/Users/deepakdalavi/Downloads/creds.json")}"
project = ""
region = "asia-south1"
}
resource "google_compute_address" "nat-instance-static-ip" {
name = "nat-instance-static-ip"
region = "asia-south1"
}
#!/bin/bash
MIG_NAME=mongo-multi-az
PRI_DISK=mongo-a
SEC_DISK=mongo-b
# NEW_DISK_NAME=
# SOURCE_SNAPSHOT=snap_name-`date +%d-%m-%Y`
ZONE_A=asia-southeast1-a
ZONE_B=asia-southeast1-b
#MIN_SIZE=`gcloud compute instance-groups managed describe #${MIG_NAME} --zone=${ZONE} | grep minNumReplicas | cut -d ':' -f2`