Skip to content

Instantly share code, notes, and snippets.

View mansurali901's full-sized avatar

Mansur Ul Hasan mansurali901

View GitHub Profile
@mansurali901
mansurali901 / main_ec2_complete_setup.tf
Last active June 7, 2019 13:52
This script setup whole infrastructure on AWS to run ec2 instance this will include VPC Setup (Including : "VPC", "Subnet", "internet Gateway", "Route Table", "Security Group to allow SSH") also it sets up EC2 Instance along with keypairs
##############################
# This script setup whole infrastructure on AWS to run ec2 instance this will include VPC Setup
# (Including : "VPC", "Subnet", "internet Gateway", "Route Table", "Security Group to allow SSH")
# also it sets up EC2 Instance along with keypairs
##############################
### Provider Setup
provider "aws" {
region = "us-east-2"
}
### Variables declearation
@mansurali901
mansurali901 / InstallHAProxy_ubuntu.sh
Created May 8, 2019 08:28
This script will automate process for HAProxy installation
#!/bin/bash
# This script will install HAproxy with LUA+SSL support
# Author : Mansur Ul Hasan
# Email : [email protected]
# Disclaimer : This script is well tested on ubuntu if you are using RPM based distros please install relevant packages
CheckOS () {
#!/bin/bash
# Get current swap usage for all running processes
# Mansur Ul Hasan 04/02/2017
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
do
#!/bin/bash
GoMongo () {
echo "Mongo is going to start"
mongod --config /etc/mongod.conf
echo "mongo is started"
}
StopMongo () {
#!/bin/bash
MONGOD=`ps aux |grep mongod |grep -v grep |awk '{print $2}'`
MONGOCOUNT=`ps aux |grep mongod |grep -v grep |awk '{print $2}'|wc -l`
mail_func () {
echo $MONGOD > /tmp/email
mail -s "Mongo is not running " [email protected] < /tmp/email
}
#!/bin/bash
arg=$@
if [ $# -le '2' ];
then
echo "Script has sufficient parameter"
else
echo "Invalid parameter"
fi
@mansurali901
mansurali901 / KubernetesSetupUbuntu.sh
Last active December 25, 2020 02:29
This script is meant to setup Kubernetes Environment on Ubuntu / Debian supported paltforms
#!/bin/bash
# Maintainer : Mansur Ul Hasan
# EMail : [email protected]
# LinkedIn : https://www.linkedin.com/in/mansurulhasan/
# Youtube : https://www.youtube.com/user/mansur7820/
# This script is meant to setup Kubernetes Environment on Ubuntu / Debian supported paltforms
# We have try to cover all the required tools modules which needed by modern kubernetes
# Disclaimer :
# This script is well tested on ubuntu 18 and 16
@mansurali901
mansurali901 / Setup_DockerOld_Ubuntu.sh
Last active March 27, 2019 09:29
This script is used to install older version of docker using deb package
#!/bin/bash
# This script is used to install older version of docker
# using deb package
# Author Mansur Ul Hasan
# EMail [email protected]
InstallDep () {
echo "deb http://security.ubuntu.com/ubuntu trusty-security main" >> /etc/apt/sources.list
apt-get update
apt-get install build-essential -y
<?php
# This Script is writted according to my test environment
# Before testing script you must need to create database
# and some sample data into Database
# Follow below steps before running this PHP Script
#// --> CREATE DATABASE mem_test;
#// --> USE mem_test;
#// --> GRANT ALL ON mem_test.* TO test@localhost IDENTIFIED BY 'testing123';
#// --> CREATE TABLE sample_data (id int, name varchar(30));
#// --> INSERT INTO sample_data VALUES (1, "some_data");
@mansurali901
mansurali901 / PHP_test_memcache.php
Created August 21, 2018 18:11
A PHP Script to test memcache server
<?php
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";