Skip to content

Instantly share code, notes, and snippets.

View maxmalysh's full-sized avatar
🚀
BUY BITCOIN

Max Malysh maxmalysh

🚀
BUY BITCOIN
View GitHub Profile
@pirate
pirate / django_turbo_response.py
Last active November 21, 2022 21:12
An extended HTTPResponse class for Django 2.2 adding support for streaming partial template responses incrementally, preload headers, HTTP2 server push, CSP headers, running post-request callbacks, and more (fully typed).
"""
This is an extended HTTP response class for Django >=2.0 that adds lots of fancy features.
It's most useful when needing to accellerate slow view functions that return templates,
but it can be used anywhere where you need to return an HTTPResponse() or render(...).
It works by subclassing the builtin Django HttpResponse and StreamingHttpResponse,
and adding improvements in many areas, including functionality, speed, and security.
The most up-to-date version of this code can be found here:
@darkwave
darkwave / proxy.py
Created March 12, 2016 22:42
Python proxy server to redirect calls from localhost to different address (change forward_to variable)
#!/usr/bin/python
# This is a simple port-forward / proxy, written using only the default python
# library. If you want to make a suggestion or fix something you can contact-me
# at voorloop_at_gmail.com
# Distributed over IDC(I Don't Care) license
import socket
import select
import time
import sys
@Miserlou
Miserlou / cities.json
Created April 30, 2015 06:58
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@stancarney
stancarney / async_runner.py
Created January 16, 2013 05:54
Simple Django asynchronous processing example. Enables applications to Task.objects.create(script="from myapp; print "blarg! %s" % api_notification.id) and have them processed independently. Multiple async_runners can be started by running multiple commands: ./manage.py async_runner start. See http://stancarney.co/2013/01/simple-django-asynchron…
import logging
from time import sleep
from django.core.management.base import BaseCommand
from django.db import transaction
from apps.async.models import Task
log = logging.getLogger("jobs")