Skip to content

Instantly share code, notes, and snippets.

@henrypalacios
henrypalacios / test_runner.py
Created September 11, 2018 20:31
Use file storage on the local filesystem in Django unit tests
import shutil
import tempfile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.db.models import FileField
from django.db.models.loading import get_model, get_models
from django.test.runner import DiscoverRunner
@henrypalacios
henrypalacios / example.com
Created December 5, 2017 04:46 — forked from mignev/example.com
Django deployment with Nginx and Tornado Web
upstream tornadoFrontends {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
server {
listen 80;
@henrypalacios
henrypalacios / Nielsen2012Python_case.py
Created July 27, 2017 03:36 — forked from fnielsen/Nielsen2012Python_case.py
Text mining example in Python
# $Id: Nielsen2012Python_case.py,v 1.2 2012/09/02 16:55:25 fn Exp $
# Define a url as a Python string (note we are only getting 100 documents)
url = "http://wikilit.referata.com/" + \
"wiki/Special:Ask/" + \
"-5B-5BCategory:Publications-5D-5D/" + \
"-3FHas-20author%3DAuthor(s)/-3FYear/" + \
"-3FPublished-20in/-3FAbstract/-3FHas-20topic%3DTopic(s)/" + \
"-3FHas-20domain%3DDomain(s)/" + \
"format%3D-20csv/limit%3D-20100/offset%3D0"
@henrypalacios
henrypalacios / uploadtest.php
Created May 24, 2017 03:26 — forked from erikaheidi/uploadtest.php
upload test with silex
<?php
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = new Silex\Application();
$app['debug'] = true;