Skip to content

Instantly share code, notes, and snippets.

View carnotweat's full-sized avatar

sameer gupta carnotweat

View GitHub Profile
@carnotweat
carnotweat / Makefile
Created June 21, 2025 06:08 — forked from fasiha/Makefile
A pandoc custom writer targeting tufte-css HTML
test.html: test.md tufte-css.lua html5.html
pandoc -t tufte-css.lua -f markdown -c tufte.css --template html5.html test.md > test.html
html5.html:
pandoc -D html5 > html5.html
@carnotweat
carnotweat / HPFFP.md
Created May 14, 2025 08:16 — forked from DadgadCafe/HPFFP.md
Haskell Programming From First Principles

HASKELL PROGRAMMING FROM FIRST PRINCIPLES

CHAPTER1. ALL YOU NEED IS LAMBDA

1.1 All You Need is Lambda

lambda calculus:

computation model, 1930s, Alonzo Church, formalizing a method, Turing machines

@carnotweat
carnotweat / gist:33c25936b8c5b53144f8e7f54e189a16
Created May 13, 2025 00:14
hasura-ecomm-app-deploy-rest-end-points.ts
/*
This is an example snippet - you should consider tailoring it
to your service.
Note: we only handle the first operation here
*/
function fetchGraphQL(
operationsDoc: string,
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@carnotweat
carnotweat / Main.hs
Created May 12, 2025 10:27 — forked from nicuveo/Main.hs
Minimalistic JSON parser, using a Parsec-like approach
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE LambdaCase #-}
import Control.Applicative (liftA2)
import Data.Char
import Data.Foldable (for_)
import Data.Functor
import qualified Data.HashMap.Strict as M
import Data.List (intercalate)
import Prelude hiding (any)
@carnotweat
carnotweat / update-cargo-hashes.txt
Created January 26, 2025 03:43 — forked from danieldk/update-cargo-hashes.txt
Rough procedure for updating all cargoSha256/cargoHash
Rough procedure for updating cargo hashes. Warning: this still requires a lot
of manual work to cover all bases. Based on:
https://github.com/NixOS/nixpkgs/pull/112764/commits/2650d5d2b8c19844224f8b368887153e2f18fdae
# Invalidate all hashes
rg -l "cargoHash" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoHash = "..../cargoHash = "sha256-1234/g'
rg -l "cargoSha256" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoSha256 = "[^s].../cargoSha256 = "1234/g'
rg -l "cargoSha256" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoSha256 = "sha256-..../cargoSha256 = "sha256-1234/g'

$argon2id$v=19$m=64,t=512,p=2$MDOAt0I3AWroFd/E1+x8yg$cblJd+50ziH0GlF6rjJMPQ

[Verifying my cryptographic key: $argon2id$v=19$m=64,t=512,p=2$eGn09j1v01gP103pNTbS5A$kSTgjeRbE9dCqVJWh+qKXw]

@carnotweat
carnotweat / explanation.md
Created October 2, 2024 09:32 — forked from masak/explanation.md
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@carnotweat
carnotweat / .ghci
Created July 10, 2024 03:49 — forked from rpearce/.ghci
Flake for using Haskell in nix develop
:def hoogle \x -> return $ ":!hoogle --count=15 \"" ++ x ++ "\""
:def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
:set -Wall
:set -fno-warn-type-defaults -ferror-spans -freverse-errors -fprint-expanded-synonyms
:set prompt "\ESC[0;32m%s\n\ESC[m[ghci]\ESC[38;5;172mλ \ESC[m"
:set prompt-cont " \ESC[38;5;172m> \ESC[m"