Skip to content

Instantly share code, notes, and snippets.

@instinctive
instinctive / proglang.md
Last active June 23, 2020 18:49
Programming Language Personal Journey

Summer Camp: Fortran

Junior High School: Basic

College: Algol, Pascal, PL/I,

@instinctive
instinctive / Notes Linux Audio.md
Last active August 19, 2020 15:58
Notes on Linux Audio issues
@instinctive
instinctive / Bee.hs
Last active July 9, 2026 13:55
Spelling Bee
#!/usr/bin/env cabal
{- cabal:
build-depends: base, base-prelude, containers, text
-}
-- Spelling Bee
--
-- Install Haskell: https://www.haskell.org/ghcup/
--
-- This is a standalone Haskell script, assuming you have cabal installed. The
@instinctive
instinctive / hackage.js
Created March 2, 2021 03:39
Userscript to reorg the package contents pages on Hackage
// ==UserScript==
// @name hackage
// @namespace https://github.com/instinctive/
// @description Reorganize package contents pages on Hackage.
// @include /^https?://hackage\.haskell\.org/package/[^/]*$/
// ==/UserScript==
(function() {
function getStyleSmall(elt) {
@instinctive
instinctive / Flutter and Android Studio.md
Created May 5, 2021 19:04
How to install Flutter and Android Studio

Additional undocumented steps needed:

  • Studio > Configure > SDK Tools > Command line tools (install them)
  • flutter config --android-sdk <path to /Sdk/>
  • flutter config --android-studio-dir <path to /Studio/>
  • export ANDROID_HOME=<path to /Sdk/>
  • export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/platform-tools:$PATH
  • flutter doctor
  • flutter doctor --accept-licenses
@instinctive
instinctive / Chess.md
Created May 12, 2021 03:02
Simple chess protocol

Simple Chess Protocol

Existing chess server protocols (UCI) do a lot of things we don't need. Hence this simpler protocol.

Your chess program will read and write lines of input and output. Informally, the first input line will either be black or white, indicating which side your program will play.

@instinctive
instinctive / recursion-schemes.md
Last active August 4, 2021 17:31
Recursion Scheme Thoughts

Here's an example function to determine whether a set is strongly connected with respect to an adjacency function, implemented with direct recursion:

connected :: Ord a => (a -> [a]) -> Set a -> Bool
connected f s = 
    go (take 1 $ Set.elems s) s
  where
    go _ s | Set.null s = True
    go [] _             = False
@instinctive
instinctive / seoul256.js
Last active September 6, 2021 15:39
Blink shell color theme - seoul256
black = '#4e4e4e';
red = '#d68787'; // red
green = '#5f865f'; // green
yellow = '#d8af5f'; // yellow
blue = '#85add4'; // blue
magenta = '#d7afaf'; // pink
cyan = '#87afaf'; // cyan
white = '#d0d0d0'; // light gray
lightBlack = '#626262'; // medium gray
lightRe

The Any Worker Problem

19391D8D-B4ED-4D20-BC30-D12CA5EBC816

In The Manhattan Project (TMP) boardgame, you may use any three of your workers to run this mine.

There are effectively six kinds of workers in TMP, the cross-product of three occupations: Laborers, Engineers, and Scientists, and two types of employment: Full Time Employee (FTE) and Contractor.

@instinctive
instinctive / gcj-2022-r1c-a.hs
Created May 1, 2022 18:03
Google Code Jam 2022 Round 1C Problem A (Haskell)
-- boilerplate elided from gist
docase :: Int -> IO ()
docase i = do
printf "Case #%d: " i
_ <- getLine
ss <- words <$> getLine
outimp putStrLn $ solve ss
aside (x:_,_) = x