Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
View ghc-docker-run
#!/usr/bin/env bash
set -euo pipefail
base_image='registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10'
tag='9e4c540d9e4972a36291dfdf81f079f37d748890'
image="${base_image}:${tag}"
docker run -it --rm \
--volume /nix:/nix \
View records.hs
{-# language DataKinds #-}
{-# language DuplicateRecordFields #-}
{-# language OverloadedRecordDot #-}
import GHC.Records
data Person = Person
{ name :: String
, pet :: Pet
, partner :: Maybe Person
@steshaw
steshaw / apld-finkel.pdf
Last active Feb 23, 2022
Advanced Programming Language Design by Raphael A. Finkel (for personal use only)
View apld-finkel.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View get-apld-finkel.hs
#!/usr/bin/env stack
{- stack
--resolver nightly-2022-01-10
script
--package base
--package http-conduit
--package http-types
--package bytestring
-}
View main.rs
fn main() {
let a = 42;
let b = "hi";
println!("{a:?} and {b:?}");
}
View nix-ca-example
#!/usr/bin/env bash
set -euo pipefail
go() {
substituter='https://cache.nixos.org/'
substituter='https://cache.ngi0.nixos.org/'
store_path='/nix/store/39sy7704dswxk1sgr8sgwfm7p4cp23a4-vim-8.2.4186'
store_path='/nix/store/apxk3sz6qb219w263rslm96jcsq5i4pq-git-2.34.1'
View dyn.hs
-- See https://travis.athougies.net/posts/2017-04-26-close-the-world.html
{-# OPTIONS_GHC -fprint-explicit-foralls #-}
{-# LANGUAGE TypeApplications #-}
import Data.Maybe
import Data.Typeable
data Dyn where
View unlike-all-youtube.js
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function deleteLiked() {
var menus = $('body').getElementsByClassName("dropdown-trigger")
for (var i = 0; i < menus.length; i++) {
if (i >= 2) {
var menu = menus[i];
menu.children[0].click();
const timeout = setTimeout(() => {
View golang-separate-funcs-with-one-line
#!/usr/bin/env bash
set -euo pipefail
# Explanation of strange Perlness:
#
# * -0400 means that we slurp the whole file rather than operating on a
# line-by-line basis.
# * /gms means global, multiline, '.' can match '\n' (probably not needed in
# this case).
@steshaw
steshaw / install
Last active Sep 8, 2021
Using Stow to install local packages
View install
#!/usr/bin/env bash
set -euo pipefail
pkgs=(
doom-emacs
dotnet
gh_2.0.0_linux_amd64
ghc-9.0.1
go-1.17