Skip to content

Instantly share code, notes, and snippets.

Fernando Duran fduran

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am fduran on github.
  • I am fduran (https://keybase.io/fduran) on keybase.
  • I have a public key whose fingerprint is 07EC 2F80 E146 5882 ED6E A260 21CB C38A 8E89 7D06

To claim this, I am signing this object:

@fduran
fduran / django-install-nginx-uwsgi.md
Last active Feb 19, 2016
Django Install - Nginx uwsgi
View django-install-nginx-uwsgi.md

Django Install - Nginx uwsgi

Once per server:

apt-get update && apt-get upgrade
apt-get install python-setuptools python-dev build-essential
easy_install -U pip
pip install virtualenv

@fduran
fduran / django_install_apache.md
Last active Feb 12, 2017
Django Install - Apache
View django_install_apache.md

Django Install - Apache

Once per server:

apt-get update && apt-get upgrade
apt-get install libapache2-mod-wsgi
apt-get install python-setuptools python-dev build-essential
easy_install -U pip

@fduran
fduran / Checking for Shellshock attempts in web server logs
Created Oct 1, 2014
Checking for Shellshock attempts in web server logs
View Checking for Shellshock attempts in web server logs
# Checking for Shellshock attempts in web server logs
egrep "};|}\s*;" /var/log/apache2/access.log
@fduran
fduran / tail log file in browser
Created Oct 1, 2014
tail follow log file in browser
View tail log file in browser
# tail log file in browser
# go to server.example.com:777
pip install tailon
tailon -f /var/log/example.log -b 0:0:0:0:777 &
@fduran
fduran / check and alert if mysql slave is not running
Created Oct 1, 2014
Check and alert if mysql slave is not running
View check and alert if mysql slave is not running
#!/bin/bash
# check if mysql slave is running
log=/var/log/mysqlslave.log
email=user@example.com
date >> $log
res=`mysql -u root -pPassword -h db.example.com -N -B -e "show status like 'Slave_running'"|cut -f2`
if [ $res = 'ON' ]
@fduran
fduran / calculate mysql schema disk size
Created Oct 1, 2014
Calculate MySQL schema disk size
View calculate mysql schema disk size
# calculate mysql schemas disk size
mysql -h dbhost.example.com -u theuser -pThePassword -e 'select table_schema as DB, round(sum((data_length+index_length)/1024/1024),1) as MB from information_schema.tables group by table_schema order by MB desc'
@fduran
fduran / WordPress Error establishing database connection
Last active Aug 29, 2015
WordPress Error establishing database connection
View WordPress Error establishing database connection
# WP "Error establishing database connection"
# substitute with site's index static page (when it's up, not with the error duh)
wget http://example.com -O [/path/to/wp]/wp-content/db-error.php
View mysql optimization
# see http://mysqltuner.com/
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
perl mysqltuner.pl
@fduran
fduran / Linux Bash generate a number of files of random sizes in a range
Last active Apr 1, 2019
Linux Bash generate a number of files of random sizes in a range
View Linux Bash generate a number of files of random sizes in a range
#!/bin/bash
# generate a number of files with random sizes in a range
min=1 # min size (MB)
max=10 # max size (MB)
nofiles=20 # number of files
for i in `eval echo {1..$nofiles}`
do
dd bs=1M count=$(($RANDOM%max + $min)) if=/dev/urandom of=./files/file$i
You can’t perform that action at this time.