Download Repo in /var/www/ folder.
View acsrujan_resume.py
This file contains 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
''' | |
If you're viewing it from pdf, original program can be found at: https://gist.github.com/acsrujan/15e211400258871f538a | |
To run download the file as it is. | |
Make sure you've python installed. (run python --version in terminal) | |
python filename.py -h will show the help line. (Make sure to change the file name.) | |
python filename.py -c will show contacts. and so on. | |
''' |
View install_postgres.sh
This file contains 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
sudo touch /etc/apt/sources.list.d/pgdg.list | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -y install postgresql-9.3 libpq-dev postgresql-contrib-9.3 | |
sudo apt-get autoremove | |
sudo pg_dropcluster --stop 9.3 main | |
sudo pg_createcluster --start -e UTF-8 9.3 main |
View git_find_big.sh
This file contains 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 | |
#set -x | |
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output | |
IFS=$'\n'; | |
# list all objects including their size, sort by size, take top 10 | |
objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head` | |
echo "All sizes are in kB's. The pack column is the size of the object, compressed, inside the pack file." |
View scheduled_ami.sh
This file contains 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 | |
#---The following is to create AMI of server daily---# | |
echo "instance-`date +%d%b%y`" > /tmp/ami-name.txt | |
INSTANCE_ID=$1 #Pass instance id as arguement or change hardcode it here. | |
aws ec2 create-image --instance-id $INSTANCE_ID --name "`cat /tmp/ami-name.txt`" --description "This is daily auto AMI by Cron" --no-reboot | grep -i ami | awk '{print $2}' > /tmp/ami-id.txt | |
#---The following is to remove AMIs older than 3 days---# | |
echo "instance-`date +%d%b%y --date '3 days ago'`" > /tmp/ami-delete.txt | |
aws ec2 describe-images --filters "Name=name,Values=`cat /tmp/ami-delete.txt`" | grep -i imageid | awk '{ print $2 }' > /tmp/image-id.txt |
View deploy_loadbalancer.sh
This file contains 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 |
View params_windows.py
This file contains 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] |
View rails_log_parse.sh
This file contains 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 |
View ELB-detach-attach.sh
This file contains 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 |
View gist:9c1e564ae337dff56419989e8587c694
This file contains 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``` |
OlderNewer