Skip to content

Instantly share code, notes, and snippets.

View tuffnatty's full-sized avatar

Phil Krylov tuffnatty

  • Cologne, Germany
View GitHub Profile
@tuffnatty
tuffnatty / burn.c
Created January 28, 2026 21:16
a simple cpu+fs load test
#include <pthread.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
void *cpu_burn(void *arg) {
volatile double x = 1.000001;
while (1)
if ((x *= x) > 1e100) x = 1.000001;
}
@tuffnatty
tuffnatty / openapi2views.py
Created August 13, 2017 21:36
A snippet to get OpenAPI-2.0 compatible output using my heavily patched version of officially deprecated django-rest-swagger 0.3.x
# pip install git+https://github.com/tuffnatty/django-rest-swagger.git@my-0.3.x
# pip install backports.tempfile
# pip install swagger-spec-validator
# pip install pyyaml
# And you should have swagger-tools executable (https://github.com/apigee-127/swagger-tools) on your PATH!
from copy import deepcopy
import json
from django.http import HttpResponse
from django.views import View