Skip to content

Instantly share code, notes, and snippets.

View rixx's full-sized avatar

Tobias Kunze rixx

View GitHub Profile
@rixx
rixx / static.md
Last active October 9, 2025 22:06
pretalx 2025.2.0 plugin migration notes

pretalx 2025.2.0 plugin migration notes

In pretalx 2025.2.0, a lot of static files (stylesheets and script files) have changed their name and location. The main reason for this is that our static files had grown for a long time without a lot of structure. As a result, we included a lot of styles on all pages, even when we didn't need them. This made pages larger and page loads slower than they needed to be. Once we started the cleanup, we decided to also move files to a more consistent naming and directory scheme. Sorry.

Please also note that pretalx now does not support SCSS out of the box anymore. If your plugin requires SCSS files to be processed, you will have to make sure that they are processed to CSS files.

@rixx
rixx / debug.py
Last active May 16, 2025 10:24
Django: Start debugger on query
# Use: wrap methods:
# @breakpoint_on_query()
# Or use as `with breakpoint_on_query():`
from contextlib import contextmanager
@contextmanager
def breakpoint_on_query():
from django.db import connection
def instrument(execute, sql, params, many, context):
# Optional: match only specific queries, e.g.
@rixx
rixx / form-rendering-thoughts.md
Last active October 26, 2024 18:07
Thoughts on Django’s form rendering

Django's template-based form rendering: thoughts and pains

Short (well, I tried) collection of thoughts and impressions after moving to Django-native template-based form rendering with pretalx, my ~medium-sized(?) Django project.

When Carlton threatened to read my code (shock, horror), I decided to just write up my impressions, and a gist/pastebin/etc seemed the right format, cuz this isn’t polished enough for a blog post, and also way not constructive enough.

@rixx
rixx / polib.py
Last active June 11, 2025 08:34
polib example for gnu gettext pofile editing
def defuzzy(message):
import pathlib, polib
pofiles = list(pathlib.Path(".").glob("pretalx/**/**/django.po"))
for path in pofiles:
po = polib.pofile(path)
entry = po.find(message)
if entry and entry.fuzzy:
entry.flags.remove("fuzzy")
entry.previous_msgid = None
po.save()
@rixx
rixx / blocked_domains.csv
Last active July 4, 2023 10:35
Helper file for Threads.net block
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
threads.net
threads.instagram.com
@rixx
rixx / comparison.md
Last active June 7, 2025 10:57
Online man pages comparison

Man page browser comparison

There are a bunch of man page browsers available online. They have different data sources, feature sets, and disadvantages, so here is a short comparison table:

Name ls man page No Trackers/Ads Clickable Headings Links² ToC¹ Local Search Noteworthy
Arch manual pages ls
[zammad]
token = secrettoken
url = https://my.domain.com
[pushover]
user = secretusertoken
app = secretapptoken
@rixx
rixx / get_tickets.py
Last active October 7, 2024 18:55
Getting tickets from Django's trac and putting them into an SQLite database – results at https://data.rixx.de
import json
import sqlite3
from datetime import datetime
import requests
from tqdm import tqdm
BASE_URL = "https://code.djangoproject.com/jsonrpc"
DJANGO_MAX_TICKET = 33562
import sqlite3
import sys
def usage():
print("Usage: covsource.py <file> <linenos>")
print(" e.g. covsource.py foo/bar.py 14,15\n")
print(" or covsource.py foo/bar.py 14-27\n")
sys.exit(1)
@rixx
rixx / urls.py
Created June 18, 2018 22:15
Delivering static files on fixed URL in Django
import os
from django.http import Http404, FileResponse
def get_static(request, path, content_type):
path = os.path.join(settings.BASE_DIR, 'pretalx/static', path)
if not os.path.exists(path):
raise Http404()
return FileResponse(open(path, 'rb'), content_type=content_type)