Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"os"
)
type msg struct {
class Container(PolymorphicModel, ShowFieldContent, Publishable, Channeling):
uid = models.CharField(
_(u'UID'),
max_length=60,
null=True, blank=True,
db_index=True
)
child_class = models.CharField(
_(u'Child class'),
max_length=30,
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5OfVvY6xmZdtw5pYJMECnfRfMm7zWMytg+IL9AyNhbu8UdBmGdT6wUiBBBw9CTcdnmDYj08n8gWXV6Jz2eazl7fC27HQr9BzJb35FM1LpnXncSDNxn5Itj89ROIgY70d2obp35K9+I+muFkAYuYJEHjtrGr7KIlC1oM+v+K43Jla4SotoBleLNbec0GwtyeYBB7bL9yhGhpEje+dtpLJFd5H/bDBuvjDg/tPHeAnflg0QfUeYfNDC44psY/uJQGBrob3eLcOdJSIV418JS+z1inC9Iljg+xkHGwWg3TSS2lD4ufZcKumBpc2S7T9XSVVB0KDeFTgyQHNDkCtG5xRb thiago@avelino.xxx
@avelino
avelino / gist:793bdaf9f9732314912a
Last active August 29, 2015 14:06
django 1.7 polymorphism error
(Pdb) self.__class__._meta.fields()
*** TypeError: 'list' object is not callable
(Pdb) self.__class__._meta.fields
[<django.db.models.fields.AutoField: id>, <django.db.models.fields.DateTimeField: date_insert>, <django.db.models.fields.DateTimeField: date_update>, <django.db.models.fields.related.ForeignKey: user>, <django.db.models.fields.related.ForeignKey: site>, <django.db.models.fields.PositiveIntegerField: site_uid>, <django.db.models.fields.CharField: site_domain>, <django.db.models.fields.DateTimeField: date_available>, <django.db.models.fields.BooleanField: published>, <django.db.models.fields.CharField: uid>, <django.db.models.fields.CharField: child_class>, <django.db.models.fields.CharField: child_module>, <django.db.models.fields.CharField: child_app_label>, <django.db.models.fields.related.OneToOneField: container_ptr>, <django.db.models.fields.SlugField: slug>, <django.db.models.fields.CharField: tags>, <django.db.models.fields.CharField: title>, <django.db.models.fields.CharField: hat>, <dja
#!/usr/bin/env python
import multiprocessing
bind = "0.0.0.0:8080"
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = "gevent"
<?php
if (!isset($_GET['id']) || !isset($_GET['gid'])) exit;
if(!function_exists('get_option')) {
$path = ( defined('ABSPATH') ? ABSPATH : dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/');
require_once($path.'wp-blog-header.php');
}
global $slidepress;
header("HTTP/1.1 200 OK");
header("Status: 200 All rosy") ;
global $wpdb;
obj = MyModel()
obj.first_name = "Thiago"
obj.last_name = "Avelino"
obj.save()
obj.pk = None
obj.save()
@avelino
avelino / falcon_bjoern.py
Last active August 29, 2015 14:15
Go vs Python more request per second
# http://www.avelino.xxx/2015/01/go-vs-python-more-request-per-second
import falcon
import bjoern
class ThingsResource:
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
resp.body = ("Hello World")
@avelino
avelino / falcon_bjoern.result
Created February 10, 2015 00:42
Go vs Python more request per second
# http://www.avelino.xxx/2015/01/go-vs-python-more-request-per-second
$ ab -n10000 -c500 http://127.0.0.1:8080/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
#!/usr/bin/env bash
echo "123"