“Conectándose para una mejor salud materno-infantil en el Perú”
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 fabric.api import * | |
env.user = '' | |
env.hosts = [''] | |
env.password = '' | |
LOCAL_PATH = os.path.abspath('.') | |
SERVER_PATH = '' |
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
try: | |
from lxml.html import fromstring | |
strip_html = lambda html: fromstring(html).text_content() | |
except ImportError: | |
try: | |
from bs4 import BeautifulSoup | |
strip_html = lambda html: ''.join( | |
BeautifulSoup(html).findAll(text=True)) | |
except ImportError: | |
from HTMLParser import HTMLParser |
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
[core] | |
excludesfile = /path/to/gitignore_global | |
[alias] | |
serve = daemon \ | |
--reuseaddr --verbose --export-all \ | |
--base-path=/path/to/projects/ \ | |
--interpolated-path=/path/to/projects%D |
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 json | |
import hmac | |
import base64 | |
import hashlib | |
def parse_signed_request(signed_request, secret): | |
encoded_sig, payload = signed_request.split('.') | |
sig = base64.b64decode(encoded_sig + '==') | |
data = json.loads(base64.b64decode(payload + '==')) |
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 xlwt | |
from django.http import HttpResponse | |
def export_xls(modeladmin, request, queryset): | |
meta = modeladmin.model._meta | |
filename = '%s.xls' % meta.verbose_name_plural.lower() | |
def get_verbose_name(fieldname): | |
name = filter(lambda x: x.name == fieldname, meta.fields) |
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 urllib | |
URL = 'http://api.tropo.com/1.0/sessions' | |
TOKEN = '' | |
def send_sms(to, shout): | |
params = urllib.urlencode({ | |
'action': 'create', | |
'token': TOKEN, | |
'shout': shout, |
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 | |
class Persona | |
{ | |
public $nombres = ''; | |
public $ape_paterno = ''; | |
public $ape_materno = ''; | |
public $edad = null; | |
public function ponerNombresApellidos($nombres, $ape_pat, $ape_mat) | |
{ |
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
# dev | |
django-debug-toolbar==0.9.4 | |
django-data-tools==0.1 | |
django-devserver==0.3 | |
nashvegas==0.8-disqus-5 | |
Sphinx>=1.0.7 | |
piplint==0.1.1 | |
# global | |
amqplib==1.0.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
#!/bin/bash | |
if [ -n "$1" ] | |
then | |
ps xu | grep $1 | awk '{print $2}' | xargs kill -9 | |
else | |
echo "Usage: die <process-name>" | |
fi |