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
<?php | |
$seconds = 60 * 2; // nginx default is 60 seconds | |
set_time_limit (60*60*24); // PHP keeps waiting for a whole day! | |
if (array_key_exists('s', $_REQUEST)) { | |
$seconds = intval($_REQUEST['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
from django.conf import settings | |
from django.contrib.gis.db import models | |
from smart_selects.db_fields import ChainedForeignKey | |
from common.models import AuditableModel | |
from ubigeos import strings | |
class Department(models.Model): | |
""" | |
A peruvian department. |
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 uuid | |
import hashlib | |
import baseconv | |
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
def base62uuid(): | |
converter = baseconv.BaseConverter(ALPHABET) | |
uuid4_as_hex = str(uuid.uuid4()).replace('-','') | |
uuid4_as_int = int(uuid4_as_hex, 16) |
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
# Install PPA tool | |
echo "Installing software for working with PPA packages..." | |
sudo apt-get install -y python-software-properties software-properties-common | |
# Install Oracle Java 8 | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
echo "Installing ORACLE Java8..." | |
sudo apt-get install -y oracle-java8-installer |
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
BRANCH="$1" | |
if [ $BRANCH == "refs/heads/master" ]; then | |
echo "Deploying changes to production environment." | |
GIT_WORK_TREE=/Users/gnrfan/code/git-tests/production-environment git checkout -f | |
elif [ $BRANCH == "refs/heads/staging" ]; then | |
echo "Deploying changes to staging environment." | |
GIT_WORK_TREE=/Users/gnrfan/code/git-tests/staging-environment git checkout -f | |
fi |
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 urllib2 | |
import re | |
from collections import Counter | |
url = 'http://profe-alexz.blogspot.com/2013/09/resultados-examen-admision-san-marcos-2014-i.html' | |
NAME_COUNT_LIMIT = 1000000 | |
def grab_page(url): | |
website = urllib2.urlopen(url) | |
return website.read() |
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
""" | |
WSGI config for renovaciones project. | |
This module contains the WSGI application used by Django's development server | |
and any production WSGI deployments. It should expose a module-level variable | |
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | |
this application via the ``WSGI_APPLICATION`` setting. | |
Usually you will have the standard Django WSGI application here, but it also | |
might make sense to replace the whole Django WSGI application with a custom one |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Average(x, y float64) float64 { | |
return (x + y) / 2.0 | |
} |
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 | |
# | |
# This is a demo script on how to use the Junar API provided by http://lima.datosabiertos.pe/ | |
# More info un Junar APIs here: http://wiki.junar.com/index.php/API | |
# | |
# Steps to install the Junar API client in a virtual environment: | |
# | |
# virtualenv --no-site-packages env | |
# source env/bin/activate | |
# pip install git+git://github.com/Junar/junar-api-python-client.git |
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
### Filesystem jumping | |
### Usage: Just add a line to your ~/.bashrc or ~/.bash_profile with "source /path/to/fsjumps.sh". | |
export MARKPATH=$HOME/.marks | |
function jump { | |
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1" | |
} |
NewerOlder