Skip to content

Instantly share code, notes, and snippets.

##MySQL connection is blocked
MySQL connection is blocked of many connections errors; unblock with 'mysqladmin flush-hosts
Your IP is blocked because you have attempted to log-into the MySQL server too many times
without the correct username/password, as per the error:
Host '*****************' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
To fix, log-into your MySQL server console and execute a FLUSH HOSTS command.
If this is on shared hosting, deleting and recreating the database will work. In my own experience many
web-hosts tend to say it's your MySQL database, it's your problem. Unless you want to wait a long time for
#mysql connect
mysql -u root -h localhost -p
#list all databses
show databases;
#Use database
use database_name;
#Create user
@cezr
cezr / demodays.conf
Last active May 12, 2016 19:57
Upstart Job Example for Django + Gunicorn
# /etc/init/example.conf
# Example Startup Script
# Created by Cesar
#
# Replace all "example" with project name, then register this after creating using:
# ln -fs /lib/init/upstart-job /etc/init.d/example
# update-rc.d example defaults
#
# You can now manage this application as a service, with:
# service example start/restart/reload/stop
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Example.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
server {
# Example Server Configuration
# Created by Cesar
listen 80;
server_tokens off;
server_name example.com;
root /var/www/;
@cezr
cezr / example.conf
Last active May 12, 2016 19:59
Ubuntu Helper Upstart-job NGINX + Gunicorn
# /etc/init/example.conf
# Example Startup Script
# Created by Cesar
#
# Replace all "example" with project name, then register this after creating using:
# ln -fs /lib/init/upstart-job /etc/init.d/example
# update-rc.d example defaults
#
# You can now manage this application as a service, with:
# service example start/restart/reload/stop
@cezr
cezr / iOS - UIScrollView focus to control
Last active May 12, 2016 20:01
iOS Dev Code Snippets
# Programatically move a UIScrollView to focus in a control above keyboard.
-(void) textFieldDidBeginEditing:(UITextField *)textField
{
CGRect rect = [textField bounds];
rect = [textField convertRect:rect toView:self.scrollView];
rect.origin.x = 0;
rect.origin.y -= 60;
rect.size.height = 400;
[scrollView scrollRectToVisible:rect animated:YES];
@cezr
cezr / mysqldump remote host
Last active May 12, 2016 20:01
Linux Commands
### MySQL commands ###
# Connect to a remote Database and dump the database
mysqldump -h [IP_ADDRESS] -u [USERNAME] -p [DATABASE_NAME] > [FILENAME.sql]
mysqldump -h [IP_ADDRESS] -u [USERNAME] -p [DATABASE_NAME] | gzip -9 > [FILENAME.sql.gz]
# In situations where the MySQL dump is large. A good approach is to split the uncompressed/SQL file
# into multiple files. Use the linux "split" command. Will make multiple files per 200 lines.
# i.e. dump_aa, dump_ab, dump_ac,....
cd /path/to/backup
mkdir splits