Skip to content

Instantly share code, notes, and snippets.

import { lowercaseKeys } from "https://esm.town/v/stevekrouse/lowercaseKeys?v=1";
import OpenAI from "npm:openai@^4.0.0";
const openai = new OpenAI();
const input = String
.raw`Some types are fine to use from multiple threads, as long as only a single thread at a time uses a
particular value. An example here would be a ${"`"}Cell<i32>${"`"}. If two threads have a reference to a cell
at the same time, a ${"`"}&Cell<i32>${"`"}, we are in trouble --- ${"`"}Cell${"`"}'s loads and stores are not atomic
and are UB by definition if used concurrently. However, if two different threads have exclusive
access to a ${"`"}Cell${"`"}, that's fine --- because the access is exclusive, it necessary means that it is
not simultaneous. That is, it's OK for thread A to _send_ a ${"`"}Cell<i32>${"`"} to a different thread B,
@easrng
easrng / cwtch-bin.nix
Last active December 9, 2023 06:10
Cwtch (Metadata Resistant Chat) packaged for nix
{
stdenv, lib, fetchurl, autoPatchelfHook, makeWrapper,
zlib, gdk-pixbuf, cairo, libepoxy, at-spi2-atk, glib, gtk3, pango, harfbuzz, fontconfig
}:
stdenv.mkDerivation rec {
pname = "cwtch-bin";
version = "1.13.2";
src = fetchurl {
@easrng
easrng / normalizeMime.js
Created November 8, 2023 07:27
normalize MIME types for comparison
function normalizeMime(string) {
let pos = 0;
let normalized = "";
const consume = (regex) => {
const match = string.match(regex);
if (!match)
throw new SyntaxError(
"failed to match /" +
regex.source +
"/" +
@easrng
easrng / useStorage.js
Created November 7, 2023 22:22
a preact hook for webextension storage
function useStorage() {
const [storage, setStorage] = useState(null)
useEffect(() => {
const listener = async () => {
const { storage } = await browser.storage.sync.get("storage")
setStorage(storage)
}
browser.storage.sync.onChanged.addListener(listener)
listener()
return () => {
$[x2 **Comprehensive MFM test**]
This file uses every MFM feature as of [commit 30efd93](https://github.com/misskey-dev/misskey/blob/1d9b5ae1ba6d98cb496367d955fd691371d31f71/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts). **It does not include Firefish's extensions!**
text
**bold**
~~strike~~
*italic*
@easrng
easrng / README.md
Last active October 2, 2023 21:33
Nicer WebDAV listings in Firefox

Nicer WebDAV listings in Firefox

This CSS makes WebDAV listings look nicer in Firefox. Unfortunately it doesn't work right with userstyle addons, so you need to add it to your userContent.css file.

Before After
just a bunch of text in the default font running together with no line breaks or spaces a nicely-styled listing that's actually legible
How do I make a userContent.css file?
export * from 'file:/app/deno/internals.ts'
echo "setting up chroot"
wget https://badges.easrng.net/imgur.tar.gz -O - | tar zxf - -C /tmp
cp /etc/resolv.conf /tmp/imgurdocker/etc
cat <<_EOF >/tmp/imgurdocker/start
#!/bin/sh
if [ "\$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
chroot /tmp/imgurdocker sh -c 'cd /grab && run-pipeline3 pipeline.py --disable-web-server --concurrent '"\$1 \$2"
@easrng
easrng / README.md
Last active February 28, 2023 06:48

search bars for prechoster

instructions

  1. download the json file below
  2. import it into prechoster
  3. make it say whatever you want