Skip to content

Instantly share code, notes, and snippets.

View leowhitehead's full-sized avatar
💭
linking my repos to other repos or whatever it is people do on github

Leo Whitehead leowhitehead

💭
linking my repos to other repos or whatever it is people do on github
View GitHub Profile
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active November 4, 2024 22:31
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
import socket
import struct
import json
def unpack_varint(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
d |= (b & 0x7F) << 7*i
if not b & 0x80: