Skip to content

Instantly share code, notes, and snippets.

@9999years
9999years / Reproducer.hs
Last active December 4, 2024 23:25
Bisecting GHC
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ImplicitParams #-}
-- Reproducer for a GHC bug: https://gitlab.haskell.org/ghc/ghc/-/issues/25529
module Main where
import GHC.Stack (HasCallStack, CallStack, SrcLoc(srcLocStartLine, srcLocStartCol), callStack, getCallStack)
main :: IO ()
@9999years
9999years / cabal.project
Created October 28, 2024 18:55
So you're moving `data-default-class` to `data-default`
source-repository-package
type: git
location: https://github.com/9999years/hs-certificate.git
tag: 20aef750c8e3411bd61e553fa37f98c2696adf6f
subdir: x509
source-repository-package
type: git
location: https://github.com/9999years/hs-certificate.git
tag: 20aef750c8e3411bd61e553fa37f98c2696adf6f
@9999years
9999years / zapier-slack-alert-for-un-rsvpd-google-calendar-events.js
Created October 18, 2024 17:37
Zapier: Send a daily Slack alert for Google Calendar events which need an RSVP
// .--------------------------------------------------------------------------.
// | Send a daily Slack alert for Google Calendar events which need an RSVP |
// `--------------------------------------------------------------------------'
//
// # What and why
//
// I kept getting surprised by interviews and other meetings the morning they
// happened. Here's instructions for a Zapier "Zap" that checks if you haven't
// RSVP'd to any of the next 50 events (by default) on your primary calendar,
// and sends you a Slack DM alerting you of the events in question. It runs
@9999years
9999years / foomap.py
Created July 12, 2021 20:31
An unnamed type of map
from dataclasses import dataclass
from typing import Any
from typing import cast
from typing import Dict
from typing import Generic
from typing import Type
from typing import TypeVar
T = TypeVar("T")
@9999years
9999years / typemap.py
Created July 12, 2021 20:01
Python TypeMap; a container holding at most one value of a given type
from typing import Type
from typing import TypeVar
class ValueTypeError(ValueError):
"""Raised when a `TypeMap` receives a key-value pair where ``type(value) != key``."""
def __init__(self, key: type, value: object, message: str) -> None:
"""Construct a `ValueTypeError`.
@9999years
9999years / cookie-clicker-mods.js
Created July 7, 2021 17:27
Cookie clicker mod loader userscript
@9999years
9999years / yaml-spec-tweaks.js
Created June 29, 2021 15:47
YAML spec user styles
// ==UserScript==
// @name YAML spec tweaks
// @description Better link indicators
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @author Rebecca Turner
// @match https://yaml.org/*
// @icon https://www.google.com/s2/favicons?domain=yaml.org
// @grant GM_addStyle
// ==/UserScript==
@9999years
9999years / rename-github-repos.sh
Created September 28, 2020 19:28
Rename the default branch on all your GitHub repos. Warning: this script deletes the old default branch, which makes GitHub *automatically close* open PRs to that branch.
#! /usr/bin/env bash
set -e
oldBranch="master"
newBranch="main"
# {{{ Colors, logging boilerplate
readonly PROG_NAME="$0"
function RESET { echo -e "\e[0m"; }
//! Kat Spiers has yet again bullied me into writing code.
//! Today we worked on type-level arithmetic.
use std::ops::{Add, Sub, Mul};
#[derive(Debug, Clone, PartialEq)]
enum Kat {
Kat(Box<Kat>),
Hryn,
}
@9999years
9999years / scheme-infix.scm
Created August 22, 2019 02:04
Infix evaluation in scheme...?
#lang r5rs
(#%require schemeunit)
(define ** expt)
(define (!= x y) (not (= x y)))
(define (^^ a b) (or (and a (not b))
(and b (not a))))
; can you believe they made && and || special forms???
(define (&& a b) (and a b))
(define (|| a b) (or a b))