Skip to content

Instantly share code, notes, and snippets.

View ShreyanJain9's full-sized avatar

shreyan ShreyanJain9

View GitHub Profile
@ShreyanJain9
ShreyanJain9 / bloom_filter.ex
Last active March 28, 2024 20:48
A Bloom Filter in Elixir
defmodule BloomFilter do
@moduledoc """
A small Bloom Filter in Elixir
"""
@default_hash_fns [:sha256, :sha512, :blake2b]
defstruct bits: <<0::size(64)>>, hash_fns: @default_hash_fns
@ShreyanJain9
ShreyanJain9 / add_rotationkey.ts
Created July 18, 2024 22:38
very lazy and quick edit of hailey's pds migration script in a way i think should let you just add a rotation key. untested, use at your own risk
import AtpAgent from '@atproto/api'
import { Secp256k1Keypair } from '@atproto/crypto'
import * as ui8 from 'uint8arrays'
const OLD_PDS_URL = 'https://bsky.social'
const CURRENT_HANDLE = 'haileyok.com'
const CURRENT_PASSWORD = ''
const TOKEN = '' // Use `getEmail` first, and set this to the token that you receive.
const getEmail = async () => {
@ShreyanJain9
ShreyanJain9 / datarepos.md
Created September 6, 2024 04:30
ATProto data repositories

ATProto Data Repositories, Demystified

If you’re an ATProto developer (feel free to read this if you’re a normie too - I hope I’d be able to impart at least some of the magic to you too, though there’s a high chance most of this ends up flying over your head) you’ve probably heard the term “repo” come up at least once in discussions of the ATProto architecture. While most of the time you can ignore the details of how these data repositories work, since they are the beating heart of ATProto, you may want to learn more about them, and if you know with some detail their inner workings you may also find yourself able to use the protocol more effectively.

If you’ve touched even a bit of ATProto, you probably know that data is organized into typed ‘collections’ of ‘records’. These are actually conceptually not that different from what in an SQL or similar database you might refer to as ‘columns’ of ‘rows’ or ‘records’ - and that’s intentional. ATProto repos are, essentially, a database containing your personal