Skip to content

Instantly share code, notes, and snippets.

View pdarragh's full-sized avatar

Pierce Darragh pdarragh

View GitHub Profile
@pdarragh
pdarragh / x86_racket_on_apple_silicon.md
Created December 4, 2022 22:32
Instructions for installing Racket and nasm in an x86 instance of Homebrew.

Finally got around to setting up an x86 instance of Homebrew via Rosetta to install x86 Racket. Here's all the steps I took.

First, ensure Rosetta 2 is installed:

$ /usr/sbin/softwareupdate --install-rosetta

Then install x86-64 Homebrew. However, I've also kept the regular Apple Silicon Homebrew. Turns out they require different path prefixes anyway, so the regular one is at /opt/homebrew while the x86 one is at /usr/loca/homebrew. To install the x86 one, I did:

@pdarragh
pdarragh / _cookies.md
Last active December 14, 2021 01:35
Cookie Recipes
@pdarragh
pdarragh / papers.md
Last active April 17, 2024 19:29
Approachable PL Papers for Undergrads

Approachable PL Papers for Undergrads

On September 28, 2021, I asked on Twitter:

PL Twitter:

you get to recommend one published PL paper for an undergrad to read with oversight by someone experienced. the paper should be interesting, approachable, and (mostly) self-contained.

what paper do you recommend?

@pdarragh
pdarragh / examples.ml
Created September 16, 2021 17:48
OCaml Examples from Pierce's Office Hours (2021-09-16)
type color =
| Red
| Green
| Blue
| Black
type row = color list
type screen = row list
@pdarragh
pdarragh / better_io.py
Last active February 3, 2021 20:35
Simple Python I/O using argparse
import argparse
from pathlib import Path
"""
Run this by doing:
$ python3 better_io.py /path/to/file
This version uses the `type` parameter of the `add_argument` function to pass
@pdarragh
pdarragh / spelling_bee.py
Created February 1, 2021 22:47
New York Times Spelling Bee Solver
#!/usr/bin/env python3
"""This module provides functions for solving the New York Times Spelling Bee
puzzles using a given dictionary file.
"""
import re
@pdarragh
pdarragh / migrate_repo.sh
Created January 26, 2021 22:35
Move commits from one repository to another without squashing
#!/usr/bin/env sh
# I TAKE NO RESPONSIBILITY FOR YOUR CHOICE TO USE THIS SCRIPT.
# It's probably a better idea to just read the commands and enter
# them by hand one-by-one. But I've used this script and it works
# for me, so here it is.
# Migrates the commits from an old repository to a new one using
# a rebase.
#
@pdarragh
pdarragh / PythonListyDataTypes.hs
Created November 6, 2020 04:22
Haskell implementations of Python's built-in Iterator, Iterable, and Sequence types and their associated functions
{-# LANGUAGE ConstrainedClassMethods #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
import Prelude hiding (all, any, length, map)
import Data.Bool (Bool(..), not, otherwise)
import Data.List (reverse)
import qualified Data.List (length)
@pdarragh
pdarragh / keymap.c
Created October 23, 2020 17:49
Current keymap for Preonic keyboard
/* Copyright 2015-2017 Jack Humbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@pdarragh
pdarragh / argparse_tutorial.py
Created September 17, 2020 18:52
A brief tutorial of the fundamental functionality of the `argparse` module in the Python standard library.
#!/usr/bin/env python3
from shlex import split as split_args # This is used for splitting strings in
# the way the shell does it.
# The `argparse` module in the standard library provides a ton of functionality
# for easily parsing command-line arguments when invoking Python programs. The
# full documentation is available here:
#
# https://docs.python.org/3/library/argparse.html