Skip to content

Instantly share code, notes, and snippets.

View trecouvr's full-sized avatar

Thomas Recouvreux trecouvr

View GitHub Profile
@trecouvr
trecouvr / managers.py
Created March 11, 2018 14:58
Django Window Function [Medium]
class PostManager(models.Manager):
pass
def hello(name):
print('hello ' + name)
@trecouvr
trecouvr / gist:4e7b9a0978321a8edbc5
Created April 29, 2015 13:43
traceback django ticket #24394
./manage.py test -v2
Creating test database for alias 'mysite' (':memory:')...
Operations to perform:
Synchronize unmigrated apps: staticfiles, messages
Apply all migrations: admin, contenttypes, sites, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
Rendering model states... DONE
class A(ServiceBase):
@rpc(String, _returns=String, _no_cls=False)
def hello(cls, ctx, name):
print(name, cls)
return cls._hello(name)
@classmethod
def _hello(cls, name):
return 'Hello, %s' % name
if self.frame_end is not None:
frame_end = binascii.hexlify(self.frame_end).decode('ascii')
frame_data = {
'type': self.frame_type,
'channel': self.channel,
'size': self.payload_size,
'frame_end': frame_end,
'payload': self.frame_payload,
}
import logging
import traceback
import asyncio
logger = logging.getLogger(__name__)
class QuitCommand(Exception):
import asyncio
import unittest
import unittest.mock
class MyClass:
@asyncio.coroutine
def coro1(self):
yield from self.coro2()
@trecouvr
trecouvr / counter.opa
Created March 15, 2012 18:56
bug on opa mongodb ?
database test {
int /counter = 0;
stringmap(int) /mymap;
}
function action(_) {
Int.repeat(function (_) {
c = /test/counter
/test/mymap["{c}"] <- c
/test/counter = c + 1
void
@trecouvr
trecouvr / Makefile
Created March 5, 2012 04:18
test hokuyo
exe: src/main.cpp
g++ -o exe src/main.cpp -Wall -Werror `urg-config --cflags` `sdl-config --cflags` `urg-config --libs` `sdl-config --libs` -lc -lpthread
@trecouvr
trecouvr / emulation2.opa
Created December 21, 2011 18:36
opa subtyping emulation
type AAA = {AAA : string}
type AAB = {AAB : string}
type ABA = {ABA : string}
type ABB = {ABB : string}
type AA = {AA : string fils : AAA/AAB/{none}}
type AB = {AB : string fils : ABA/ABB/{none}}
type A = {a1 : string a2 : string fils : AA/AB/{none}}