Skip to content

Instantly share code, notes, and snippets.

View Ankit-Kulkarni's full-sized avatar
🎯
Focusing

Ankit Kulkarni Ankit-Kulkarni

🎯
Focusing
View GitHub Profile
@Ankit-Kulkarni
Ankit-Kulkarni / pssh_type_client.py
Created November 27, 2018 09:11
A pssh type client to run commands in parallel on multiple server. The script output is only shown after gathering all outputs.
#!/usr/bin/env python3
""" This script is used to ssh parallel on multiple machines and get the output
Sample run is - python pssh.py ubuntu@31.215.xx.xx ubuntu@xx.xx.xx.xx:port
"""
import sys
from fabric import ThreadingGroup as Group
@Ankit-Kulkarni
Ankit-Kulkarni / create_arch_vpc_subnet_ec2_packages.json
Last active October 10, 2018 13:02
AWS cloudformation template to create single VPC, multiple subnets(public and private) with NAT,route tables,network acl's , elasticip for nat , internet gateway for vpc and configure rules for the subnets to talk to internet and talk via NAT(in case of private subnet) in multiple Avalibility zones, an EC2 instance with Elastic ip and install je…
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS cloudformation template to create single VPC, multiple subnets(public and private) with NAT,route tables,network acl's , elasticip for nat , internet gateway for vpc and configure rules for the subnets to talk to internet and talk via NAT(in case of private subnet) in multiple Avalibility zones, An EC2 instance with Elastic ip and install jenkins/nginx/ansible on it.",
"Parameters": {
"VpcCIDR": {
"Description": "Gives the vpc CIDR",
"Type": "String",
"Default": "10.11.0.0/16"
},
"AvailabilityZone1": {
@Ankit-Kulkarni
Ankit-Kulkarni / jenkins-nginx.conf
Created October 10, 2018 11:35
A standard jenkins configuration
server {
listen 80;
server_name InstancePublicIp;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@Ankit-Kulkarni
Ankit-Kulkarni / install_tmux_coreos.sh
Created September 10, 2018 16:17
Install tmux in coreos
#!/bin/bash
# REF: Sean Kane https://groups.google.com/d/msg/coreos-dev/JAeABXnQzuE/8v_SIPsnCAAJ
# create a directory
sudo mkdir -p /opt/bin
sudo chown -R $(whoami):$(whoami) /opt
sudo sh -c 'echo "export PATH=$PATH:/opt/bin" >> /etc/environment'
cd /opt/bin
wget http://s.minos.io/s -O static-get
chmod a+rx ./static-get
cd /opt
@Ankit-Kulkarni
Ankit-Kulkarni / vpc_public_private_subnet_setup_with_nat.json
Last active August 3, 2018 13:00
VPC public and private subnet pair setup in multiple Availiblity zones for high availiblity. The script also has boolean options in parameters to create only the required setup.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS cloudformation template to create single VPC,subnet,route tables",
"Parameters": {
"VpcCIDR": {
"Description": "Gives the vpc CIDR",
"Type": "String",
"Default": "10.3.0.0/16"
},
"AvailabilityZone1": {
@Ankit-Kulkarni
Ankit-Kulkarni / create_ec2_using_cloudformation.json
Last active August 3, 2018 14:07
Create ec2 instance with custom root volume size using aws cloudformation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS cloudformation template to create EC2 instancewith custom root volume size",
"Parameters": {
"InstanceType": {
"Description": "WebServer EC2 instance type",
"Type": "String",
"Default": "t2.small",
"AllowedValues": [
"t1.micro",
@Ankit-Kulkarni
Ankit-Kulkarni / How to install ansible.md
Last active November 18, 2016 09:37
Simple installation instructions on how to install ansible

#Ansible - Quick overview

How to install ansible

using ubuntu :
sudo apt-get install ansible

Using pip(for mac users ) :
pip install ansible

@Ankit-Kulkarni
Ankit-Kulkarni / mandril-sendmail.py
Created February 23, 2016 10:23
Send mails using Mandril + python . Get you mandril api key and start sending mails
#!/usr/bin/env python
# run using below command
# >> python mandril-sendmail.py "Subject" "Recipent" "Body"
import sys
import mandrill
import logging
# calling this would be python SCRIPT_NAME.py "Subject" "Recipent" "body"
@Ankit-Kulkarni
Ankit-Kulkarni / fetch_special_urls_from_websites
Last active January 4, 2016 00:59
Code to list the particular file types from any weblink. The following code for example takes the url from a Indian scholarship site and creates another html file with all the html links found of a particular pattern/string (here pattern == "Applications_Details.aspx" ).
#!/bin/env python
# Code to list the particular file types from any weblink
# importing libraries
import urllib as ul
import lxml.html , urlparse
import urllib2
# defined base url