Skip to content

Instantly share code, notes, and snippets.

View bzm3r's full-sized avatar

Brian Merchant bzm3r

View GitHub Profile

It seems the post is a roundabout way of saying: "a grammar that describes a superset of a <target language> is simpler than a grammar for the <target language>".

If so: the details left unspecified by that simplicity would make it a bad fit for reference documentation?

@bzm3r
bzm3r / sway-config-start
Last active December 15, 2023 20:27
sway-config-start
exec {
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
}
seat seat0 xcursor_theme phinger-cursors 24
@bzm3r
bzm3r / sway-config-end
Last active December 15, 2023 20:27
The last part of my sway configuration.
exec_all {
export XDG_DATA_DIRS=/nix/store/nkkdfnrkwrfgs3rpm1ln0pc96ff4n4gk-gsettings-desktop-schemas-45.0/share/gsettings-schemas/gsettings-desktop-schemas-45.0:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema color-scheme 'prefer-dark'
gsettings set $gnome_schema cursor-theme 'phinger-cursors'
gsettings set $gnome_schema document-font-name 'Atkinson Hyperlegible 16'
gsettings set $gnome_schema font-antialiasing 'rgba'
gsettings set $gnome_schema font-hinting 'full'
gsettings set $gnome_schema font-name 'Atkinson Hyperlegible 16'
gsettings set $gnome_schema gtk-theme 'Adwaita'
+++ dirname -- ./result/rust-shell
++ realpath -- ./result/recorded_env
+ ENV_SNAPSHOT=/nix/store/k7hw017q2q1jarcchhpjg2y10fkymv2f-rust-shell/recorded_env
+ source /nix/store/k7hw017q2q1jarcchhpjg2y10fkymv2f-rust-shell/recorded_env
++ declare -x AR=ar
++ declare -x AR_FOR_BUILD=ar
++ declare -x AS=as
++ declare -x AS_FOR_BUILD=as
++ declare -x CARGO_HOME=/home/bzm3r/.cargo_rust-shell
++ declare -x CC=clang
@bzm3r
bzm3r / rust-shell
Last active December 7, 2023 08:24
#!/usr/bin/env bash
set -x
ENV_SNAPSHOT=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/recorded_env")
source "$ENV_SNAPSHOT"
# make a .cargo directory (if it doesn't already exist)
echo "Creating CARGO_HOME at /home/bzm3r/.cargo_rust-shell"
declare -x AR="ar"
declare -x AR_FOR_BUILD="ar"
declare -x AS="as"
declare -x AS_FOR_BUILD="as"
declare -x CARGO_HOME="/home/bzm3r/.cargo_rust-shell"
declare -x CC="clang"
declare -x CC_FOR_BUILD="gcc"
declare -x CONFIG_SHELL="/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash"
declare -x CXX="clang++"
declare -x CXX_FOR_BUILD="g++"
@bzm3r
bzm3r / unpacking-mkShell.nix
Created December 4, 2023 21:36
Unpacking how mkShell is defined.
{ lib, stdenv, buildEnv }:
{ name ? "rust-stable"
, # a list of packages to add to the shell environment
packages ? [ ]
, # propagate all the inputs from the given derivations: list of attrsets
inputsFrom ? [ ]
, buildInputs ? [ ]
, nativeBuildInputs ? [ ]
, propagatedBuildInputs ? [ ]
@bzm3r
bzm3r / no-hm.nix
Created November 30, 2023 22:49
How to not worry, and still be happy.
{
config,
lib,
pkgs,
_user,
...
}: let
inherit (builtins) replaceStrings;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) flatten;
@bzm3r
bzm3r / settings.json
Last active September 1, 2023 20:02
A semantic highlighting scheme for Rust, when using VS Code.
// Please feel free to change around the colours to best suit you. This can be done using the color
// color picker that is built into VS Code's JSON viewer
"rust-analyzer.semanticHighlighting.punctuation.specialization.enable": true,
"editor.semanticHighlighting.enabled": true,
"editor.semanticTokenColorCustomizations": {
"[Darcula Solid]": {
"enabled": true,
"rules": {
"macro": "#5dcfb0",
"namespace": {
@bzm3r
bzm3r / meta_macros.rs
Created July 16, 2023 01:42
meta generation of macros
use paste::paste;
macro_rules! get_char_len {
($x:tt) => {
stringify!($x).len()
}
}
macro_rules! one {
$(x:tt) => {