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/sh | |
echo -n "MySQL username: " ; read username | |
echo -n "MySQL password: " ; stty -echo ; read password ; stty echo ; echo | |
mysql -u $username -p"$password" -NBe "SHOW DATABASES;" | grep -v 'lost+found' | while read database ; do | |
mysql -u $username -p"$password" -NBe "SHOW TABLE STATUS;" $database | while read name engine version rowformat rows avgrowlength datalength maxdatalength indexlength datafree autoincrement createtime updatetime checktime collation checksum createoptions comment ; do | |
if [ "$datafree" -gt 0 ] ; then | |
fragmentation=$(($datafree * 100 / $datalength)) | |
echo "$database.$name is $fragmentation% fragmented." | |
mysql -u "$username" -p"$password" -NBe "OPTIMIZE TABLE $name;" "$database" |
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 | |
# Apache virtual hosts => Nginx Virtual Hosts | |
# Usage: ./apache-to-nginx-hosts.sh /etc/apache2/sites-available/www.slowb.ro > /etc/nginx/sites-available/www.slowb.ro | |
# Author: Slowpoke | |
# Website: www.slowb.ro | |
# Download script: http://sprunge.us/AdXH or http://pastebin.com/RbTqBnsm | |
# Global Vars | |
port=8080 | |
pattern=".*#.*" |
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/sh | |
### BEGIN INIT INFO | |
# Provides: cloudbot | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: SysVinit start up daemon for CloudBot | |
# Description: Start up daemon for CloudBot |
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/sh | |
user=user | |
ftpuser=$user | |
pass=password | |
db=dbname | |
host=remote/local | |
BkUp_dir="/home/$ftpuser/dbdump/" | |
######################################## |
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
mysqldump -u root -pPASSWORD. --all-databases | ssh user@newhost.com 'cat - | mysql -u root -pPASSWORD' | |
after this run flush privileges; |
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
Regular expression cheat sheet for Varnish | |
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX | |
regular expressions, for a complete guide, see: "man 7 regex" | |
Basic matching: | |
req.url ~ "searchterm" | |
True if req.url contains "searchterm" anywhere. | |
req.url == "searchterm" |
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 | |
CURRENT=$(/usr/bin/quota | awk '{print $2,$3}' | awk 'NR==3{print}' | awk '{print $1}') | |
MAX=$(/usr/bin/quota | awk '{print $2,$3}' | awk 'NR==3{print}' | awk '{print $2}') | |
x=$CURRENT | |
y=$MAX | |
z=$((x*100/y)) | |
THRESHOLD=60 | |
if [ "$z" -gt "$THRESHOLD" ] ; then |
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/sh | |
# | |
# find the file in /usr/lib | |
LIBEGL=`find /usr/lib/nvidia* -name libEGL.so.\* | egrep "[0-9][0-9]*\.[0-9][0-9]*$"` | |
LIBEGL_LINK=`echo $LIBEGL | sed 's/[0-9][0-9]*\.[0-9][0-9]*$/1/'` | |
printf "\n\nThe following commands will be executed:\n+++++++++++++++++++++++++++++++++++++++\n" | |
printf "mv $LIBEGL_LINK ${LIBEGL_LINK}.orig\nln -s $LIBEGL $LIBEGL_LINK\n\n" | |
while true; do | |
read -p "Do you wish to perform these commands? " yn | |
case $yn in |