Skip to content

Instantly share code, notes, and snippets.

View hallettj's full-sized avatar

Jesse Hallett hallettj

View GitHub Profile
@hallettj
hallettj / lazy-promise.js
Last active January 23, 2022 21:27
Lazily-evaluated promise example
// Run with: deno run lazy-promise.js
// See https://github.com/sindresorhus/p-lazy
import PLazy from "https://cdn.skypack.dev/p-lazy"
const a = new PLazy(resolve => {
console.log("this code does not execute")
resolve()
})
@hallettj
hallettj / fractional-scaling-mutter.md
Last active January 26, 2025 07:50
How I set up fractional scaling in Gnome

Fractional Scaling

With a bigger display 2x scaling might be too big. I'm trying out experimental support for fractional scaling in Gnome. To opt out again it is necessary to undo this experimental features setting:

$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

In addition to fractional scaling that setting allows different scaling factors per monitor!

The only issue I'm seeing so far is that apps running with XWayland look fuzzy. That includes web browsers. But! Firefox and Chrome both have opt-in support for Wayland which fixes the problem.

@hallettj
hallettj / _redirects
Created November 20, 2022 23:24
Netlify configuration to redirect a Mastodon handle
# Netlify configuration to set up a Mastodon handle for your own domain that
# forwards to your real account. This configuration allows people to search for
# me with @[email protected], and to find me @[email protected].
#
# Put a configuration like this in a file called _redirects in the *publish
# directory* of your Netlify project. For my Gatsby site I put the file in
# static/_redirects, and at build time it gets copied to public/_redirects.
#
# Redirect documentation for Netlify is at https://docs.netlify.com/routing/redirects/redirect-options/
# Test redirect rules in the playground, https://play.netlify.com/redirects
@hallettj
hallettj / rust-on-nix.md
Created March 8, 2024 15:22
Building Rust binaries with Nix draft

#nix #rust

Packaging Rust Binaries

Requires flakes to be enabled. {.is-warning}

There are a few pieces that make up a complete Nix workflow for building Rust crates:

I recommend using nix-starter-configs as a starting point. I use the "standard" template. It helps you set up some of these details, like overlays.

For structure I have a separate module for each nixos configuration, and each home manager configuration. Those don't contain a whole lot by themselves. Then I have a "common" module for nixos and for home manager for global configuration - I import that in each of the configuration-specific modules. Then I have lots of stuff split into small "feature" modules. Those I import either in the "common" modules, or on the configuration-specific modules.

External dependencies and overlays

Since you asked about setting up an external flake dependency I'll give an example I use. I use a window manager, niri, that I get from an external flake. I include the flake reference in inputs in flake.nix (source):

ni