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
@kepler-5
kepler-5 / comp_multi.rs
Last active October 10, 2025 04:12
Python comprehension proc macro that handles multiple nested for-if-clauses, flattening nested structure
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
@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