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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright (c) 2012 The Octopus Apps Inc. | |
# Licensed under the Apache License, Version 2.0 (the "License") | |
# | |
# Author: Alejandro M. Bernardis | |
# Email: alejandro.m.bernardis at gmail.com | |
# Created: Feb 6, 2012, 2:44:12 PM | |
# |
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
_Q = Q(...)&Q(...) # Query | |
_total = MyModel.objects(_Q).count() | |
if _total < 1: | |
error = MessageError(1, u"No se encontraron resultados con el filtro definido.") | |
else: | |
_skip = 0 | |
_limit = 100 | |
_range = int(_total/_limit)+1 | |
_file_dir = os.path.abspath("")+"/my/path/csv" |
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 AdminFileHandler(BaseHandler): | |
@authenticated | |
def get(self, file_name): | |
_file_dir = os.path.abspath("")+"/my/path/downloads" | |
_file_path = "%s/%s" % (_file_dir, file_name) | |
if not file_name or not os.path.exists(_file_path): | |
raise HTTPError(404) | |
self.set_header('Content-Type', 'application/force-download') | |
self.set_header('Content-Disposition', 'attachment; filename=%s' % file_name) |
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
# (yr) variables | |
domain='mydomain.com' | |
vhost_dir=/my/path/vhosts | |
httpdocs_dir=$vhost_dir/$domain/httpdocs_python | |
supervisor_dir=$httpdocs_dir/apps-config | |
project_dir=$httpdocs_dir/apps/administrator | |
# (yr) helpers | |
alias py='/usr/local/bin/python2.7' | |
alias python='/usr/local/bin/python2.7' |
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
apt-get update && apt-get -u upgrade | |
apt-get install build-essential tree joe | |
apt-get install python-setuptools | |
apt-get install mercurial subversion git | |
apt-get install ant curl sqlite3 mysql-server mysql-client mysql-common mongodb-server mongodb-clients python-mysqldb python-pycurl python-pymongo | |
easy_install supervisor | |
# interfaces | |
auto eth0 | |
iface eth0 inet static |
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
cproject(){ | |
if [ -z "$1" ]; then | |
echo "Define el nombre del cliente." | |
elif [ -z "$2" ]; then | |
echo "Define el nombre del projecto." | |
else | |
base_path=`pwd` | |
base_path=$base_path'/project/'$(date +%Y%m%d%H%M%S) | |
echo 'Base Path: '$base_path | |
client=$1 |
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
wget --no-check-certificate -O tornado-master.tar.gz https://github.com/facebook/tornado/tarball/master | |
wget --no-check-certificate -O pymongo-master.tar.gz https://github.com/mongodb/mongo-python-driver/tarball/master | |
wget --no-check-certificate -O mongoengine-master.tar.gz https://github.com/hmarr/mongoengine/tarball/master | |
wget --no-check-certificate -O wtforms-master.tar.gz https://bitbucket.org/simplecodes/wtforms/get/default.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
#: -- timesince ---------------------------------------------------------------- | |
def get_plural(value, singular, plural, message=""): | |
try: | |
return plural if int(value) > 1 else singular | |
except: | |
return message | |
def get_str_plural(value, singular, plural, message="", tmpl=u"%s %s"): | |
return tmpl % (value, get_plural(value, singular, plural)) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright (c) 2012 Young and Rubicam Digital Mexico. | |
# Licensed under the Apache License, Version 2.0 (the "License") | |
# | |
# Author: Alejandro M. Bernardis | |
# Email: alejandro.bernardis at gmail.com | |
# Created: Feb 17, 2012 08:54:18 AM | |
# |
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
###################################### | |
## Project Information | |
###################################### | |
author = Alejandro M. Bernardis | |
author.email = [email protected] | |
project.owner = Kirika Code | |
project.owner.url = http://www.kirikacode.com | |
project.fullname = AS3 Kirika Code Application | |
project.version = 1.0.0 |
OlderNewer