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
# Virtualenvwrapper | |
export WORKON_HOME=$HOME/.virtualenvs | |
source /usr/local/bin/virtualenvwrapper.sh | |
# Color | |
export TERM=xterm-color | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
# Bash completion |
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
class Comment(models.Model): | |
""" | |
Representa los comentarios a los posts del blog | |
""" | |
post = models.ForeignKey( | |
'blog.Post', | |
) | |
user = models.ForeignKey( | |
'auth.User', | |
) |
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
# Locale | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
# Homebrew | |
export PATH="/usr/local/bin:/usr/local/sbin:$PATH" | |
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH" | |
# Brew autocomplete | |
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh |
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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': { | |
'require_debug_false': { | |
'()': 'django.utils.log.RequireDebugFalse' | |
} | |
}, | |
'handlers': { | |
'console': { |
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 os | |
from django.core.files import File | |
from .models import MediaFile | |
for ff_local in os.listdir('app/media/uploads/files'): | |
if MediaFile.objects.filter(file_uploaded__contains=ff_local): | |
mf = MediaFile.objects.filter(file_uploaded__contains=ff_local)[0] | |
f = File(open('app/media/uploads/files/'+ff_local, 'r')) | |
mf.file_uploaded.save(ff_local, f) |
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 | |
# This script will update the requirements only if the file has changed | |
# Author: AxiaCore S.A.S. http://axiacore.com | |
FILE=.requirements_timestamp | |
if [ ! -f $FILE ] || [ ! `stat --format="%Y" requirements.txt` -eq $(cat $FILE) ]; | |
then | |
echo "Updating requirements..." | |
pip install -U -r requirements.txt |
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 | |
# This script create a report for jenkins violations plugin | |
# Author: AxiaCore S.A.S. http://axiacore.com | |
echo "Generating cloc report..." | |
mkdir -p reports | |
cloc --by-file --exclude-dir=static,migrations,libs,vendor,reports --exclude-ext=min.js,min.css --exclude-lang=make --quiet --csv "`pwd`/" | egrep -v 'Counting|language' | awk -F, '{ if ($1 == "Bourne Again Shell") {language="shell"} else if ($1 == "Bourne Shell") {language="shell"} else { language=tolower($1) } n=split($2, basedir, "/"); folder=basedir[n-1]; print $5"\t"language"\t"folder"\t"$2 }' > reports/cloc.report | |
echo "Done" |
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 | |
# This script create a report for jenkins violations plugin | |
# Make sure you have a .jshintignore file to exclude paths from the report | |
# Author: AxiaCore S.A.S. http://axiacore.com | |
echo "Generating jshint report..." | |
mkdir -p reports | |
jshint --reporter=jslint app/media/js/ | sed -E 's?<file name="(.*)\?">?<file name="'"`pwd`"'/\1">?' > reports/jshint.xml | |
echo "Done" |
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
@staff_member_required | |
def generate_s3_auth_link(request): | |
"""Genera una url de autenticación para subir imagenes a amazon S3. | |
Utilizada en el admin por el editor de texto redactor. | |
""" | |
file_path = 'inlines/%s' % request.GET['name'] | |
headers = { | |
'Content-Type': request.GET['type'], | |
'x-amz-acl': 'public-read' | |
} |
OlderNewer