Skip to content

Instantly share code, notes, and snippets.

View heyajulia's full-sized avatar

Julia heyajulia

  • 04:06 (UTC +01:00)
View GitHub Profile
# 0) Make the image blockier so the effect is actually noticeable
convert Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.webp -colors 2 -posterize 2 mona_lisa_flat.png
# 1) Flatten alpha onto white, 24-bit BMP v3 header (54-byte header)
convert mona_lisa_flat.png \
-background white -alpha remove -alpha off \
-define bmp:subtype=RGB24 bmp3:mona.bmp
# 2) Split header + pixels exactly at offset (54)
dd if=mona.bmp of=header.bin bs=1 count=54

This is the exact prompt I sent to R1, accidental typos and all.


I need your help cleaning up "abandoned" threadgates (restricted reply requests) on my account. Write a Python program to do it. `requests` and `rich` are available. It should be fast and performant and kind on both my resources and Bluesky's.

Here's a HTTPie example of how to acquire an access JWT and the DID:

http \
{
description = "Python 3.13.1 with an off-by-default JIT";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }: {
packages.aarch64-darwin.default = let
pkgs = import nixpkgs {
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Unicode;
var message = "¡Más amor, por favor!";
var payload = JsonSerializer.Serialize(message, new JsonSerializerOptions
{
Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
});
http \
  POST \
  https://bsky.social/xrpc/com.atproto.server.createSession \
  identifier=USERNAME.bsky.social \
  password=APP_SPECIFIC_PASSWORD

http \
  POST \
 https://bsky.social/xrpc/com.atproto.repo.createRecord \
#!/bin/bash
# How to use this script:
#
# 1. gh auth logout
# 2. gh auth login --scopes "project,read:project"
# 3. gh api graphql --cache 5m --jq ".data.user.projectV2.id" -f query='query { user(login: "octocat") { projectV2(number: 42) { id } } }'
#
# Replace "octocat" with your GitHub username and "42" with the project number, and add the project ID to the script.
# 4. Create a file named "issues.txt" with one issue title per line.

The speedup provided by Python's new JIT is pretty amazing. A 20% speedup over 3.12! And: no code changes necessary.

Benchmark 1: python3.12 main.py
  Time (mean ± σ):      1.213 s ±  0.028 s    [User: 1.162 s, System: 0.008 s]
  Range (min … max):    1.181 s …  1.281 s    10 runs

Benchmark 2: PYTHON_JIT=0 python3.13 main.py
  Time (mean ± σ):      1.124 s ±  0.013 s    [User: 1.114 s, System: 0.004 s]
  Range (min … max):    1.097 s …  1.137 s    10 runs
// Grab all Ruff rule categories from the Ruff docs.
// Run this in the browser console on https://docs.astral.sh/ruff/rules/.
const R = await import("https://esm.sh/[email protected]");
R.pipe(
R.tail,
R.pluck("innerText"),
R.map(R.match(/\(([A-Z0-9]+(?:, *[A-Z0-9]+)*)\)/)),
R.map(R.last),
R.chain(R.split(", ")),
@heyajulia
heyajulia / python.md
Last active August 4, 2025 11:00
How to Upgrade Python using Pyenv and Raku using Rakubrew

Here's what I do:

brew upgrade --quiet pyenv
OLD_VERSION=$(cat ~/.pyenv/version)
NEW_VERSION=$(pyenv install -l | awk '/^[[:space:]]+[0-9]/ { sub(/^[[:space:]]+/, ""); print }' | sort -Vr | fzf)
pyenv uninstall $OLD_VERSION
pyenv install $NEW_VERSION
pyenv global $NEW_VERSION
pyenv rehash # idk if this is needed
gh api graphql --cache 1h --jq '.data.repository.milestone.issues.edges[] | {(.node.number|tostring): [.node.assignees.edges[].node.login] | length}' --paginate -f query='query ($endCursor: String) {
repository(owner: "microsoft", name: "vscode") {
milestone(number: 8) {
issues(first: 1000, states: [OPEN], after: $endCursor) {
edges {
node {
number
title
assignees(first: 10) {
edges {