Skip to content

Instantly share code, notes, and snippets.

View grantjenks's full-sized avatar

Grant Jenks grantjenks

View GitHub Profile
@grantjenks
grantjenks / reboot.service
Created May 3, 2020 20:28
Weekly reboots using systemd.
# /etc/systemd/system/reboot.service
[Unit]
Description=Reboot Service
[Service]
Type=oneshot
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
grantjenks / xml_rpc_client_unix_domain_socket.py
Created October 22, 2019 03:42
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
grantjenks / bottlebench.py
Last active October 28, 2021 18:00
Server-side I/O Performance in Python
"""Server-side I/O Performance in Python
Based on the article and discussion at:
https://www.toptal.com/back-end/server-side-io-performance-node-php-java-go
The code was posted at:
https://peabody.io/post/server-env-benchmarks/
@grantjenks
grantjenks / make_groups.py
Last active November 23, 2017 00:50
Make Groups
"""Make Groups
# Problem
https://www.reddit.com/r/Python/comments/7awlm1/
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
grantjenks / mutable_namedtuple_comparison.py
Created December 20, 2016 19:17
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)