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
# 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
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
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 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 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
# por exemplo, o nome do arquivo é: zéca_silva.jpg | |
# basta utilizar o wildcard " * " | |
rm -rf z*ca_silva.jpg | |
# porém se houver mais arquivos que enquadrem no padrão z[QUALQUER OUTRA COISA]ca_silva.jpg vai ser deletado tbm, então use com cuidado. |
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
""" | |
Detecting and removing all files that have invalid file names (not ascii names), | |
that cannot be renamed or removed using ssh, in certain posix servers. | |
""" | |
import glob | |
import os | |
def isascii(s): | |
return all(ord(c) < 128 for c in s) |
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 convert_filename(value): | |
""" | |
Convert Filename. | |
""" | |
def newname(text, encoding=None): | |
from unicodedata import normalize | |
if isinstance(text, str): | |
text = text.decode(encoding or 'ascii') | |
clean_text = text.strip().replace(' ', '-') |
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 | |
# Create symbolic links to libs | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/ | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/ |
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
[Desktop Entry] | |
Version=2 | |
Type=Application | |
Terminal=false | |
Icon[pt_BR]=ICON_PATH | |
Name[pt_BR]=NAME | |
Exec=EXCEC_PATH | |
Name=NAME | |
Icon=ICON_PATH |