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
############################## | |
## POSTGRESQL BACKUP CONFIG ## | |
############################## | |
# Optional system user to run backups as. If the user the script is running as doesn't match this | |
# the script terminates. Leave blank to skip check. | |
BACKUP_USER= | |
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified. | |
HOSTNAME= |
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 | |
SITE=`pwd` | |
echo "$SITE" | |
if [ $1 ]; then | |
python $SITE/manage.py runserver_plus $1 & | |
else | |
python $SITE/manage.py runserver_plus & | |
fi |
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
$('#overflow-scroll').bind('mousewheel DOMMouseScroll', function(e) { | |
var scrollTo = null; | |
if (e.type == 'mousewheel') { | |
scrollTo = (e.originalEvent.wheelDelta * -1); | |
} | |
else if (e.type == 'DOMMouseScroll') { | |
scrollTo = 40 * e.originalEvent.detail; | |
} |
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
/** | |
* Javascript String Formatting | |
* Usage: | |
* >>> "I'm {0} to make him an offer he can't {1}.".format("going", "refuse") | |
* >>> I'm going to make him an offer he can't refuse. | |
*/ | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { |
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
DROP USER `ekinertac`@`%`; | |
FLUSH PRIVILEGES; | |
SELECT * FROM mysql.user; | |
GRANT USAGE ON *.* TO `ekinertac`@`%` IDENTIFIED BY 'pass' REQUIRE NONE; | |
GRANT Select ON *.* TO `ekinertac`@`%`; | |
GRANT Insert ON *.* TO `ekinertac`@`%`; | |
GRANT Update ON *.* TO `ekinertac`@`%`; | |
GRANT Delete ON *.* TO `ekinertac`@`%`; | |
GRANT Create ON *.* TO `ekinertac`@`%`; |
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
import datetime | |
import dateutil.relativedelta | |
dt1 = datetime.datetime.fromtimestamp(123456789) # 1973-11-29 22:33:09 | |
dt2 = datetime.datetime.fromtimestamp(234567890) # 1977-06-07 23:44:50 | |
rd = dateutil.relativedelta.relativedelta (dt2, dt1) | |
print "%d years, %d months, %d days, %d hours, %d minutes and %d seconds" % (rd.years, rd.months, rd.days, rd.hours, rd.minutes, rd.seconds) | |
# 3 years, 6 months, 9 days, 1 hours, 11 minutes and 41 seconds |
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
String.prototype.capitalize = function(lower) { | |
// 'javaSCrIPT'.capitalize(); // -> 'JavaSCrIPT' | |
// 'javaSCrIPT'.capitalize(true); // -> 'Javascript' | |
return (lower ? this.toLowerCase() : this).replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); }); | |
}; |
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 | |
# http://nathanvangheem.com/news/gunicorn-startup-script-for-django | |
# Place the script in the file - /etc/init.d/gunicorn or whatever you'd like to call it | |
# make it executable - chmod +x /etc/init.d/gunicorn | |
# And finally, wire it up - update-rc.d gunicorn defaults | |
ADDRESS='127.0.0.1' | |
PYTHON="/opt/django/bin/python" | |
GUNICORN="/opt/django/bin/gunicorn_django" |
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
<script> | |
(function($){ | |
jQuery = $.noConflict(true); | |
})(django.jQuery); | |
</script> | |
<script src="/static/js/libs/jquery.js"></script> |