Skip to content

Instantly share code, notes, and snippets.

(╯°□°)╯︵ ┻━┻

David Larlet davidbgk

(╯°□°)╯︵ ┻━┻
Block or report user

Report or block davidbgk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
davidbgk / index.html
Created Dec 7, 2015
Fake favicon, to avoid extra request to server
View index.html
<!-- Fake favicon, to avoid extra request to server -->
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
davidbgk /
Created Apr 11, 2017
An attempt to create the simplest HTTP Hello world in Python3
import http.server
import socketserver
from http import HTTPStatus
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.wfile.write(b'Hello world')
davidbgk /
Created Oct 28, 2010
Easily add an empty choice to a Django ChoiceField
from django import forms
class EmptyChoiceField(forms.ChoiceField):
def __init__(self, choices=(), empty_label=None, required=True, widget=None, label=None,
initial=None, help_text=None, *args, **kwargs):
# prepend an empty label if it exists (and field is not required!)
if not required and empty_label is not None:
choices = tuple([(u'', empty_label)] + list(choices))
davidbgk /
Last active Jul 8, 2019
Given a folder containing CommonMark files, turn it into HTML.



Given a folder containing CommonMark files, turn it into HTML.


File structure

davidbgk /
Created Oct 25, 2011
A very simple HTTP server in Python using wsgiref.simple_server
from cgi import parse_qs
from wsgiref.simple_server import make_server
def simple_app(environ, start_response):
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
if environ['REQUEST_METHOD'] == 'POST':
request_body_size = int(environ.get('CONTENT_LENGTH', 0))
request_body = environ['wsgi.input'].read(request_body_size)

Kerberos setup

This guide explains how to set up Kerberos authentication for an HTTP service on a corporate network based on Active Directory.

All instructions will use the following placeholders:

  • COMPANYAD.COM: Windows Domain
  • network domain
davidbgk / mr-robot-religion.txt
Created Jul 23, 2016
Transcript of Mr Robot S02E03 about religion
View mr-robot-religion.txt
Is that what God does?
He helps?
Tell me,
why didn't God help
my innocent friend
who died for no reason
while the guilty roam free?
Okay, fine.
Forget the one-offs.
How about the countless wars
davidbgk /
Created Nov 8, 2018 — forked from CMCDragonkai/
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

#coding= utf-8
# This script implements the Double Metaphone algorithm (c) 1998, 1999 by Lawrence Philips
# it was translated to Python from the C source written by Kevin Atkinson (
# By Andrew Collins - January 12, 2007 who claims no rights to this work
# Tested with Pyhon 2.4.3
# Updated Feb 14, 2007 - Found a typo in the 'gh' section
# Updated Dec 17, 2007 - Bugs fixed in 'S', 'Z', and 'J' sections. Thanks Chris Leong!
# Updated June 25, 2010 - several bugs fixed thanks to Nils Johnsson for a spectacular
View redux-light-example.js
const store = createStore((state = { counter: 0 }, action) => {
switch(action.type) {
return { counter: state.counter + 1 }
return { counter: state.counter - 1 }
return state
You can’t perform that action at this time.