Skip to content

Instantly share code, notes, and snippets.

View felipecruz's full-sized avatar

Felipe Cruz felipecruz

  • Berlin, Germany
View GitHub Profile
.data
int_pattern: .ascii "%d\12\0"
string_pattern: .ascii "%s\12\0"
.text
.globl _print_int
_print_int:
pushl %ebp
movl %esp, %ebp
pushl %ebx
{
'longrepr':{
'sections':[
],
'reprcrash':{
'path':'/Users/felipecruz/Projects/loogica/neurotic/tests/test_report_plugin.py',
'message':'assert 0 == 1',
'lineno':9
},
{
"id": 1,
"reports": [
{
"longrepr": null,
"when": "call",
"nodeid": "tests/test_domain.py::test_test_report_repository__init",
"duration": 0.0006470680236816406,
"location": [
"tests/test_domain.py",
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/home/meuusuario/projeto/jamboree.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
import timeit
pickle_code = '''
import pickle
data = {"test": "value"}
with open('out.pickle', 'wb') as out:
for i in range(10000):
out.write(pickle.dumps(data, pickle.HIGHEST_PROTOCOL))
@felipecruz
felipecruz / switch_goto_coroutine.c
Last active December 16, 2015 07:39
C - switch/goto coroutine example
#include <stdint.h>
uint8_t next (uint8_t *data) {
static int running = 0;
static uint8_t *current;
switch (running) {
case 0: goto L0;
case 1: goto L1;
}
@felipecruz
felipecruz / url_shortener.py
Created April 11, 2013 23:09
tiny url shortener
import re
'''
pip install flask
pip install coopy
'''
from coopy.base import init_persistent_system
from flask import Flask, request, redirect, jsonify
@felipecruz
felipecruz / django_tests_bolierplate.py
Created February 20, 2013 20:03
Generate models tests boilerplate code
from django.conf import settings
from django.db.models import get_apps, get_app, get_models
app = get_app('realestate')
source = '''
class %sTest(TestCase):
def test_import(self):
from %s import %s
import ast
# just for convenience
Assign = ast.Assign
Store = ast.Store
Module = ast.Module
Name = ast.Name
Str = ast.Str
# creating an assignment statement -> magic = "loogica"
@felipecruz
felipecruz / import_error
Created January 31, 2013 23:54
pyzmq cffi import error
zmq/__init__.py:52: in <module>
> from zmq.sugar import backend
zmq/sugar/__init__.py:16: in <module>
> from zmq.sugar import (
zmq/sugar/constants.py:16: in <module>
> from .backend import constants
zmq/sugar/backend.py:29: in <module>
> from zmq.cffi_core import (
zmq/cffi_core/__init__.py:1: in <module>
> from zmq.cffi_core import (constants, error, message, context, socket,