Skip to content

Instantly share code, notes, and snippets.

I am here to bring bananas to the people

Tom-Oliver Heidel blackjack4494

I am here to bring bananas to the people
  • Bremen/Hamburg, Germany
View GitHub Profile
mumrah /
Created Aug 7, 2010
Simple WebSockets in Python
import time
import struct
import socket
import hashlib
import sys
from select import select
import re
import logging
from threading import Thread
import signal
teepark /
Created Sep 9, 2010
a pure-python B tree and B+ tree implementation
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
gregburek /
Created Dec 7, 2011
Rate limiting function calls with Python Decorators
import time
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args,**kargs):
elapsed = time.clock() - lastTimeCalled[0]
leftToWait = minInterval - elapsed
if leftToWait>0:
rich20bb / PythonSimpleWebsocket
Created Dec 2, 2012
Simple websocket server in Python. Echos back whatever is received. Works with Chome, Firefox 16, IE 10.
View PythonSimpleWebsocket
import time
import struct
import socket
import hashlib
import base64
import sys
from select import select
import re
import logging
from threading import Thread
View SpectatorServer.cs
// Type: LOLReplay.SpectatorServer
// Assembly: LOLReplay, Version=, Culture=neutral, PublicKeyToken=null
// Assembly location: C:\Dokumente und Einstellungen\[...]\Desktop\Downloads\LOLReplay.exe
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
johndrinkwater / dualshock-research
Last active Oct 10, 2021
I’m interested in writing (or helping to spec out the protocol so someone else can write) the linux kernel driver for Sony’s DualShock 4 (PS4’s lovely controller) Currently using the output of HID RAW from a USB connected dualshock 4… For the gyro/touchpad discovery, I’ve just been using some terrible c code to throw numbers on the screen and it…
View dualshock-research
TADA, it’s `hexdump -v -e '64/1 "%02x" "\n"' < /dev/hidraw3`
No idea what the first byte is… but I’m going to assume its for device ID for the many users that are connected, but it probably has to be set by the connected machine?
left stick, value, first field is horz (00 left), second field is vertical (00 top)
gavinhungry / nginx-tls.conf
Last active Nov 17, 2021
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
View nginx-tls.conf
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
# Additional tips:
Zearin /
Last active Nov 26, 2021
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.

Q: How can I make a chain of function decorators in Python?

If you are not into long explanations, see [Paolo Bergantino’s answer][2].

awesomebytes /
Last active Nov 25, 2021
Make a function or method threaded in python with a decorator

How to make a python function or class method threaded

From this stack overflow question I got this great snippet.

# Threaded function snippet
def threaded(fn):
    """To use as decorator to make a function call threaded.
    Needs import
    from threading import Thread"""
JBou / SoundCloud API Endpoints.cs
Last active Nov 25, 2021
SoundCloud API Endpoints
View SoundCloud API Endpoints.cs
{ ApiCommand.AuthorizationCodeFlow, new Uri("{0}&response_type={1}&redirect_uri={2}") },
{ ApiCommand.UserAgentFlow, new Uri("{0}&response_type=token&redirect_uri={1}") },
{ ApiCommand.UserCredentialsFlow, new Uri("{0}&client_secret={1}&grant_type=password&username={2}&password={3}") },
{ ApiCommand.RefreshToken, new Uri("{0}&client_secret={1}&grant_type=refresh_token&refresh_token={2}") },
{ ApiCommand.Me, new Uri("") },
{ ApiCommand.MeTracks, new Uri("") },
{ ApiCommand.MeComments, new Uri("") },