Skip to content

Instantly share code, notes, and snippets.

View kingbuzzman's full-sized avatar

Javier Buzzi kingbuzzman

View GitHub Profile
@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 theme paginate $size backgroundColor
true
gaia
true
14580

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
@kingbuzzman
kingbuzzman / commit_to_behave_django.sh
Last active June 20, 2023 16:00
commit_to_behave_django.sh
# Steps to running behave-django quickly to make a PR.
# 1. Fork behave-django on github: https://github.com/behave/behave-django
# 2. Make sure that you've setup your ssh keys for github: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
# IMPORTANT: *** Please ignore if you've already done it ***
# 3. Copy and paste this directly into your terminal:
mkdir -p $(pwd)/behave-django
docker run -v ${pwd}/behave-django:/behave-django -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -it --rm python:3.9 bash -c "$(cat << 'EOF'
# update the machine
apt-get update && \
# install dependencies