Skip to content

Instantly share code, notes, and snippets.

@jb55
jb55 / default.nix
Last active November 14, 2025 20:03
deploy dotnet core apps on nixos
{ stdenv, lib, bash, callPackage, writeText, makeWrapper, writeScript, dotnet-sdk,
patchelf, libunwind, coreclr, libuuid, curl, zlib, icu }:
let
config = "Staging";
project = "RazorCx.Api";
target = "linux-x64";
rpath = stdenv.lib.makeLibraryPath [ libunwind coreclr libuuid stdenv.cc.cc curl zlib icu ];
use std::sync::mpsc::{self, Sender};
use tokio::sync::oneshot;
use futures::Future;
// We erase the job signature to: "no arguments, no return value"
// Because the job itself is responsible for sending its typed result
type ErasedJob = Box<dyn FnOnce() + Send + 'static>;
struct JobPool {
tx: Sender<ErasedJob>,
use std::sync::mpsc::{self, Sender};
use tokio::sync::oneshot;
use futures::Future;
// A trivial job type
type Job = Box<dyn FnOnce() -> String + Send>;
// A “synchronous” pool that receives jobs
struct JobPool {
tx: Sender<(Job, oneshot::Sender<String>)>,
commit 6df138a2c634f5dbdb5a131add00bb1bb5118756
Author: William Casarin <jb55@jb55.com>
Date: Mon Dec 9 16:39:37 2024 -0800
async: adding efficient, poll-based stream support
This is a much more efficient, polling-based stream implementation that
doesn't rely on horrible things like spawning threads just to do async.
Changelog-Added: Add async stream support
commit 3552189390f2693fea6ed6acbcb08b1b17db0bd5
Author: Robert Bragg <robert@sixbynine.org>
Date: Wed May 25 23:57:45 2022 +0100
glue: remove unused variable
diff --git a/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c b/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
index ce6c7efdb8aa..626e7b82c10d 100644
--- a/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
+++ b/game-activity/prefab-src/modules/game-activity/src/game-activity/native_app_glue/android_native_app_glue.c
@jb55
jb55 / focus_state.diff
Created March 8, 2025 00:06
Auto focus on navigate example in notedeck
commit d85c6043b700783d825f6e5971f976e198fde112
Author: William Casarin <jb55@jb55.com>
Date: Fri Mar 7 16:01:55 2025 -0800
search: auto-focus search field on navigate
I'm going to add a search changelog on this commit since I forgot
to do so previously.
Fixes: https://linear.app/damus/issue/DECK-538/auto-focus-search-field-on-search-view
@jb55
jb55 / pdfnow
Last active November 25, 2019 16:47
#!/usr/bin/env bash
PANDOC="pandoc --variable urlcolor=cyan"
usage () {
printf "usage: pdfnow file.md OR <file.md pdfnow markdown\n" >&2
exit 1
}
[ $# -eq 0 ] && usage
@jb55
jb55 / gist:2253102
Created March 30, 2012 17:20
Lambda and arrow digraphs in vim
" lambda λ
imap <C-j> <C-k>l*
" right arrow →
imap <C-l> <C-k>->
" left arrow ←
imap <C-h> <C-k><-
" compose ∘
var uid = require('uid');
var data = require('data');
function hash(el) {
var d = data(el);
var hash = d.get('mylib:uid');
if (hash) return hash;
var id = uid();
d.set('mylib:uid', id);
return id;