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
| ### 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 |
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
| # 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]; |
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
| # /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 |
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
| server { | |
| # Example Server Configuration | |
| # Created by Cesar | |
| listen 80; | |
| server_tokens off; | |
| server_name example.com; | |
| root /var/www/; |
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 os | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Example.settings") | |
| from django.core.wsgi import get_wsgi_application | |
| application = get_wsgi_application() |
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
| # /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 |
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
| #mysql connect | |
| mysql -u root -h localhost -p | |
| #list all databses | |
| show databases; | |
| #Use database | |
| use database_name; | |
| #Create user |
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
| ##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 |
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
| ##Server requirments | |
| - Web Server (public access) | |
| - Python 2.7 (available by default in Ubuntu >12.04 or via manual installation) | |
| - MySQL > 5.1 with access to a single database | |
| - PIP Python module (for installing Django and any additional packages) | |
| - Python Virtual env (not required, but highly recommended) | |
| - Read more: http://docs.python-guide.org/en/latest/dev/virtualenvs/ | |
| - Apache web server with mod_wsgi | |
| - Read more: https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/ |
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
| #1 | |
| ##Follow virtualenv gist | |
| https://gist.github.com/cezr/b986b69e6fbdffb8eb3d | |
| #2 | |
| ## Quick Install ## | |
| On Ubuntu 12.04, the following requirements will satisfy the project's system components: | |
| sudo aptitude install libapache2-mod-wsgi | |
| sudo apt-get install libmysqlclient-dev |
OlderNewer