Skip to content

Instantly share code, notes, and snippets.

@Butts
Butts / gaia_avatar.py
Last active November 24, 2025 22:42
This was ported from some very old code, I was unsure it'd work, but with some tinkering, I managed to get it to work. The substring stuff is not really ideal, but it works. Pretty funky stuff.
import zlib
import enum
# Generate absolute value crc32 -> 64bit.
def abs_crc32_64bit(value: str) -> int:
crc = abs(zlib.crc32(value.encode()))
if crc & 0x80000000:
crc ^= 0xFFFFFFFF
crc += 1
@mikowl
mikowl / oneliners.js
Last active September 24, 2025 19:23
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);