Skip to content

Instantly share code, notes, and snippets.


Jarek Zgoda zgoda

  • Czubajowizna, PL
View GitHub Profile
This is Python Markdown extension that adds support for centered blocks similar to Vuepress.
class CenterBlockProcessor(BlockProcessor):
RE_START = r'^->'
RE_END = r'<-$'
def test(self, parent, block):
return re.match(self.RE_START, block)
zgoda /
Last active May 20, 2020
Load svg into Pygame image using pynanosvg (
from svg import Parser, Rasterizer
def load_svg(filename, scale=None, size=None, clip_from=None, fit_to=None):
"""Returns Pygame Image object from rasterized SVG
If scale (float) is provided and is not None, image will be scaled.
If size (w, h tuple) is provided, the image will be clipped to specified size.
If clip_from (x, y tuple) is provided, the image will be clipped from specified point.
If fit_to (w, h tuple) is provided, image will be scaled to fit in specified rect.
zgoda / form.html
Created Aug 1, 2019
Jinja2 macros to render simple WTForms form with Bulma
View form.html
{% macro field_description(field) %}
{% if field.errors %}
{% for error in field.errors %}
<p class="help is-danger">{{ error }}</p>
{% endfor %}
{% else %}
{% if field.description %}
<p class="help is-italic">{{ field.description }}</p>
{% endif %}
{% endif %}
zgoda / main.cpp
Created Sep 6, 2016
Basic ESP8266 WiFi frame capture
View main.cpp
extern "C" {
#include <user_interface.h>
#include <Arduino.h>
802.11 Frame Control on 2 bytes
struct FrameControl {
zgoda / Dockerfile
Created Jul 14, 2018
Build Python 3.7 for ARMv7 from source on amd64
View Dockerfile
FROM resin/armv7hf-debian-qemu
VOLUME /target
RUN echo "deb oldstable main contrib non-free" > /etc/apt/sources.list && \
echo "deb oldstable-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb oldstable/updates main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -qy --no-install-recommends \
zgoda /
Created May 31, 2017
Hybrid property
class Platform(db.Model, ModelMixin):
__tablename__ = 'platform'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(200), nullable=False, index=True)
homepage = db.Column(db.String(200))
description = db.Column(db.Text)
def versions_ordered(self):
return self.versions.order_by(db.desc(PlatformVersion.release_date))
zgoda /
Created Apr 24, 2017
Listen to serial communication in Twisted and route it to TCP connection
import sys
from twisted.internet import reactor
from twisted.internet.serialport import SerialPort
from twisted.internet.protocol import Protocol, Factory
from twisted.python import log
class SerialProtocol(Protocol):
zgoda /
Last active Dec 21, 2015
Flask-Script command to run test suite.
import unittest
from flask.ext.script import Command, Option
class RunTests(Command):
option_list = (
Option('labels', nargs='*',
help='specify individual tests to be run, in form module_name[.TestCaseName[.test_method]]'),
You can’t perform that action at this time.