Skip to content

Instantly share code, notes, and snippets.

View byorgey's full-sized avatar

Brent Yorgey byorgey

View GitHub Profile
@byorgey
byorgey / Knotty.hs
Created October 13, 2012 16:01
Creating a tree with shared links back to parent nodes
type AccountName = String
data Account = Account {
aname :: AccountName,
asubs :: [Account]
}
deriving Show
data Account2 = Account2 {
aname2 :: AccountName,
@byorgey
byorgey / Decimals.hs
Created June 3, 2013 20:05
Decomposing rationals as prefix + repeating
import qualified Data.Map as M
import Data.Maybe
import Data.Ratio
import Data.List
import Data.Char
import Control.Arrow
import Test.QuickCheck
f n (d,r) = ((10*r) `divMod` n)
@byorgey
byorgey / gist:1d39288dd91bde886a5e
Created February 9, 2016 14:55
#diagrams logs for bollu
08:35 -!- bollu [[email protected]] has joined #diagrams
08:37 -!- bollu [[email protected]] has quit [Client Quit]
08:38 -diagramsbot:#diagrams- [monoid-extras] bergey commented on issue #25: Yes, we should move `monoid-extras` and all the Diagrams packages to containers. If you have time to make a PR, that would be great.... https://git.io/vgure
08:43 < cchalmers> it wasn't a complete failure, he did some back and did some work in the end
08:43 < cchalmers> I continued working on it but took a break a couple of months ago and haven't got back into it yet
08:43 < cchalmers> https://github.com/cchalmers/plots
08:44 < byorgey> cchalmers: oh, cool, I didn't know that
08:44 < byorgey> cchalmers: so do you think there would be room for bollu to work on 'plots' this summer?
08:46 < cchalmers> I'm not sure, hopefully I'll be a useable plotting library by then so I don't know if there's enough for a GSoC
08:46 < byorgey> fair enough
@byorgey
byorgey / keybase.md
Created September 2, 2016 21:35
Keybase proof of github identity

Keybase proof

I hereby claim:

  • I am byorgey on github.
  • I am byorgey (https://keybase.io/byorgey) on keybase.
  • I have a public key ASAMQjnz-8LDWsvMAibOFPaGzE7zNqiIyIffBb3m9dfzSgo

To claim this, I am signing this object:

@byorgey
byorgey / FastForwardLCG.hs
Created August 8, 2018 03:53
Proof-of-concept Haskell implementation of LCG fast-forwarding
-- An LCG consists of three values: a multiplier, an offset, and a
-- modulus.
data LCG = LCG
{ multiplier :: Integer
, offset :: Integer
, modulus :: Integer
}
deriving Show
SIZE=1920x1080
xrandr --size $SIZE
xrandr --output HDMI-1 --auto --output eDP-1 --size $SIZE --same-as HDMI-1
@byorgey
byorgey / Play-Button.cs
Last active November 20, 2020 00:04 — forked from c3founder/Play-Button.cs
Responsive YouTube Player and YouTube Timestamp for Roamresearch
.timestamp-control{
background-color: rgba(108,109,36,0.1);
color: rgb(251,106,13);
margin-right: 8px;
margin-top: 3px;
margin-bottom: 3px;
border-radius: '50%';
border-style: inset;
border-color: #FF3200;
font-size: 0.9em;
// A convenient version of if that takes a cmd bool instead of a bool
def ifC : forall a. cmd bool -> cmd a -> cmd a -> cmd a =
\test. \thn. \els. b <- test; if b thn els
end
// Do a DFS to harvest trees to the west and north.
// Position the robot on a tree near the southeast corner of a
// forest for best effect. The robot will collect a bunch
// of trees and return to its original starting point.
// Capabilities required: recursion, lambdas, scanner
@byorgey
byorgey / harvestline.sw
Created October 8, 2021 16:45
Harvesting along a line
def ifC : cmd bool -> cmd a -> cmd a -> cmd a = \test. \then. \else.
b <- test; if b then else
end
def x2 = \c. c;c end
def x4 = \c. x2 c; x2 c end
def x8 = \c. x4 c; x4 c end
def x16 = \c. x8 c; x8 c end
def x32 = \c. x16 c; x16 c end
def x64 = \c. x32 c; x32 c end