Skip to content

Instantly share code, notes, and snippets.

View steshaw's full-sized avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
@steshaw
steshaw / apld-finkel.pdf
Last active June 30, 2023 10:11
Advanced Programming Language Design by Raphael A. Finkel (for personal use only)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! /usr/bin/env nix-shell
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [http-conduit http-types bytestring])" -i runhaskell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.tar.gz
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM)
import Data.ByteString qualified as B
fn main() {
let a = 42;
let b = "hi";
println!("{a:?} and {b:?}");
}
#!/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'
-- 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
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(() => {
#!/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 September 8, 2021 00:27
Using Stow to install local packages
#!/usr/bin/env bash
set -euo pipefail
pkgs=(
doom-emacs
dotnet
gh_2.0.0_linux_amd64
ghc-9.0.1
go-1.17
package main
import (
"fmt"
)
type StructTag string // Creates a new type :-)
func main() {
var st StructTag = "foo"
#include <stdio.h>
#include <stdbool.h>
static void truthy_int(int i) {
if (i) printf("%d is true\n", i); else printf("%d is false\n", i);
}
int main() {
truthy_int(-1);
truthy_int(0);