Skip to content

Instantly share code, notes, and snippets.

View kingbuzzman's full-sized avatar

Javier Buzzi kingbuzzman

View GitHub Profile
@kingbuzzman
kingbuzzman / celery-tasks.diff
Created April 14, 2026 11:37
check that celery re-enqueues tasks while shutting down
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ece4e7a
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+FROM python:3.12-slim
+
+WORKDIR /app
+
@kingbuzzman
kingbuzzman / validator.py
Created March 31, 2025 10:58
Django app validator -- WIP
from __future__ import annotations
import ast
from collections import namedtuple
import copy
import sys
import os
import site
from types import ModuleType

Random scripts

Get all the lines missing from coverage

git diff --unified=0 origin/master | awk '
  /^diff --git a\// { file=$3; sub(/^a\//, "", file); next }
  /^@@ / {
    split($2, a, ",");
    old_start_line=a[1]; sub(/^-/, "", old_start_line);
    old_num_lines=a[2];
@kingbuzzman
kingbuzzman / exclude_middleware.py
Last active February 6, 2024 12:58
Test excluding middlewares
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Stolen from: https://mlvin.xyz/django-single-file-project.html
import datetime
import inspect
import os
import sys
@kingbuzzman
kingbuzzman / presentation.md
Created May 23, 2023 16:53
Presentation -- Monday, May 23 -- django
marp true
theme gaia
paginate true
$size 14580
backgroundColor

Model instance reference (Create, Refresh, Delete, _state)

import io
import coverage
import json
from contextlib import redirect_stdout
def functions_execution_is_identical(func1, func2, file_to_compare):
"""
Compare the coverage of two functions to see if they're equivalent/same.
@kingbuzzman
kingbuzzman / Dockerfile.template
Last active July 7, 2022 11:18
factoryboy docker local development
# syntax=docker/dockerfile:experimental
ARG PYTHON_VERSION
FROM ${PYTHON_VERSION}
ENV TOX_WORK_DIR=/tmp/.tox
ENV MONGO_HOST=mongo
ENV POSTGRES_HOST=postgres
@kingbuzzman
kingbuzzman / Dockerfile
Last active April 26, 2022 20:25
Vala Dockerfile
# Could not find the oficial docker file for vala lang anywhere.. made my own.
FROM ubuntu:latest
RUN apt update && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt install -y wget build-essential flex bison libglib2.0-dev graphviz-dev
RUN wget https://download.gnome.org/sources/vala/0.52/vala-0.52.4.tar.xz && \
tar xvf vala-0.52.4.tar.xz && \
cd vala-0.52.4 && \
@kingbuzzman
kingbuzzman / rancher-cli-0.6.14.monterey.tar.gz
Last active February 10, 2022 12:23
Recompiled OSX rancher 1.6
This file has been truncated, but you can view the full file.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Stolen from: https://mlvin.xyz/django-single-file-project.html
import datetime
import inspect
import os
import sys