Skip to content

Instantly share code, notes, and snippets.

@myusuf3
myusuf3 / mysql-secure.sh
Created September 14, 2011 01:55
mysql-secure.sh
# run this from the command line
mysql_secure_installation
# and for you 007s who didn't listen to my advice about the password here is how to reset it.
dpkg-reconfigure mysql-server-5.1
@myusuf3
myusuf3 / mysql.sh
Created September 14, 2011 01:49
installing mysql
# this command will install mysql-server
sudo apt-get install mysql-server
@myusuf3
myusuf3 / apache.sh
Created September 14, 2011 01:34
apache useful locations and commands
# location for available and enabled sites with Apache as well as modules like mod_wsgi
/etc/apache2/
# whenever something goes wrong here is where Apache makes note of it;
# think of it as persistent debug tool.
/var/log/apache2/error.log
# reload apache2, do this after new deploys or code changes
@myusuf3
myusuf3 / apache-install.sh
Created September 14, 2011 01:21
apache installation
# this will install apache2 util and the documentation
sudo apt-get install apache2 apache2-doc apache2-utils
# next you will install mod-wsgi which the apache plugin that allows you to
# run python application as well as setup-tools
sudo apt-get install python-setuptools libapache2-mod-wsgi
@myusuf3
myusuf3 / update-ubuntu-system
Created September 14, 2011 01:12
upgrading stock ubuntu
sudo apt-get update
sudo apt-get upgrade
@myusuf3
myusuf3 / shit_i_forget.sh
Created September 12, 2011 18:03
how to set root password ubuntu
Last login: Mon Sep 12 13:57:29 2011
myusuf3@flute:~$ sudo passwd
[sudo] password for myusuf3:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
myusuf3@flute:~$
@myusuf3
myusuf3 / toggle.js
Created September 7, 2011 05:21
toggle operators in js
# long way of doing it.
v = (v == 0 ? 1 : 0);
# shorter less cool way of doing it needs to be initialized right.
v = 1 - v;
# god like way
@myusuf3
myusuf3 / collectstatic.sh
Created September 5, 2011 18:49
usage of collectstatic.sh
./manage.py collectstatic -n
You have requested to collect static files at the destination
location as specified in your settings file.
This will overwrite existing files.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
@myusuf3
myusuf3 / .gitignore
Created August 7, 2011 05:43
python/django ignore file
#ignore files for django project
*.db
*.pyc
*.log
salary_errors = {
'required': 'This field is required',
'invalid': 'Enter a whole number (Ex: 45000)'
}
salary = forms.IntegerField(label=_('Your annual net salary'), error_messages=salary_errors, required=False)