Skip to content

Instantly share code, notes, and snippets.

View jedie's full-sized avatar

Jens Diemer jedie

View GitHub Profile
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 January 31, 2024 05:32
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
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="gpx.py -- https://github.com/tkrajina/gpxpy">
<trk>
<trkseg>
<trkpt lat="0" lon="0">
<ele>0</ele>
</trkpt>
<trkpt lat="0" lon="0.0008983152770714982">
<ele>0</ele>
</trkpt>
import collections
class SimpleTree(collections.defaultdict):
"""
>>> tree = SimpleTree()
>>> tree.add(keys=("1",), value="value 1")
>>> tree.add(keys=("2a", "2b"), value="value 2.1")
@jedie
jedie / migration_filer_deprecation_move.py
Created April 30, 2018 15:57 — forked from wfehr/migration_filer_deprecation_move.py
Migration to move deprecated cmsplugin-*-plugins to the newer djangocms-*-plugins
from django.apps import apps as global_apps
from django.db import migrations
from djangocms_file.models import get_templates as get_file_templates
from djangocms_picture.models import get_templates as get_picture_templates
def forwards_filer_file(apps, schema_editor):
try:
CMSPluginFilerFile = apps.get_model('cmsplugin_filer_file',
'FilerFile')