Skip to content

Instantly share code, notes, and snippets.


Grant Jenks grantjenks

View GitHub Profile
"""Simple TCP Proxy
Receive connections on one port and forward them to another port.
$ python3 -m http.server 8080 # Start an http server on port 8080
$ python3 5000 8080 # Proxy port 5000 to 8080
Open http://localhost:5000/ in Chrome
grantjenks / reboot.service
Created May 3, 2020
Weekly reboots using systemd.
View reboot.service
# /etc/systemd/system/reboot.service
Description=Reboot Service
ExecStart=/bin/systemctl --force reboot

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

grantjenks /
Created Oct 22, 2019
Python 3 XML-RPC Using Unix Domain Sockets
import http.client
import socket
import xmlrpc.client
class UnixStreamHTTPConnection(http.client.HTTPConnection):
def connect(self):
self.sock = socket.socket(
socket.AF_UNIX, socket.SOCK_STREAM
grantjenks /
Last active Oct 28, 2021
Server-side I/O Performance in Python
"""Server-side I/O Performance in Python
Based on the article and discussion at:
The code was posted at:
"""Make Groups
# Problem
I am a teacher and every year we have overnight excursions where we have to
organize rooms for around 100 students however there are a number of
requirements when organise these rooms:
grantjenks /
Created Dec 20, 2016
Performance Comparison of namedtuple, namedlist, and recordclass
import sys
class Record(object):
__slots__ = ()
def __init__(self, *args):
assert len(self.__slots__) == len(args)
for field, value in zip(self.__slots__, args):
setattr(self, field, value)