This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## | |
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 () { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GoMongo () { | |
echo "Mongo is going to start" | |
mongod --config /etc/mongod.conf | |
echo "mongo is started" | |
} | |
StopMongo () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
arg=$@ | |
if [ $# -le '2' ]; | |
then | |
echo "Script has sufficient parameter" | |
else | |
echo "Invalid parameter" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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!"; |