Skip to content

Instantly share code, notes, and snippets.

@jacklinke
jacklinke / info.md
Created October 22, 2024 19:35
A management command to list all templates in the project.

A management command to list all templates in the project.

This command will list all templates in the project, depending on the template engines and loaders that are configured in the Django settings, and display them in the way you should add them to a {% url "" %} template tag or for rendering in a view.

By default, it will scan all directories in the TEMPLATES setting for template files.

@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.

@Olshansk
Olshansk / llm.sh
Last active September 28, 2024 00:47
A bash wrapper around python's mlx_whisper to leverage the GPU on a mac for transcription
# A one liner to leverage the GPU on a mac to transcribe audio files
# Inspired by https://simonwillison.net/2024/Aug/13/mlx-whisper/
llm_transcribe_recording () {
local file_path="$1"
python3 -c "
import mlx_whisper
result = mlx_whisper.transcribe('$file_path', path_or_hf_repo='mlx-community/distil-whisper-large-v3')
print(result['text'])
"
}
@willmcgugan
willmcgugan / mother.py
Created September 2, 2024 14:09
Aliens AI
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "llm",
# "textual",
# ]
# ///
from textual import on, work
from textual.app import App, ComposeResult
from textual.widgets import Header, Input, Footer, Markdown
@OrionReed
OrionReed / dom3d.js
Last active September 28, 2025 08:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@pauloxnet
pauloxnet / djangoconus.md
Created January 19, 2024 11:13
DjangoCon US

DjangoCon US

Here are DjangoCon US talk recordings ordered by views as of 2024-01-19:

$ yt-dlp -j --flat-playlist https://www.youtube.com/@DjangoConUS | jq -r '.|[.view_count,.url,.title]|@tsv' | sort -nr
55064	https://www.youtube.com/watch?v=XXG-ESzB9Q8	DjangoCon US 2016 - Building Dynamic Dashboards With Django and D3 by Clinton Dreisbach
20791	https://www.youtube.com/watch?v=zYHv6U86X0Y	DjangoCon US 2016 - Django and React: Perfect Together by Jack McCloy
20730	https://www.youtube.com/watch?v=pY-oje5b5Qk	DjangoCon US 2018 - Finally Understand Authentication in Django REST Framework by William S. Vincent
19728	https://www.youtube.com/watch?v=695y8rdHsA4	DjangoCon 2019 - Django REST Framework: Taking your API to the next level by Carlos Martinez
@thibaudcolas
thibaudcolas / talks-id-like-to-see.md
Last active February 9, 2024 14:10
Django & Wagtail talks I’d like to see
@adtac
adtac / Dockerfile
Last active July 13, 2025 20:06
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@joshuadavidthomas
joshuadavidthomas / decorators.py
Last active February 7, 2024 15:10
if `neapolitan.views.CRUDView` and `rest_framework.viewsets.Viewset`/`rest_framework.routers.SimpleRouter` had a baby, it would be ugly as hell
def route(methods=None, detail=None, url_path=None, url_name=None, **kwargs):
"""
Mark a ViewSet method as a routable action.
`@action`-decorated functions will be endowed with a `mapping` property,
a `MethodMapper` that can be used to add additional method-based behaviors
on the routed action.
:param methods: A list of HTTP method names this action responds to.
Defaults to GET only.
@april
april / find-all-electron-versions.sh
Last active October 11, 2025 15:25
find all apps using Electron and their versions, on macOS systems
# latest supported electron version as of october 2024
LATEST_SUPPORTED_VERSION=30
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # no color
mdfind "kind:app" 2>/dev/null | sort -u | while read app;
do
filename="$app/Contents/Frameworks/Electron Framework.framework/Electron Framework"
if [[ -f $filename ]]; then