Skip to content

Instantly share code, notes, and snippets.

@eddieantonio
eddieantonio / local-scope.py
Created October 27, 2023 14:05
What will happen in this Python example? (made while writing this: https://eddieantonio.ca/blog/2023/10/25/python-is-a-compiled-language/)
a = "hello"
def say_a():
print(a)
if False:
a = "goodbye"
say_a()
@eddieantonio
eddieantonio / array vs bytearray.ipynb
Created August 7, 2023 22:26
Comparing `array` vs `bytearray` in performance
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddieantonio
eddieantonio / checkerboard.svg
Created August 7, 2023 13:42
Artisanally-crafted checkerboard pattern, as a tiny SVG. Embed this as a CSS background.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddieantonio
eddieantonio / hello.1.md
Last active January 30, 2023 12:41
man page template in Markdown

% HELLO(1) Version 1.0 | Frivolous "Hello World" Documentation

NAME

hello — prints Hello, World!

SYNOPSIS

@eddieantonio
eddieantonio / example.py
Created March 30, 2017 20:43
Zero-dependency Python 3 and Node IPC using UNIX sockets
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import socket
import json
server_address = '/tmp/example.sock'
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(server_address)
@eddieantonio
eddieantonio / Makefile
Last active January 17, 2023 18:02
Using make and pandoc to author man pages.
include pandoc-man.mk
all: hello.1
.PHONY: all
@eddieantonio
eddieantonio / load_pyc.py
Created September 2, 2022 19:40
Terrible script to dump CPython bytecode from a .pyc file
"""
Usage:
python3 -i load_pyc.py path/to/file.pyc
"""
import dis
import importlib.util
import marshal
@eddieantonio
eddieantonio / list-processes-listening
Created March 21, 2022 15:40
Filter the output of ss -tulpn and display only relevant information, truncated
#!/bin/sh
ss -tulpn | awk '$2=="LISTEN" {printf "%16s %s\n", $5, substr($7, 1, 80-16)}'
@eddieantonio
eddieantonio / Best Wordle Starter Word.ipynb
Last active January 19, 2022 10:02
My attempt to find a good starter guess for Wordle
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eddieantonio
eddieantonio / crksyllabics.sty
Last active November 24, 2021 09:54
Get nêhiyawêwin (Plains Cree) syllabics working in XeLaTeX!
% crksyllabics.sty -- use ᓀᐦᐃᔭᐍᐏᐣ in XeLaTeX
%
% Defines font fallbacks for all Plains Cree syllabics.
%
% Uses Euphemia UCAS as the fallback font.
%
% Usage:
%
% 1. place this file in the same folder as your .tex file (upload to same folder in Overleaf)
% 2. Add the following line near the top of your .tex file: