Skip to content

Instantly share code, notes, and snippets.

View moziauddin's full-sized avatar
🥇
winning

moziauddin moziauddin

🥇
winning
  • Australia
View GitHub Profile
#--------------------------------------------------------------------------------------------------------------
# Add Permanent SWAP 8GB
# Create swap file
sudo fallocate -l 8G /swapfile
#Change Permissions
sudo chmod 600 /swapfile
#Mark the file as swap space
sudo mkswap /swapfile
#enable the swap file, allowing our system to start utilizing it
sudo swapon /swapfile
# Ignore ansible version check based on tags. Skip tasks with certain tags...
ansible-playbook -i /tmp/inv pbook.yml -u ubuntu -b `--skip-tags={{ tag_name_version_check }}`
aws ec2 describe-snapshots --owner-id 194924002687 | jq
499 aws ec2 describe-snapshots --owner-id 194924002687 | jq > /tmp/mo-sample.json
500 aws ec2 describe-snapshots --owner-id 194924002687 | jq . > /tmp/mo-sample.json
501 aws ec2 describe-snapshots --owner-id 194924002687 | jq '.' > /tmp/mo-sample.json
502 less /tmp/mo-sample.json
503 less /tmp/mo-sample.json | jq '.Snapshots'
504 less /tmp/mo-sample.json | jq '.Snapshots | length'
505 less /tmp/mo-sample.json | jq '.Snapshots' | less
506 less /tmp/mo-sample.json | jq '.' | less
507 less /tmp/mo-sample.json | jq '.Snapshots[0]'
#------------------------------------------------------------------------------------------------------
# Copy files using S3 while adding a Key with Date
mo@linux-jzir:~> export AWS_DATE=`date +"%Y-%m-%d"`
mo@linux-jzir:~> echo $AWS_DATE
2018-06-18
mo@linux-jzir:~> aws s3 cp initscript.sh s3://nxlbackup/NAQS/dailycopy/`date +"%Y-%m-%d"`/ --profile s3user
#------------------------------------------------------------------------------------------------------
@moziauddin
moziauddin / Powershell
Last active December 26, 2018 10:12
Windows Scripts
# Install Google Chrome from powershell - Windows 7, 10 and server 2012
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec
#--------------------------------------------------------------------------------------------------------------
# EXPORT MetaData.xml USING Windows Powershell ON A ADFS 3.0 SERVER ONTO THE ROOT OF C DRIVE
$metaUrl = (Get-ADFSEndpoint | where Protocol -eq "Federation Metadata").FullUrl.ToString()
$httpHelper = new-object System.Net.WebClient
$metadataAsString = $httpHelper.DownloadString($metaUrl)
$httpHelper.DownloadFile($metaUrl , "C:\metadata.xml")
# Jenkins setup to use reverse proxy using nginx to listen on port 80
sudo apt-get install nginx -y
sudo rm -rf /etc/nginx/sites-enabled/default
# Copy the below configuration to /etc/nginx/sites-available/jenkins
# Create a sym link from /etc/nginx/sites-available/jenkins to /etc/nginx/sites-enabled/jenkins
# Copy the certificate and ket files to the right folder
sudo service jenkins restart
sudo service nginx restart
@moziauddin
moziauddin / BNTI.md
Created August 8, 2018 05:19 — forked from mbohun/BNTI.md
BNTI env setup, full-automation

THIS IS WORK IN PROGRESS

BNTi env setup

Intro

  • java version: ORACLE jdk1.8.0_171 (use latest stable in 1.8)
  • jruby: 9.1.13.0
  • tomcat version: 8.5.13 (use latest stable in 8.5)
@moziauddin
moziauddin / constant-mem-loop-with-ts.sh
Last active October 25, 2018 12:42
Splunk 7.2 Installer
#!/bin/sh
while (sleep 2); do free -m | grep 'Mem:' | perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime' >> /opt/splunkforwarder/cscripts/mylogfile ; done
#!/bin/bash
sudo apt-get install libxss1 libappindicator1 libindicator7
sudo apt-get install libxi6 libgconf-2-4
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get install -f
sudo apt-get install xvfb
sudo apt-get install unzip
wget -N http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
#!/bin/bash
# sudo vim /etc/hosts
sudo apt-get install openjdk-8-jre openjdk-8-jre-headless
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update -y
sudo apt-get install puppetserver -y
# sudo vim /etc/default/puppetserver
puppet resource service puppetserver enable=true
puppet resource service puppetserver ensure=running