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
find . -type f -name '*.pyc' -exec rm {} \; |
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 platform | |
IS_LOCAL = False | |
if platform.node() != 'server': | |
IS_LOCAL = True |
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
# pip install johnny-cache | |
# add johnny's middleware | |
MIDDLEWARE_CLASSES = ( | |
'johnny.middleware.LocalStoreClearMiddleware', | |
'johnny.middleware.QueryCacheMiddleware', | |
# ... | |
) | |
# some johnny settings | |
CACHES = { |
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
# For Ampps | |
sudo ln -s /Applications/AMPPS/mysql/tmp/mysql.sock /tmp/mysql.sock | |
# For MAMP | |
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock |
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
php_value memory_limit 128M |
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
# if "ValueError: unknown locale: UTF-8" error try | |
export LC_ALL=ru_RU.UTF-8 | |
export LANG=ru_RU.UTF-8 |
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
def parse_php_variables(php): | |
''' | |
Parse PHP file for variables like $var = value; | |
''' | |
reg = r'\$([a-z]\w*)\s*=\s*\'(.*?)\';' | |
rg = re.compile(reg) | |
raw_variables = rg.findall(php) | |
variables = {} | |
for key, var in raw_variables: |
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
#!/bin/bash | |
# APACHE SECTION | |
RESTART="/etc/init.d/apache2 restart" | |
PGREP="/usr/bin/pgrep" | |
HTTPD="apache" | |
$PGREP ${HTTPD} | |
if [ $? -ne 0 ] | |
then | |
$RESTART | |
fi |
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
function pushIfUnique(array, val){ | |
var status = true; | |
for (var i = 0; i < array.length; i++) { | |
if (array[i]===val) { | |
status = false; | |
} | |
} | |
if (status){ | |
array.push(val); | |
return array; |
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
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerName sitename.com | |
DocumentRoot /var/www/sitename.com | |
WSGIScriptAlias / /var/www/sitename.com/django.wsgi | |
ErrorLog /var/www/sitename.com/error.log | |
ExpiresActive on | |
ExpiresByType application/javascript "access plus 1 months" | |
ExpiresByType image/gif "access plus 1 months" |
OlderNewer