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
| from os.path import abspath, join, dirname | |
| PROJECT_ROOT_PATH = abspath(join(dirname(abspath(__file__)), '..')) |
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
| Na empresa que trabalho, nós temos ambientes de desenvolvimento, teste e producao. | |
| Cada ambiente tem um settings específico onde importamos as configuracões comuns | |
| a todos de um settings base e mudamos as configurações específicas, | |
| como banco de dados por exemplo. | |
| A estrutura de diretório fica mais ou menos assim: | |
| - Projeto | |
| --- settings | |
| ------ __init__.py |
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 extract_pks(objects): | |
| return [int(value.get('pk')) for value in objects.values('pk')] |
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
| # 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 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
| tar -cvzf <filename>.tar.gz <folder-name> | |
| tar -xvzf <filename>.tar.gz |
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
| 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 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
| # 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 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 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 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
| # 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 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
| /* Example */ | |
| /* Par */ | |
| ul li:nth-child(even){ | |
| background:#fff; | |
| } | |
| /* Ímpar */ | |
| ul li:nth-child(odd){ | |
| background:#000; |