Skip to content

Instantly share code, notes, and snippets.

View thomasjm's full-sized avatar

Tom McLaughlin thomasjm

View GitHub Profile
@thomasjm
thomasjm / Main.hs
Created April 8, 2026 02:16
GHC network console interrupts test
module Main where
import Control.Concurrent (forkIO, threadDelay)
import Network.Socket
import Network.Socket.ByteString (recv)
main :: IO ()
main = do
putStrLn "Starting server on port 9999..."
addr <- head <$> getAddrInfo (Just defaultHints { addrSocketType = Stream }) (Just "127.0.0.1") (Just "9999")
@thomasjm
thomasjm / test_ip_exhaustion.sh
Last active April 2, 2026 00:32
Apple containers IP exhaustion test scripts
#!/bin/bash
# Test whether force-deleting containers leaks IP addresses.
# Creates containers and immediately force-deletes them in a loop.
# If IPs leak, we should hit "no free indices" around iteration ~252.
set -euo pipefail
IMAGE="docker.io/library/ubuntu:latest"
COUNT=0
FAILED=0
@thomasjm
thomasjm / test.c
Last active December 9, 2025 23:56
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
int main(int argc, char** argv) {
@nix { "action": "setPhase", "phase": "buildPhase" }
Preprocessing library for aeson-typescript-0.6.4.0..
Building library for aeson-typescript-0.6.4.0..
src/Data/Aeson/TypeScript/Instances.hs:4:14: warning: [GHC-53692] [-Wdeprecated-flags]
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
|
4 | {-# LANGUAGE OverlappingInstances #-}
| ^^^^^^^^^^^^^^^^^^^^
[ 1 of 12] Compiling Data.Aeson.TypeScript.LegalName ( src/Data/Aeson/TypeScript/LegalName.hs, dist/build/Data/Aeson/TypeScript/LegalName.o )
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/79vpkqiz8vcv3rsqbk3cf8v4k4ladrnp-julia-1.11.3-linux-x86_64.tar.gz
source root is julia-1.11.3
setting SOURCE_DATE_EPOCH to timestamp 1737489500 of file "julia-1.11.3/share/julia/cert.pem"
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
substituteStream() in derivation julia-bin-1.11.3: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. (file 'share/julia/stdlib/v1.11/NetworkOptions/test/runtests.jl')
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
@thomasjm
thomasjm / crash.log
Created November 14, 2024 01:59
GHC th-orphans crash on macOS
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: ghc-9.6.6 [1415]
Path: /Volumes/VOLUME/*/ghc-9.6.6
Identifier: ghc-9.6.6
Version: ???
Code Type: ARM-64 (Native)
Parent Process: default-setup [1413]
@thomasjm
thomasjm / repro.sh
Created October 23, 2024 10:43
Repro for nix-prefetch-git error
bwrap \
--dev /dev \
--proc /proc \
--clearenv \
--new-session \
--tmpfs /tmp \
--setenv TMPDIR /tmp \
--setenv USER user \
--tmpfs /homeless-shelter \
--setenv HOME /homeless-shelter \
tom@desktop2 development/ruby-modules (master) » ./runtests.sh
++ dirname ./runtests.sh
+ cd .
+ find . -name text.nix
++ find . -name test.nix
+ testfiles='./with-packages/test.nix
./bundler-env/test.nix
./bundled-common/test.nix'
+ nix-build -E 'with import <nixpkgs> {}; callPackage testing/driver.nix { testFiles = [ ./with-packages/test.nix
./bundler-env/test.nix
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
Running phase: setupCompilerEnvironmentPhase
Build with /nix/store/ki9kplpqm86wrw7f8gj0xfn26iwbkpa9-ghc-9.6.4.
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/iwhjcvs344p3vcpvfwjhf6w019xw3kvx-ghcide-2.5.0.0.tar.gz
source root is ghcide-2.5.0.0
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file ghcide-2.5.0.0/test/src/Development/IDE/Test.hs
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@thomasjm
thomasjm / Main.hs
Last active October 30, 2023 05:34
Benchmarking Text to Vector conversion in Haskell
{-# LANGUAGE BangPatterns #-}
module Main (main) where
import Control.Monad
import Data.Maybe
import Data.String.Interpolate
import Data.Text as T
import qualified Data.Vector.Unboxed as VU
import Weigh