Skip to content

Instantly share code, notes, and snippets.

View relrod's full-sized avatar

Rick Elrod relrod

View GitHub Profile
@relrod
relrod / AlaCarte.hs
Last active August 29, 2015 14:07 — forked from puffnfresh/AlaCarte.hs
module AlaCarte where
-- Control.Monad.Free
data Free f a = Free (f (Free f a)) | Pure a
instance Functor f => Monad (Free f) where
Pure a >>= f = f a
Free r >>= f = Free (fmap (>>= f) r)
return = Pure
@relrod
relrod / gist:208b58ce10ff30ba6164
Created October 4, 2014 19:16
Scala is hilarious
ricky@t520 ~$ scala
Welcome to Scala version 2.11.2 (OpenJDK 64-Bit Server VM, Java 1.8.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> Array("foo","bar")(2)
<console>:8: error: type mismatch;
found : Int(2)
required: scala.reflect.ClassTag[String]
Array("foo","bar")(2)
// ==UserScript==
// @name Disable Ctrl+s and Ctrl+t interceptions
// @description Stop websites from highjacking keyboard shortcuts
//
// @run-at document-start
// @include *
// @grant none
// ==/UserScript==
// This was taken from here: http://superuser.com/a/670040/307969 and modified slightly.
ricky@monadic /tmp/openssl (master)$ cloc .
2479 text files.
2333 unique files.
871 files ignored.
http://cloc.sourceforge.net v 1.62 T=6.24 s (257.4 files/s, 99546.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C 974 36487 73400 266902
ricky@monadic /tmp$ diff -u ./usr/include/hamlib/rig.h /usr/include/hamlib/rig.h | colordiff
--- ./usr/include/hamlib/rig.h 2014-08-12 13:00:57.554398449 -0400
+++ /usr/include/hamlib/rig.h 2014-08-12 12:55:35.683637690 -0400
@@ -536,13 +536,13 @@
const char *tooltip; /*!< Hint on the parameter */
const char *dflt; /*!< Default value */
enum rig_conf_e type; /*!< Type of the parameter */
- union { /*!< */
- struct { /*!< */
+ union u { /*!< */

xmonad (haskell)

ricky@monadic /tmp/xmonad-0.11$ cloc .
      23 text files.
      21 unique files.                              
       9 files ignored.

http://cloc.sourceforge.net v 1.62  T=0.05 s (288.2 files/s, 87083.7 lines/s)
-------------------------------------------------------------------------------
@relrod
relrod / gist:dd748c9ee0b111c3bd47
Last active July 10, 2020 12:19
Pure IO in OCaml via the Free monad
(* Purely functional I/O in Ocaml via the Free monad.
* by Ricky Elrod <[email protected]>.
*
* 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.
*
@relrod
relrod / gist:64011ab63d47e1c5ad0e
Created May 25, 2014 06:19
How I installed Debian on a T2000
Installing OSes on Sunfire T2000
================================
This can boot from HTTP or TFTP.
- Console into LOM
sc> bootmode bootscript="setenv auto-boot? false"
sc> poweron
sc> console
@relrod
relrod / .gitignore
Last active August 29, 2015 14:01
Haskell audio using Data.Binary.Put
dist
cabal-dev
*.o
*.hi
*.chi
*.chs.h
.virtualenv
.hsenv
.cabal-sandbox/
cabal.sandbox.config
-- This is really Idris code, but it will highlight reasonably as Haskell
module vectorTripleStuff
data Triple = VectorTriple Nat Nat Nat
instance Semigroup Triple where
(VectorTriple a b c) <+> (VectorTriple d e f) = VectorTriple (a + d) (b + e) (c + f)
instance VerifiedSemigroup Triple where