Download Repo in /var/www/ folder.
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
#To rotate file every 100kb, truncate the file and delete the older logs. | |
#This keeps only latest 100kb. | |
/var/logs/randomdump.log | |
{ | |
size 100k | |
copytruncate | |
rotate 0 | |
} | |
# Copytruncate avoids file delete and create new file. |
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
--- | |
- hosts: all | |
tasks: | |
- name: Installs homebrew if not already present | |
command: brew -v | |
register: brew_check | |
- name: install homebrew with curl | |
command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
when: brew_check.stdout.find('command not found') > -1 |
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
--- | |
#Updates sudo file on ubuntu with NOPASSWD for all users. | |
- hosts: all | |
sudo: yes | |
tasks: | |
- name: Allow 'sudo' group to have passwordless sudo | |
lineinfile: | |
dest: /etc/sudoers | |
state: present | |
regexp: '^%sudo' |
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 | |
START=`date +%s` | |
while [ $(( $(date +%s) - 30 )) -lt $START ]; do | |
{ time nc -zw30 <host ip> <port>;} |& grep real | awk '{print $2}' | |
done |
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
To find largest inode directory. | |
```for i in /*; do echo $i; find $i |wc -l; done``` |
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 | |
LOAD_BALANCER_NAME=$1 | |
Instance_ids_str=`aws elb describe-load-balancers --load-balancer-name $LOAD_BALANCER_NAME --query "LoadBalancerDescriptions[*].{ID:LoadBalancerName,InstanceId:Instances[*].InstanceId}[*]. {ELB:ID,InstanceId:InstanceId[*]}" --output=json |jq -r ".[].InstanceId|@csv" |sed 's/\"//g'` | |
IFS=',' read -a Instance_ids_array <<< "$Instance_ids_str" | |
for INSTANCE_ID in ${Instance_ids_array[$RANDOM % ${#Instance_ids_array[@]}]} | |
do | |
aws elb deregister-instances-from-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID | |
aws elb register-instances-with-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID | |
done |
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
arr=```grep -o "in.*ms" $LOG_FILE_NAME | awk '{if ($2-75000ms > 0) print $2}' | sort -r -n``` | for i in $arr; do grep -B 1 $i $LOG_FILE_NAME |awk '{print $2 FS $3}'; echo $i; done |
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
import platform | |
import os | |
import multiprocessing | |
os_name = platform.system() | |
print ("os_name:"+os_name) | |
os_version = platform.version() | |
print ("os_version:"+os_version) | |
cpu_architecture = platform.architecture()[0] |
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
$LOAD_BALANCER_NAME="" | |
Instance_ids=`aws elb describe-load-balancers --load-balancer-name $LOAD_BALANCER_NAME --query "LoadBalancerDescriptions[*].{ID:LoadBalancerName,InstanceId:Instances[*].InstanceId}[*]. {ELB:ID,InstanceId:InstanceId[*]}" --output=json |jq -r ".[].InstanceId|@csv"` | |
for $INSTANCE_ID in ${Instance_ids[@]}: | |
do | |
private_ip=`aws ec2 describe-instances --instance-id $id |jq -r '.Reservations[].Instances[] | .PrivateIpAddress'` | |
aws elb deregister-instances-from-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID | |
`ssh $username@$private_ip` < deployment_script.sh | |
aws elb register-instances-with-load-balancer --load-balancer-name $LOAD_BALANCER_NAME --instances $INSTANCE_ID | |
done |