From e7586b646bbede73e6ff010671084a5d08a85b06 Mon Sep 17 00:00:00 2001 From: horo <143025439+horo-fox@users.noreply.github.com> Date: Sat, 24 Aug 2024 13:55:19 +0900 Subject: [PATCH] Switch over to a nicer formatter --- .prettierrc | 5 - .vscode/settings.json | 4 +- astro.config.ts | 2 +- dprint.json | 10 + package-lock.json | 180 ++++++++++++------ package.json | 3 +- .../journal/an-outside-view-of-programming.md | 6 +- src/content/journal/decoding-azw3f-azw3r.md | 38 ++-- .../journal/error-resilient-peg-parsing.md | 4 +- src/content/journal/failing-loudly.md | 4 +- .../journal/interesting-facts-kodak.md | 8 +- src/content/journal/paper-titles.md | 6 +- src/content/journal/reading-progress-azw3f.md | 18 +- .../journal/simplification-of-circuits-1.md | 4 +- .../journal/song-recommendations-january.md | 18 +- src/content/journal/syntax-representations.md | 4 +- src/content/journal/two-usecases-for-uv.md | 4 +- .../zig-cpython-extension-on-windows.md | 18 +- .../journal/zig-cpython-extension-wheel.md | 4 +- src/layouts/MainLayout.astro | 60 +++--- src/pages/index.astro | 96 +++++----- src/pages/journal/[slug].astro | 156 +++++++-------- src/util/data.ts | 3 +- 23 files changed, 365 insertions(+), 290 deletions(-) delete mode 100644 .prettierrc create mode 100644 dprint.json diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index ee0ccf4..0000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "plugins": ["prettier-plugin-astro"], - "tabWidth": 4, - "bracketSameLine": true -} diff --git a/.vscode/settings.json b/.vscode/settings.json index e09f45b..2cedf6c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,8 +5,8 @@ "stylelint.validate": ["css", "astro"], "eslint.validate": ["typescript", "astro"], "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "dprint.dprint", "[astro]": { - "editor.defaultFormatter": "astro-build.astro-vscode" + "editor.defaultFormatter": "dprint.dprint" } } diff --git a/astro.config.ts b/astro.config.ts index cca2364..0a97325 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -2,8 +2,8 @@ import { defineConfig } from "astro/config"; import mdx from "@astrojs/mdx"; import sitemap from "@astrojs/sitemap"; -import { visit } from "unist-util-visit"; import GithubSlugger from "github-slugger"; +import { visit } from "unist-util-visit"; // https://astro.build/config export default defineConfig({ diff --git a/dprint.json b/dprint.json new file mode 100644 index 0000000..c9417d9 --- /dev/null +++ b/dprint.json @@ -0,0 +1,10 @@ +{ + "excludes": ["**/node_modules", "**/*-lock.json"], + "plugins": [ + "https://plugins.dprint.dev/typescript-0.91.6.wasm", + "https://plugins.dprint.dev/json-0.19.3.wasm", + "https://plugins.dprint.dev/markdown-0.17.6.wasm", + "https://plugins.dprint.dev/g-plane/markup_fmt-v0.12.0.wasm" + ], + "indentWidth": 4 +} diff --git a/package-lock.json b/package-lock.json index a3baee4..93a28b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,13 +19,12 @@ }, "devDependencies": { "@typescript-eslint/parser": "^8.2.0", + "dprint": "^0.47.2", "eslint": "^8.57.0", "eslint-plugin-astro": "^1.2.3", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-jsx-a11y": "^6.8.0", "postcss-html": "^1.5.0", - "prettier": "^3.1.1", - "prettier-plugin-astro": "^0.14.1", "stylelint": "^16.1.0", "stylelint-config-html": "^1.1.0", "stylelint-config-standard": "^36.0.0" @@ -531,6 +530,110 @@ "postcss-selector-parser": "^6.1.0" } }, + "node_modules/@dprint/darwin-arm64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.47.2.tgz", + "integrity": "sha512-mVPFBJsXxGDKHHCAY8wbqOyS4028g1bN15H9tivCnPAjwaZhkUimZHXWejXADjhGn+Xm2SlakugY9PY/68pH3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/darwin-x64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.47.2.tgz", + "integrity": "sha512-T7wzlc+rBV+6BRRiBjoqoy5Hj4TR2Nv2p2s9+ycyPGs10Kj/JXOWD8dnEHeBgUr2r4qe/ZdcxmsFQ5Hf2n0WuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/linux-arm64-glibc": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.47.2.tgz", + "integrity": "sha512-B0m1vT5LdVtrNOVdkqpLPrSxuCD+l5bTIgRzPaDoIB1ChWQkler9IlX8C+RStpujjPj6SYvwo5vTzjQSvRdQkA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-arm64-musl": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.47.2.tgz", + "integrity": "sha512-zID6wZZqpg2/Q2Us+ERQkbhLwlW3p3xaeEr00MPf49bpydmEjMiPuSjWPkNv+slQSIyIsVovOxF4lbNZjsdtvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-glibc": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.47.2.tgz", + "integrity": "sha512-rB3WXMdINnRd33DItIp7mObS7dzHW90ZzeJSsoKJLPp+Z7wXjjb27UUowfqVI4baa/1pd7sdbX54DPohMtfu/A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-musl": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.47.2.tgz", + "integrity": "sha512-E0+TNbzYdTXJ/jCVjUctVxkda/faw++aDQLfyWGcmdMJnbM7NZz+W4fUpDXzMPsjy+zTWxXcPK7/q2DZz2gnbg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/win32-arm64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-arm64/-/win32-arm64-0.47.2.tgz", + "integrity": "sha512-K1EieTCFjfOCmyIhw9zFSduE6qVCNHEveupqZEfbSkVGw5T9MJQ1I9+n7MDb3RIDYEUk0enJ58/w82q8oDKCyA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@dprint/win32-x64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.47.2.tgz", + "integrity": "sha512-LhizWr8VrhHvq4ump8HwOERyFmdLiE8C6A42QSntGXzKdaa2nEOq20x/o56ZIiDcesiV+1TmosMKimPcOZHa+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@dual-bundle/import-meta-resolve": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@dual-bundle/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", @@ -3316,6 +3419,26 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dprint": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.47.2.tgz", + "integrity": "sha512-geUcVIIrmLaY+YtuOl4gD7J/QCjsXZa5gUqre9sO6cgH0X/Fa9heBN3l/AWVII6rKPw45ATuCSDWz1pyO+HkPQ==", + "dev": true, + "hasInstallScript": true, + "bin": { + "dprint": "bin.js" + }, + "optionalDependencies": { + "@dprint/darwin-arm64": "0.47.2", + "@dprint/darwin-x64": "0.47.2", + "@dprint/linux-arm64-glibc": "0.47.2", + "@dprint/linux-arm64-musl": "0.47.2", + "@dprint/linux-x64-glibc": "0.47.2", + "@dprint/linux-x64-musl": "0.47.2", + "@dprint/win32-arm64": "0.47.2", + "@dprint/win32-x64": "0.47.2" + } + }, "node_modules/dset": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.3.tgz", @@ -7745,35 +7868,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "dev": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-plugin-astro": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz", - "integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==", - "dev": true, - "dependencies": { - "@astrojs/compiler": "^2.9.1", - "prettier": "^3.0.0", - "sass-formatter": "^0.7.6" - }, - "engines": { - "node": "^14.15.0 || >=16.0.0" - } - }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -8222,12 +8316,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/s.color": { - "version": "0.0.15", - "resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz", - "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", - "dev": true - }, "node_modules/safe-array-concat": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", @@ -8263,15 +8351,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sass-formatter": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz", - "integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==", - "dev": true, - "dependencies": { - "suf-log": "^2.5.3" - } - }, "node_modules/sax": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", @@ -8974,15 +9053,6 @@ "node": ">=8" } }, - "node_modules/suf-log": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", - "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", - "dev": true, - "dependencies": { - "s.color": "0.0.15" - } - }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index 901a6fe..d27c9a3 100644 --- a/package.json +++ b/package.json @@ -21,13 +21,12 @@ }, "devDependencies": { "@typescript-eslint/parser": "^8.2.0", + "dprint": "^0.47.2", "eslint": "^8.57.0", "eslint-plugin-astro": "^1.2.3", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-jsx-a11y": "^6.8.0", "postcss-html": "^1.5.0", - "prettier": "^3.1.1", - "prettier-plugin-astro": "^0.14.1", "stylelint": "^16.1.0", "stylelint-config-html": "^1.1.0", "stylelint-config-standard": "^36.0.0" diff --git a/src/content/journal/an-outside-view-of-programming.md b/src/content/journal/an-outside-view-of-programming.md index b899dda..51a0ef0 100644 --- a/src/content/journal/an-outside-view-of-programming.md +++ b/src/content/journal/an-outside-view-of-programming.md @@ -6,8 +6,8 @@ summary: "Being a programmer, it's hard to remember what drew me" I absolutely love programming. Recently, I've been thinking about how non-programmers view programmers, specifically in the context of what programmer-specific content would a non-programmer appreciate? This is part of a larger rethinking of myself. So here's my thoughts: -- Decompiling is interesting and fun to do, but runs into some legal barriers (as part of software contracts). Supposedly the DMCA (see what I was talking about yesterday??) sets aside a specific exclusion for interop purposes. Think liveoverflow. -- Actually making a software project. I'm not sure this is entertaining for non-software folks, unless explained well. Explaining is hard! -- Reacting to software news. This isn't entertaining to non-programmers, I think. Think Primeagen, fireship. +- Decompiling is interesting and fun to do, but runs into some legal barriers (as part of software contracts). Supposedly the DMCA (see what I was talking about yesterday??) sets aside a specific exclusion for interop purposes. Think liveoverflow. +- Actually making a software project. I'm not sure this is entertaining for non-software folks, unless explained well. Explaining is hard! +- Reacting to software news. This isn't entertaining to non-programmers, I think. Think Primeagen, fireship. Looking for analogues to software engineering, I find stuff like Practical Engineering or Veritasium, who produce high quality videos explaining larger systems. I think that might be the best approach listed here. diff --git a/src/content/journal/decoding-azw3f-azw3r.md b/src/content/journal/decoding-azw3f-azw3r.md index d0a734b..db4e4dc 100644 --- a/src/content/journal/decoding-azw3f-azw3r.md +++ b/src/content/journal/decoding-azw3f-azw3r.md @@ -9,18 +9,18 @@ Yes, I know KFX is a thing nowadays and AZW3 is dumb and old. But I have AZW3 bo Anyways from the start, I'm assuming this is a TLV-style format. And looking at it more, it does seem that way for arrays at least: -- `FE` is the tag for an array -- `1` means the name is zero size, otherwise continue -- big endian `u16` for name size -- followed by size bytes which is the array's name -- this is followed by any number of values, ending with a `FF` tag +- `FE` is the tag for an array +- `1` means the name is zero size, otherwise continue +- big endian `u16` for name size +- followed by size bytes which is the array's name +- this is followed by any number of values, ending with a `FF` tag String values seem to be represented as such: -- `03` as a tag -- `1` means stop and this is zero length, otherwise continue -- big endian `u16` for size -- followed by size bytes which is that string's contents +- `03` as a tag +- `1` means stop and this is zero length, otherwise continue +- big endian `u16` for size +- followed by size bytes which is that string's contents The overall file seems to consistently start with: @@ -32,28 +32,28 @@ Followed by a big endian `u32` which is the number of values. Smaller integer values seem to be represented as such: -- `01` as a tag -- big endian `u32` +- `01` as a tag +- big endian `u32` Integer values seem to be as such: -- `02` as a tag -- big endian `u64` +- `02` as a tag +- big endian `u64` I'm pretty sure these are floats? (based on looking things up etc.) -- `04` as tag -- `f64` +- `04` as tag +- `f64` When making a parser for this, I encounted a tag `0`: -- `00` as tag -- presumably `00` for false and `01` for true +- `00` as tag +- presumably `00` for false and `01` for true I also found `7`: -- `07` as a tag -- single byte +- `07` as a tag +- single byte Here's what an azw3r file looks like when parsed: diff --git a/src/content/journal/error-resilient-peg-parsing.md b/src/content/journal/error-resilient-peg-parsing.md index 23ee90d..dec8a46 100644 --- a/src/content/journal/error-resilient-peg-parsing.md +++ b/src/content/journal/error-resilient-peg-parsing.md @@ -11,7 +11,7 @@ However, PEG parsing relies on parsing failures to parse things. I don't immedia I don't have a solution. Here's some ideas I've been considering: -1. Parse without error resilience, then if all paths fail then take the one that went the "furthest" with error resilience. If there's a tie then probably just go with the first parse option. This seems to be a good idea for prefix-related mistakes (so like, `def () -> None print("haiii")` or `[3, 4 a = 4`), especially when combined with swift-syntax style token precedence (e.g. you cannot parse past punctuation looking for an identifier). But this doesn't seem like a very good idea for suffix-related mistakes (`b = 5, 6]`). I think this might be an acceptable tradeoff for programming where we mostly write left-to-right. -2. Just skip the current token instead. +1. Parse without error resilience, then if all paths fail then take the one that went the "furthest" with error resilience. If there's a tie then probably just go with the first parse option. This seems to be a good idea for prefix-related mistakes (so like, `def () -> None print("haiii")` or `[3, 4 a = 4`), especially when combined with swift-syntax style token precedence (e.g. you cannot parse past punctuation looking for an identifier). But this doesn't seem like a very good idea for suffix-related mistakes (`b = 5, 6]`). I think this might be an acceptable tradeoff for programming where we mostly write left-to-right. +2. Just skip the current token instead. I think 1. is an acceptable approach for my application. But I haven't implemented it so maybe I'll come back here talking about how it's a bad idea. diff --git a/src/content/journal/failing-loudly.md b/src/content/journal/failing-loudly.md index d2e875b..43403f6 100644 --- a/src/content/journal/failing-loudly.md +++ b/src/content/journal/failing-loudly.md @@ -8,8 +8,8 @@ I really don't like JavaScript's tendency to fail quietly. I understand the rati Let's compare two possible approaches for handling external data: -- throwing it into an unstructured blob and going through that -- converting it via a schema +- throwing it into an unstructured blob and going through that +- converting it via a schema JavaScript seems to go with the first. It sucks. Special syntax for property access, conveniences for unexpected data, type coersion, etc. diff --git a/src/content/journal/interesting-facts-kodak.md b/src/content/journal/interesting-facts-kodak.md index 5e1c9a0..69d5774 100644 --- a/src/content/journal/interesting-facts-kodak.md +++ b/src/content/journal/interesting-facts-kodak.md @@ -8,10 +8,10 @@ I watched the Technology Connections video on flash photography earlier. After h Turns out: -- Kodak runs a photography developing (?) lab in Atlanta. Here are the addresses: - - 2156 Faulkner Road (16mm, 35mm color) - - 6 West Druid Hills Drive (35mm color) -- Kodak had to let others develop photographs because of an antitrust ruling. +- Kodak runs a photography developing (?) lab in Atlanta. Here are the addresses: + - 2156 Faulkner Road (16mm, 35mm color) + - 6 West Druid Hills Drive (35mm color) +- Kodak had to let others develop photographs because of an antitrust ruling. This makes me want to recreate a camera. I made one in high school as part of a class project, but I made that of wood (not necessarily bad) and it wasn't very good. I think it would be quite fun to recreate that using the maker spaces here. Might be a good excuse to try out the Hive some more? Or to visit Flowers? diff --git a/src/content/journal/paper-titles.md b/src/content/journal/paper-titles.md index 1a17882..eabe137 100644 --- a/src/content/journal/paper-titles.md +++ b/src/content/journal/paper-titles.md @@ -6,8 +6,8 @@ summary: "'Simple'? 'Easy'? That's the claim at least" I was reading some papers today. Here's some titles (emphasis my own): -- Complete and **Easy** Bidirectional Typechecking for Higher-Rank Polymorphism -- Paxos Made **Simple** -- In Search of an **Understandable** Consensus Algorithm +- Complete and **Easy** Bidirectional Typechecking for Higher-Rank Polymorphism +- Paxos Made **Simple** +- In Search of an **Understandable** Consensus Algorithm I just find these titles quite ironic and fun. diff --git a/src/content/journal/reading-progress-azw3f.md b/src/content/journal/reading-progress-azw3f.md index a30ed09..c4bd564 100644 --- a/src/content/journal/reading-progress-azw3f.md +++ b/src/content/journal/reading-progress-azw3f.md @@ -17,22 +17,22 @@ Making that more legible: 1. `timer.model` 2. `fpr` - - location? - - the rest are weird + - location? + - the rest are weird 3. `book.info.store` 4. `page.history.store` - - some integer - - `page.history.record` with: - - location? - - unix timestamp in milliseconds + - some integer + - `page.history.record` with: + - location? + - unix timestamp in milliseconds 5. `whisperstore.migration.status` 6. `lpr` - - some byte - - location? - - unix timestamp in milliseconds + - some byte + - location? + - unix timestamp in milliseconds ``` [Values("timer.model", [Int(0), Int(16738451), Int(109283), Float(1.8871635610765867), Values("timer.average.calculator", [SmallInt(0), SmallInt(0), SmallInt(3), Values("timer.average.calculator.distribution.normal", [Int(639), Float(237857.9505740977), Float(94780047.88265847)]), Values("timer.average.calculator.distribution.normal", [Int(276), Float(150799.6752729375), Float(82640001.87330134)]), Values("timer.average.calculator.distribution.normal", [Int(265), Float(186925.90309029608), Float(133574691.72020479)]), SmallInt(0)])]), Values("fpr", [String("432748"), Int(18446744073709551615), Int(18446744073709551615), String(""), String("")]), Values("book.info.store", [Int(166098), Float(2.8647342995168787)]), Values("page.history.store", [SmallInt(1), Values("page.history.record", [String("432748"), Int(1706679607926)])]), Values("whisperstore.migration.status", [Boolean(false), Boolean(false)]), Values("lpr", [Byte(2), String("431264"), Int(1706679660866)])] diff --git a/src/content/journal/simplification-of-circuits-1.md b/src/content/journal/simplification-of-circuits-1.md index 29d7610..65e1767 100644 --- a/src/content/journal/simplification-of-circuits-1.md +++ b/src/content/journal/simplification-of-circuits-1.md @@ -26,5 +26,5 @@ Anyways, I won't post the code now because it doesn't work for most things and I Future improvements for a future journal entry: -- multiple outputs? (IDK how this would work) -- n-ary `and` and `or` -- I have the basics set up but the searches and appliers would require a custom trait impl and I was just kinda lazy. +- multiple outputs? (IDK how this would work) +- n-ary `and` and `or` -- I have the basics set up but the searches and appliers would require a custom trait impl and I was just kinda lazy. diff --git a/src/content/journal/song-recommendations-january.md b/src/content/journal/song-recommendations-january.md index 05759d1..d0f83fe 100644 --- a/src/content/journal/song-recommendations-january.md +++ b/src/content/journal/song-recommendations-january.md @@ -8,23 +8,23 @@ I spent my time today on homework, so that's not a source of things to talk abou But anyways, I've been liking some rap: -- JPEGMafia has been growing on me -- Quadeca has some cool stuff in the scrapyards EPs +- JPEGMafia has been growing on me +- Quadeca has some cool stuff in the scrapyards EPs I've also been getting back into electronic: -- Jane Remover (I really like Frailty!) -- some underscores -- Getting back into Porter Robinson's Nurture +- Jane Remover (I really like Frailty!) +- some underscores +- Getting back into Porter Robinson's Nurture Trying out some new artists: -- boygenius (I really like "Afraid of Heights" and "Letter To An Old Poet") -- Hozier ("Someone New" is great!) +- boygenius (I really like "Afraid of Heights" and "Letter To An Old Poet") +- Hozier ("Someone New" is great!) And some older songs: -- Early Radiohead: "Just" and "Jigsaw Falling Into Place" -- Classic rock: Nirvana and Smashing Pumpkins +- Early Radiohead: "Just" and "Jigsaw Falling Into Place" +- Classic rock: Nirvana and Smashing Pumpkins I'm going to a Jane Remover concert in February so I should get some more listening in to Census Designated. I also want to find some new electronic artists. I'm happy about the breadth of rap I like once I put time into it! diff --git a/src/content/journal/syntax-representations.md b/src/content/journal/syntax-representations.md index 003cd72..f714958 100644 --- a/src/content/journal/syntax-representations.md +++ b/src/content/journal/syntax-representations.md @@ -6,8 +6,8 @@ summary: "A couple ways to represent syntax" I've been thinking about how to represent concrete Python syntax. I've seen two approaches to this: -- `rust-analyzer` makes an ad-hoc tree: every node consists of a type and a vec of children. -- swift syntax makes a more structured tree. It has wrapper types around `SyntaxData` that store a number of fields. Essentially, these nodes store trivia before, trivia after, trivia before the first token, trivia after the last token, and trivia between every (fixed) token. +- `rust-analyzer` makes an ad-hoc tree: every node consists of a type and a vec of children. +- swift syntax makes a more structured tree. It has wrapper types around `SyntaxData` that store a number of fields. Essentially, these nodes store trivia before, trivia after, trivia before the first token, trivia after the last token, and trivia between every (fixed) token. I personally prefer the swift syntax approach as it feels more formal to me. I don't want to fishing in a sea of attributes trying to find one that means something, though I imagine that too could work. It looks like swiftsyntax has some raw vs finished node seperation. I don't really see why. diff --git a/src/content/journal/two-usecases-for-uv.md b/src/content/journal/two-usecases-for-uv.md index c57afb4..974f865 100644 --- a/src/content/journal/two-usecases-for-uv.md +++ b/src/content/journal/two-usecases-for-uv.md @@ -8,5 +8,5 @@ So `uv` is a thing now. Better Python packaging, maybe? Personally its use as a Here's two use cases where it seems pretty useful: -- Generating a lockfile for an arbitrary Python version. (I sure hope it errors if it hits any sdists in this mode) -- Running tests against the minimum version of your dependencies. +- Generating a lockfile for an arbitrary Python version. (I sure hope it errors if it hits any sdists in this mode) +- Running tests against the minimum version of your dependencies. diff --git a/src/content/journal/zig-cpython-extension-on-windows.md b/src/content/journal/zig-cpython-extension-on-windows.md index 6c83c6b..61bf4c5 100644 --- a/src/content/journal/zig-cpython-extension-on-windows.md +++ b/src/content/journal/zig-cpython-extension-on-windows.md @@ -51,9 +51,9 @@ pub fn build(b: *std.Build) !void { Here's a couple choice points: -- `addIncludePath` to allow us to see Python's header files -- `addObjectFile` because we need to link against `/libs/python3.lib` to make a DLL. This seems to be just required on Windows, but I haven't made an extension on Linux yet so not entirely sure. -- Note that this explicitly references `src/example.zig` -- that's what determines the name for the next step. +- `addIncludePath` to allow us to see Python's header files +- `addObjectFile` because we need to link against `/libs/python3.lib` to make a DLL. This seems to be just required on Windows, but I haven't made an extension on Linux yet so not entirely sure. +- Note that this explicitly references `src/example.zig` -- that's what determines the name for the next step. Then, you have this file as `example.zig` in your `src` folder: @@ -82,8 +82,8 @@ export fn PyInit_example() callconv(.C) *py.PyObject { More choice points: -- `var` is required because otherwise Zig will put these structs in some read-only memory as far as I can tell. This is a problem because CPython tries to set `ob_refcnt` to `1` (in case you messed up, I guess). -- This will probably only build against CPython 3.11. While it can be imported on CPython 3.12, building against CPython 3.12 requires replacing `.ob_refcnt = 1` with `.unnamed_0 = { .ob_refcnt = 1 }`. I assume there's been other changes in building against earlier versions too. You can find `cimport.zig` in your `zig-cache/` folder to look at the structure so you can fix things up. +- `var` is required because otherwise Zig will put these structs in some read-only memory as far as I can tell. This is a problem because CPython tries to set `ob_refcnt` to `1` (in case you messed up, I guess). +- This will probably only build against CPython 3.11. While it can be imported on CPython 3.12, building against CPython 3.12 requires replacing `.ob_refcnt = 1` with `.unnamed_0 = { .ob_refcnt = 1 }`. I assume there's been other changes in building against earlier versions too. You can find `cimport.zig` in your `zig-cache/` folder to look at the structure so you can fix things up. Now, to build it: @@ -99,7 +99,7 @@ Hopefully that works! That's what worked for me at least. Next steps: -- Making it build on Unix -- Making a wheel and sdist - - Wheel should be cross-compiled for all systems - - sdist should be able to pull in Zig and build for local system +- Making it build on Unix +- Making a wheel and sdist + - Wheel should be cross-compiled for all systems + - sdist should be able to pull in Zig and build for local system diff --git a/src/content/journal/zig-cpython-extension-wheel.md b/src/content/journal/zig-cpython-extension-wheel.md index ca795ce..4e2d63f 100644 --- a/src/content/journal/zig-cpython-extension-wheel.md +++ b/src/content/journal/zig-cpython-extension-wheel.md @@ -6,8 +6,8 @@ summary: "The broad strokes of making a wheel for a CPython extension made in Zi Basically, a wheel is a zipfile containing two things: -- the package -- the metadata +- the package +- the metadata The package is easy: just put your `example.pyd` at the top level. On the other hand, the metadata is trickier. diff --git a/src/layouts/MainLayout.astro b/src/layouts/MainLayout.astro index b0bb51e..864b2e9 100644 --- a/src/layouts/MainLayout.astro +++ b/src/layouts/MainLayout.astro @@ -21,41 +21,41 @@ const { title, description } = Astro.props; {title} diff --git a/src/pages/index.astro b/src/pages/index.astro index 1a757e6..6cdcfca 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,70 +1,72 @@ --- import { getCollection } from "astro:content"; -import MainLayout from "../layouts/MainLayout.astro"; import selfie from "../holo.png"; +import MainLayout from "../layouts/MainLayout.astro"; import { profile } from "../util/data.ts"; const journalEntries = await getCollection("journal"); const profileData = profile( - `https://${Astro.site?.hostname ?? "localhost:4321"}${selfie.src}`, + // todo: move https:/ into the string once https://github.com/g-plane/markup_fmt/issues/48 is fixed + "https:/" + `/${Astro.site?.hostname ?? "localhost:4321"}${selfie.src}`, journalEntries, ); --- + description="Horo's cool home on the internet!" +>