Skip to content

Instantly share code, notes, and snippets.

View ConnorBaker's full-sized avatar
⚱️
burnt out

Connor Baker ConnorBaker

⚱️
burnt out
  • Costa Mesa, CA
  • 21:31 (UTC -08:00)
View GitHub Profile
@ConnorBaker
ConnorBaker / ,nixpkgs-review-nixpkgs-config.nix
Last active June 20, 2024 15:56
Markdown and bash command templates for Nixpkgs-review for CUDA.
{
allowAliases = false;
allowBroken = false;
allowUnfree = true;
checkMeta = true;
cudaSupport = true;
cudaCapabilities = [ "7.5" ];
packageOverrides =
pkgs:
let
@ConnorBaker
ConnorBaker / cudaPackages-build-helper.sh
Last active November 7, 2023 19:36
Helper to build cudaPackages package set
#!/usr/bin/env bash
set -euo pipefail
json_cuda_packages_categorized=$(nix eval --impure --json .#cudaPackages --apply '
attrs:
let
drvKind = drvName:
let
drv = attrs.${drvName};
@ConnorBaker
ConnorBaker / Dockerfile
Last active January 10, 2023 23:45
Dockerfile for building Mimalloc, Mold, CPython, Magma, PyTorch, Torchvision, and Triton from source
# Clone repositories
FROM docker.io/bitnami/git:2.39.0@sha256:8802a1053f0a75c948da43c0d04e591b500381447745f0b5f75d3cf85509626c as git_base
# Basic git configuration
RUN git config --global advice.detachedHead false \
&& git config --global init.defaultBranch main
# Install xz-utils for decompressing tarballs
RUN --mount=type=cache,target=/var/cache/apt \
export DEBIAN_FRONTEND=noninteractive \
{-# LANGUAGE TemplateHaskell #-}
module Tasty.Runners.Buildkite.History where
import Tasty.Runners.Buildkite.Span ( Span )
import Data.Aeson (defaultOptions, camelTo2)
import Data.Aeson.TH (deriveJSON, Options (fieldLabelModifier))
data History = History {
@ConnorBaker
ConnorBaker / run.sh
Created March 16, 2022 15:30
Command to find which nixpkg derivation support `withPackages` or `withPlugins`
rg "(withPackages *=)|(withPlugins *=)" --ignore-case --glob '*.nix'
fst = (a) -> (b) -> a
snd = (a) -> (b) -> b
_Pair2 = (a) -> (b) -> (p2) -> p2(a)(b)
show_pair = (p2) -> p2((a) -> (b) -> "(${a}, ${b})")
test_p2 = _Pair2('A')('B')
// (A, B)
println(show_pair(test_p2))
// A
println(test_p2(fst))
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Prelude hiding (Maybe (..), concat, fst, head, snd, tail)
-- Church encoding of pair2s
newtype Pair2 a b
= MkPair2
@ConnorBaker
ConnorBaker / reverse.hs
Created January 15, 2021 00:29
Reversing a list in O(n) time with Haskell's foldr
reverse :: [α] -> [α]
reverse as = foldr f id as []
where
f :: α -- Element a to cons to as
-> ([α] -> β) -- Function f which operates on a list
-> [α] -- List as to prepend a to
-> β -- Result of applying function to a : as
f = flip (.) . (:)
-- Application
@ConnorBaker
ConnorBaker / Main.hs
Last active October 23, 2020 02:08
Some work on permutations for abstract algebra
module Main where
import qualified Data.Foldable as Foldable
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Set (Set)
-- Follow the path a value takes through multiple permutations.
-- If the value is not in the permutation, it is unchanged -- it is fixed.
trace :: Ord a => Map a a -> Map a a -> a -> a
@ConnorBaker
ConnorBaker / Main.hs
Last active September 21, 2020 02:24
Find cyclic subgroups of finite order of groups with integer elements under modular multiplication
{-# LANGUAGE RecordWildCards #-}
module Main where
data Solution = Solution
{ remainder :: Integer
, element :: Integer
, power :: Integer
}
instance Show Solution where