{
  "path": "/first-pckt-post-13z8wvn",
  "site": "at://did:plc:xbtmt2zjwlrfegqvch7fboei/site.standard.publication/3mbmm4qeiy2to",
  "tags": [],
  "$type": "site.standard.document",
  "title": "first pckt post!",
  "content": {
    "$type": "blog.pckt.content",
    "items": [
      {
        "$type": "blog.pckt.block.text",
        "facets": [
          {
            "index": {
              "byteEnd": 50,
              "byteStart": 47
            },
            "features": [
              {
                "uri": "https://ziglang.org/",
                "$type": "blog.pckt.richtext.facet#link"
              }
            ]
          }
        ],
        "plaintext": "i have been writing a lot of atproto things in zig!"
      },
      {
        "$type": "blog.pckt.block.bulletList",
        "content": [
          {
            "$type": "blog.pckt.block.listItem",
            "content": [
              {
                "$type": "blog.pckt.block.text",
                "facets": [
                  {
                    "index": {
                      "byteEnd": 21,
                      "byteStart": 0
                    },
                    "features": [
                      {
                        "uri": "https://music-atmosphere-feed.plyr.fm/",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  },
                  {
                    "index": {
                      "byteEnd": 28,
                      "byteStart": 23
                    },
                    "features": [
                      {
                        "uri": "https://music-atmosphere-feed.plyr.fm/",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  }
                ],
                "plaintext": "feeds of music links! (stats)"
              }
            ]
          },
          {
            "$type": "blog.pckt.block.listItem",
            "content": [
              {
                "$type": "blog.pckt.block.text",
                "facets": [
                  {
                    "index": {
                      "byteEnd": 19,
                      "byteStart": 0
                    },
                    "features": [
                      {
                        "uri": "https://leaflet-search.pages.dev/",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  },
                  {
                    "index": {
                      "byteEnd": 26,
                      "byteStart": 21
                    },
                    "features": [
                      {
                        "uri": "https://leaflet-search-backend.fly.dev/dashboard",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  }
                ],
                "plaintext": "search for leaflet! (stats)"
              }
            ]
          },
          {
            "$type": "blog.pckt.block.listItem",
            "content": [
              {
                "$type": "blog.pckt.block.text",
                "facets": [
                  {
                    "index": {
                      "byteEnd": 15,
                      "byteStart": 0
                    },
                    "features": [
                      {
                        "uri": "https://bsky.app/profile/find-bufo.com",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  },
                  {
                    "index": {
                      "byteEnd": 22,
                      "byteStart": 17
                    },
                    "features": [
                      {
                        "uri": "https://bot-stats.find-bufo.com/",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  }
                ],
                "plaintext": "a fun dumb bot! (stats)"
              }
            ]
          },
          {
            "$type": "blog.pckt.block.listItem",
            "content": [
              {
                "$type": "blog.pckt.block.text",
                "facets": [
                  {
                    "index": {
                      "byteEnd": 6,
                      "byteStart": 0
                    },
                    "features": [
                      {
                        "uri": "https://pollz.waow.tech/",
                        "$type": "blog.pckt.richtext.facet#link"
                      }
                    ]
                  }
                ],
                "plaintext": "pollz!"
              }
            ]
          }
        ]
      },
      {
        "$type": "blog.pckt.block.text",
        "plaintext": "and so, i have started working on a zig SDK for atproto so that i don't need to reimplement DID parsing or handle resolution over and over again (which is not a bad thing to have to do at first, as it helps remind me how the protocol works and also ziglang, which is relatively new to me)"
      },
      {
        "$type": "blog.pckt.block.text",
        "plaintext": "here's the (wip) SDK:"
      },
      {
        "src": "https://tangled.org/zzstoatzz.io/zat",
        "$type": "blog.pckt.block.website",
        "title": "zzstoatzz.io/zat",
        "description": "atproto tools in zig",
        "previewImage": "https://tangled.org/zzstoatzz.io/zat/opengraph"
      },
      {
        "$type": "blog.pckt.block.text",
        "facets": [
          {
            "index": {
              "byteEnd": 62,
              "byteStart": 54
            },
            "features": [
              {
                "uri": "https://zig.guide/master/language-basics/comptime",
                "$type": "blog.pckt.richtext.facet#link"
              }
            ]
          }
        ],
        "plaintext": "the thing most interesting about zig in my opinion is comptime"
      },
      {
        "$type": "blog.pckt.block.text",
        "facets": [
          {
            "index": {
              "byteEnd": 37,
              "byteStart": 13
            },
            "features": [
              {
                "uri": "https://tangled.sh/zzstoatzz.io/zat/tree/main/src/internal/multibase.zig#L40-L46",
                "$type": "blog.pckt.richtext.facet#link"
              }
            ]
          }
        ],
        "plaintext": "for example, this base58 decode table is computed at compile time and baked directly into the binary - no runtime initialization, no lazy statics, etc:"
      },
      {
        "$type": "blog.pckt.block.codeBlock",
        "attrs": {
          "language": "zig"
        },
        "plaintext": "// base58 decode table - computed at compile time, embedded in binary\n// no runtime initialization, no lazy statics, just data\n\nconst decode_table: [256]i8 = blk: {\n    const alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n    var table: [256]i8 = .{-1} ** 256;  // -1 = invalid character\n    for (alphabet, 0..) |c, i| {\n        table[c] = @intCast(i);\n    }\n    break :blk table;\n};\n\n// at runtime, decoding is just a lookup: table['Z'] -> 32"
      },
      {
        "$type": "blog.pckt.block.blockquote",
        "content": [
          {
            "$type": "blog.pckt.block.text",
            "facets": [
              {
                "index": {
                  "byteEnd": 76,
                  "byteStart": 0
                },
                "features": [
                  {
                    "uri": "https://ziglang.org/documentation/master/#Container-Level-Variables",
                    "$type": "blog.pckt.richtext.facet#link"
                  }
                ]
              }
            ],
            "plaintext": "The initialization value of container level variables is implicitly comptime."
          }
        ]
      },
      {
        "$type": "blog.pckt.block.text",
        "plaintext": "naively, it seems like comptime is a good fit when dealing with (parts of) a protocol like atproto where there's a lot of static structure - defined once, used everywhere"
      },
      {
        "$type": "blog.pckt.block.text",
        "plaintext": ""
      },
      {
        "$type": "blog.pckt.block.text",
        "plaintext": "we'll see how my use progresses!"
      }
    ]
  },
  "updatedAt": "2026-03-30T11:14:52+00:00",
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreicnelu5mrsjwrbsm3kqftayp4pyqf3mjxfv5aqxptoujca5jejhya"
    },
    "mimeType": "image/webp",
    "size": 54316
  },
  "description": "i have been writing a lot of atproto things in zig! and so, i have started working on a zig SDK for atproto so that i don't need to reimplement DID parsing or handle resolution over and over again (which is not a bad thing to have to do at first, as it helps remind me how the protocol works and also ziglang, which is relatively new to me) here's the (wip) SDK:",
  "publishedAt": "2026-01-04T18:58:05+00:00",
  "textContent": "i have been writing a lot of atproto things in zig!\nfeeds of music links! (stats)\nsearch for leaflet! (stats)\na fun dumb bot! (stats)\npollz!\nand so, i have started working on a zig SDK for atproto so that i don't need to reimplement DID parsing or handle resolution over and over again (which is not a bad thing to have to do at first, as it helps remind me how the protocol works and also ziglang, which is relatively new to me)\nhere's the (wip) SDK:\nthe thing most interesting about zig in my opinion is comptime\nfor example, this base58 decode table is computed at compile time and baked directly into the binary - no runtime initialization, no lazy statics, etc:\n// base58 decode table - computed at compile time, embedded in binary\n// no runtime initialization, no lazy statics, just data\n\nconst decode_table: [256]i8 = blk: {\n    const alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n    var table: [256]i8 = .{-1} ** 256;  // -1 = invalid character\n    for (alphabet, 0..) |c, i| {\n        table[c] = @intCast(i);\n    }\n    break :blk table;\n};\n\n// at runtime, decoding is just a lookup: table['Z'] -> 32\nThe initialization value of container level variables is implicitly comptime.\nnaively, it seems like comptime is a good fit when dealing with (parts of) a protocol like atproto where there's a lot of static structure - defined once, used everywhere\nwe'll see how my use progresses!"
}