Skip to content

Instantly share code, notes, and snippets.

View rrbutani's full-sized avatar
🐢
slowly but surely

Rahul Butani rrbutani

🐢
slowly but surely
  • 21:56 (UTC -07:00)
View GitHub Profile
@rrbutani
rrbutani / llvm-pkgset-test.nix
Last active January 12, 2023 07:46
nix test script for the LLVM package set
{ nixpkgs ? ./.
, lib ? import ./lib
# Host systems to test from.
, systems ? [
"i686-linux"
"x86_64-linux"
# "x86_64-darwin"
@rrbutani
rrbutani / nixpkgs-override-experiments.nix
Last active January 16, 2023 21:24
nixpkgs override experiments
# Look at `lib/customization.nix`, specifically `makeOverridable`.
#
# ```
# func(args) -> Res
#
# override:
# func( override(args) ) -> Res
# where override :: Args -> Args
# + to reinsert the overrides: `makeOverridable func override(args)`
#
//! https://twitter.com/joseph_h_garvin/status/1597272949098438656
//! https://users.rust-lang.org/t/shrinking-bitset-with-compile-time-known-length/84244
//! https://rust.godbolt.org/z/9sevMvhsa
//! https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5bb14fbfa4d086945e10107baf111679
#![allow(type_alias_bounds)]
// #![recursion_limit = "20"]
use core::{
@rrbutani
rrbutani / flake.nix
Created October 29, 2022 11:32
nixpkgs darwin stdenv `LC_UUID`
{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs?ref=60b1608ad793c763ffbeabddc95dba7b4ed9cbc8; # nixos-unstable as of this writing
flu.url = github:numtide/flake-utils;
};
outputs = { nixpkgs, flu, self }:
with flu.lib; eachSystem [ "aarch64-darwin" "x86_64-darwin" ] (system: let
# The `nixpkgs` bintools wrapper passes `-no_uuid` to `ld` when targeting
# macOS which causes `ld` to omit `LC_UUID`.
{ pkgs ? import <nixpkgs> {} }:
let
flakeCompat = import (pkgs.fetchFromGitHub {
owner = "edolstra";
repo = "flake-compat";
rev = "b4a34015c698c7793d592d66adbab377907a2be8";
sha256 = "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E";
});
riffRepo = pkgs.fetchFromGitHub {
owner = "DeterminateSystems";
@rrbutani
rrbutani / gpio-test.asm
Created August 21, 2022 04:39
LC3 GPIO Test
.orig 0x3000
; Set the stack pointer
LD R6, STARTING_SP
; Set up the loop:
LD R1, NUM_GPIO_PINS
NOT R1, R1
ADD R1, R1, #1
AND R0, R0, #0
@rrbutani
rrbutani / .macos-sandbox-notes
Last active December 25, 2024 05:48
macOS sandbox notes
(placeholder to set the gist name)
@rrbutani
rrbutani / .flake-lazy-inputs2
Last active July 13, 2022 19:40
Lazy Flake Inputs, with the `cache-flake-inputs` flake
(see flake.nix)
@rrbutani
rrbutani / .flake-lazy-inputs
Created July 13, 2022 07:38
flake-lazy-inputs
(see flake.nix)
; a rough benchmark of a typical solar panel controller
; loop time is 1.21ms
.orig x3001
; Set the stack pointer
LD R6, STARTING_SP
; Put G1 - G7 in input mode, G0 in output mode
AND R0, R0, #0
ADD R0, R0, #7
PIN_INIT