Skip to content

Instantly share code, notes, and snippets.

View snoble's full-sized avatar

Steven Klaiber-Noble snoble

View GitHub Profile
package ExistTest/FList
enum FList[a, b]:
Pure(fn: a -> b)
@snoble
snoble / Wagon.md
Last active November 15, 2023 06:16
A chatgpt written story.

Title: "The Wagon Venture of Willow Creek"

In the quaint hamlet of Willow Creek, where the days were long and the harvests generous, there lived a farmer named Eliza. She was a woman of vision, dreaming of a wagon that could carry more bounty than the mightiest oxen of the land.

However, Eliza's vision was tethered by a quandary. The only man capable of crafting such a wagon was Jacob, her indispensable laborer, whose daily toil was as vital as rain to her fields. Jacob was a master of wood and nail, but he lived by the day's wage, his pockets as empty as a hollow log at day's end.

In this tight-knit weave of need and skill, came a twist in the form of Ada, a traveler with eyes sharp as a hawk and a mind as nimble as a fox. Ada saw an opportunity where others saw a dead end. She proposed to stand in for Jacob, working his share on the fields, while he built the wagon. Jacob’s wages would continue, ensuring his pot stayed warm, and in return, Ada sought a slice of the wagon's future earnings.

Eliza, sh

@snoble
snoble / Plateaus.md
Created September 12, 2023 05:40
Hobbies and Sports: A Theoretical Framework for Progress and Plateaus

Hobbies and Sports: A Theoretical Framework for Progress and Plateaus

Introduction

In the realm of self-improvement, hobbies and sports are often viewed as a means to grow personally, physically, or intellectually. However, not all hobbies are created equal when it comes to personal development. A thought-provoking observation suggests that activities can be categorized into those where it is easy to practice at the edge of one's ability and those where it is easy to practice at a level beyond or beneath one's abilities. This article explores this idea, its connection to the theory of deliberate practice, and how one might overcome the inherent challenges to achieve steady progression.

Disclaimer: The ideas presented here are observations and are subject to verification and validation.

The Two Categories

type Func<A = any, B = any> = (arg: A) => B;
type OkFuncList<L> = L extends [
Func<infer A1, infer B1>,
Func<infer A2, infer B2>,
...infer Rest
]
? B1 extends A2
? [Func<A1, B1>, ...OkFuncList<[Func<A2, B2>, ...Rest]>]
: never
: L extends [Func<any, any>]
type T = {x: string, y: string} | {a:string, b: string}
function fn(a: T) {
if('x' in a) {
return a.y
} else {
return a.b
}
}
console.log(fn({x: 'xx', a: 'aa', b: 'bb'}))
#!/bin/bash
eval $(xdotool getactivewindow getwindowgeometry |
sed -n -e "s/^ \+Position: \+\([0-9]\+\),\([0-9]\+\).*/x=\1;y=\2/p" \
-e "s/^ \+Geometry: \+\([0-9]\+\)x\([0-9]\+\).*/w=\1;h=\2/p" )
let ox=$w/3
let mx=$x+$ox
let oy=$h/3
let my=$y+$oy
xdotool mousemove $mx $my

Consequar in quod

Rex manes prosunt

Lorem markdownum alite, crimine sorte tremenda spem sub tellure caedibus per patent, caelum: aethere cum. Paene ossibus pressos et legum sepulto Haemonio, fert tamen: constitit et Lyncestius frondes sumptus noxque habebunt exsistere deum. Modo venerem remotis, temptem vultumque arvis undas balteus, et deos, et pelle felicior. Ego nec! Iuvenis ferre.

@snoble
snoble / semilatice.elm
Created April 6, 2021 20:14
An add operation that appears to be a semilatice
addLists : (a -> a -> Order) -> List a -> List a -> List a
addLists compareFn lst1 lst2 =
case ( lst1, lst2 ) of
( _, [] ) ->
lst1
( [], _ ) ->
lst2
( h1 :: t1, h2 :: t2 ) ->
@snoble
snoble / merge.bosatsu
Created December 21, 2019 03:53
Merging
package Merge
def split(sorted, at):
recur sorted:
[]: ([], [])
[h, *rest]:
match cmp_Int(h, at):
GT: ([], sorted)
_:
(left, right) = split(rest, at)
@snoble
snoble / Main.scala
Created June 15, 2018 00:13
A thread safe way to do a weighted k-sampling without replacement
package snoble
import scala.collection.immutable.Stream
import scala.collection.mutable.Queue
import scala.util.Random
sealed trait ImmutableWeightedTree[T] {
def weight: Double
def totalWeight: Double
def height: Int