Skip to content

Instantly share code, notes, and snippets.

@jedie
jedie / benchmark-tartiflette.py
Created February 5, 2020 12:39
Benchmark Tartiflette
import asyncio
import cProfile
import pstats
import time
from collections import OrderedDict, namedtuple
from tartiflette import Resolver, create_engine
Entry = namedtuple('Entry', 'id name')
@jedie
jedie / benchmark_graphql_core.py
Last active February 5, 2020 13:55
Benchmark graphql-core
import cProfile
import pstats
import statistics
import time
import timeit
from collections import OrderedDict, namedtuple
import graphql
from graphql.graphql import execute_graphql
from graphql.type import (
Watchdog.garbage_collection():
freed up 608 bytes -> 3088 bytes free
Traceback (most recent call last):
File "src/webswitch.py", line 108, in request_handler
File "src/webswitch.py", line 99, in send_response
File "src/webswitch.py", line 78, in call_module_func
File "src/http_set_timer.py", line 31, in get_form
File "src/webswitch.py", line 29, in send_html_page
File "src/device_name.py", line 34, in get_device_name
File "src/config_files.py", line 31, in <module>
import logging
import os
import random
import threading
import time
# https://github.com/peter-wangxu/persist-queue
from pathlib import Path
import persistqueue
import logging
from django.core.exceptions import SuspiciousOperation
from oscar_docdata.facade import Facade
from oscar_docdata.models import DocdataOrder
log = logging.getLogger(__name__)
# https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/display
import time
import display
import machine
from machine import SPI
from micropython import const
@jedie
jedie / odroidgo_mandelbrot_simple.py
Created October 9, 2018 11:20
simple version of mandelbrot rendering on ODROID GO
"""
Render mandelbrot on Odroid Go
It's for loboris MicroPython port!
Based on code from https://github.com/pypyjs/pypyjs-examples/
"""
import sys
import time
import display
@jedie
jedie / button_test.py
Last active March 15, 2025 09:46
microPython button irq debouncing
import time
from micropython import const
from machine import Pin, Timer
BUTTON_A_PIN = const(32)
BUTTON_B_PIN = const(33)
class Button:
"""
import inspect
from datetime import datetime
from functools import wraps
from django.db import close_old_connections
from huey.contrib.djhuey import HUEY, periodic_task, task
from huey.contrib.djhuey.models import HueyTaskLogModel # <<-- TODO: create model+admin
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.7.4, py-1.5.3, pluggy-0.7.1 -- /home/jens/repos/PyLucid-env/bin/python
cachedir: .pytest_cache
Django settings: django_tools_test_project.test_settings (from ini file)
rootdir: /home/jens/repos/PyLucid-env/src/django-tools, inifile: pytest.ini
plugins: django-3.4.2, cov-2.6.0, celery-4.2.1
collecting ... collected 1 item
run-last-failure: rerun previous 1 failure first
django_tools_tests/test_unittest_celery.py::test_rpc_on_message