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
def extract_pks(objects): | |
return [int(value.get('pk')) for value in objects.values('pk')] |
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
# Download | |
wget http://effbot.org/media/downloads/PIL-1.1.7.tar.gz | |
tar zxf PIL-1.1.7.tar.gz | |
cd PIL-1.1.7 | |
# Edit setup file | |
vim setup.py | |
# Set the following variables | |
JPEG_ROOT = '/usr/lib64','/usr/include' | |
ZLIB_ROOT = '/lib64','/usr/include' |
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
tar -cvzf <filename>.tar.gz <folder-name> | |
tar -xvzf <filename>.tar.gz |
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
git checkout -b issue2 | |
# after fix | |
git add YOUR_FILES_HERE | |
git commit -m "fixing #issue2" | |
git checkout master | |
git merge issue2 | |
git branch -d issue2 |
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
# Export and pack | |
mysqldump -uUSER -pPASSWORD database_name --compact --host=HOST_IP_ADDRESS | gzip > mysqlbackup.sql.gz | |
# Unpack | |
gunzip mysqlbackup.sql.gz | |
# Importing free of troubles with Foreign Key Restriction From innoDB Tables | |
mysql -uUSER -pPASSWORD | |
# MySQL terminal | |
mysql> CREATE DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci; |
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
# 1 ANO | |
<FilesMatch "\.(ico|pdf|flv)$"> | |
Header set Cache-Control "max-age=29030400, public" | |
</FilesMatch> | |
# 1 SEMANA | |
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> | |
Header set Cache-Control "max-age=604800, public" | |
</FilesMatch> | |
# 2 DIAS | |
<FilesMatch "\.(xml|txt|css|js)$"> |
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
# I don't know why, but everytime than i try to install or update splinter in my pc | |
# i get this error: src/lxml/etree_defs.h:9:31: fatal error: libxml/xmlversion.h | |
# anyway i try to discover why, for while this is a solution: | |
# install/upgrade libxml2-dev and libxslt-dev | |
sudo apt-get install libxml2-dev libxslt-dev |
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
/* Example */ | |
/* Par */ | |
ul li:nth-child(even){ | |
background:#fff; | |
} | |
/* Ímpar */ | |
ul li:nth-child(odd){ | |
background:#000; |
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
-- This problem happens when you try to order columns ASC | |
-- and you want to ignore the 0 values in the first results | |
SELECT `DATABASE_NAME`.* | |
FROM `TABLE_NAME` | |
ORDER BY | |
CASE WHEN `FIELD_FILL_WITH_0` in("", "0") THEN 1 | |
ELSE 0 END, `FIELD_FILL_WITH_0_OR_ANY_OTHER_FIELD` ASC |
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
sudo apt-get build-dep python-mysqldb | |
pip install mysql-python |