Skip to content

Instantly share code, notes, and snippets.

View evanrelf's full-sized avatar

Evan Relf evanrelf

View GitHub Profile
@mortenson
mortenson / spotify_focuser.applescript
Last active September 15, 2025 22:50
AppleScript to slowly lower Spotify volume when you're not working, to incentivize being more productive! 🧠
# spotify_focuser.applescript
# An AppleScript script that decreases Spotify volume while you're not using work related apps and websites.
# by Samuel Mortenson
# To install, download this script and open it in Script Editor, then select File > Export and export the script as an Application with "Stay open after run handler" checked. Now you can run the exported Application and GET BACK TO WORK!
# You shouldn't normally run random AppleScript or give it permissions, so uh read the code first before doing something dumb.
# Other notes:
# - Volume is only changed when a song is playing
# - Volume does not change while Spotify is open, to stay neutral about whether or not that is work related
@alt-romes
alt-romes / UnsureCalculator.hs
Created April 24, 2025 23:38
Unsure Calculator in exactly 100 lines of Haskell
{- cabal:
build-depends: base, random, containers
-}
{-# LANGUAGE GADTs, ViewPatterns, GHC2021 #-}
import Text.Printf
import Control.Monad (liftM, ap)
import Data.Function (on)
import Data.List (sort, minimumBy)
import System.Random
import qualified Data.Map as M
@avieth
avieth / Tuples.hs
Created May 26, 2023 14:25
Number-indexed tuples
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FunctionalDependencies #-}
@mortenson
mortenson / block.js
Last active December 18, 2023 19:15
Very simple and stupid chrome extension to block arbitrary sites
document.body.innerHTML = 'get back to work'
@mitchellh
mitchellh / overlay.nix
Last active November 2, 2024 22:01
Playdate SDK on Nix on aarch64
let
# Playdate distributes their SDK as precompiled x86_64 binaries
# currently so we have to import cross-compiled packages for it
# if we're not on an x86_64 system.
pkgsIntel = import <nixpkgs> {
crossSystem = {
config = "x86_64-unknown-linux-gnu";
};
};
in
@DanB91
DanB91 / README.txt
Last active November 28, 2022 04:57
Playdate Zig starting point
THIS GIST IS OUT OF DATE! Please use my new project template here to get started with Zig on Playdate:
https://github.com/DanB91/Zig-Playdate-Template
The rest of this is preservied for historical reasons:
This is a small snippet of some code to get you started for developing for the Playdate on Zig. This code should be used as a starting point and may not compile without some massaging. This code has only been tested out on macOS and you'll need to modify the addSharedLibrary() portion of build.zig to output a .dll or .so instead of a .dylib, depending on you platform.
This code will help you produce both an executable for the Playdate simulator and also an executable that actually run on the Playdate hardware.
@mortenson
mortenson / sams_portland_stuff.md
Last active May 7, 2024 17:34
Sam's fun things to do in Portland

Portland recommendations by Sam

Sorted by location-ish. I tried to reduce the list to places I think are good for visitors vs. my absolute favorites, but I put a section at the bottom for places that may not be for everyone.

Breakfast / Brunch

Toki Restaurant (Downtown)

580 SW 12th Ave

My order: Grilled mackerel breakfast with a bloody mary. Their Dalgona coffee is quite good too.

@natefaubion
natefaubion / Main.purs
Last active July 20, 2023 00:02
Record currying
module Main where
import Prelude
import Data.Symbol (class IsSymbol)
import Prim.Row as Row
import Prim.RowList as RowList
import Record as Record
import Type.Proxy
@Gabriella439
Gabriella439 / emotions.md
Created March 8, 2021 19:08
How to get in touch with your emotions

How to get in touch with your emotions

I wanted to share something I've learned in the course of therapy that I felt might benefit others. Specifically, I'd like to share how to better listen to one's emotions.

Why should we do this?

You might wonder why would we want to be in better touch with our emotions. One reason why is that everybody builds a metaphor or narrative for themselves

@tfausak
tfausak / invertible-syntax-descriptions.markdown
Last active September 8, 2025 19:51
Survey of invertible syntax description libraries for Haskell.

Invertible syntax descriptions

An "invertible syntax description" is something that can be used to both parse and generate a syntax. For example, instead of defining separate toJson and fromJson functions for a given data type, an invertible syntax description could be used to provide both. There are many Haskell libraries that provide this functionality or something close to it. As far as I can tell most of them are at least inspired by Invertible syntax descriptions by Tillmann Rendel and Klaus Ostermann.

Personally I am interested in using these for HTTP routing. I frequently want to be able to define a route such as /episodes/:id.json, dispatch based on that route, and generate links to that route. Doing so manually is tedious and error prone.