This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ppid_tty=$(readlink /proc/$(cut -d' ' -f4 /proc/$1/stat)/fd/0) | |
kill -TSTP $1 && (/bin/echo "backgrounded $1" >> $ppid_tty) && kill -CONT $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{- I really like “literate” code as a writing style. Especially when I’m explaining or exploring | |
complicated ideas, writing comments in a longer form and explaining as I go along keeps me moored | |
to reality and attached to what I’m trying to do. Since I wanted a tool to convert into this | |
format, I decided to write one; since I like this format, I decided to write the tool using it. | |
I decided to use Haskell because it has [some history][0] with “literate code”, and because I | |
really like the Pandoc library for converting from Markdown to HTML. -} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- this is hosted currently at http://fearchar.net/2016/May/29/bart-elm-routes -} | |
import Debug exposing (log) | |
import Dict exposing (Dict) | |
import Json.Decode as Json exposing ((:=)) | |
import Maybe | |
import Result | |
import String | |
import Html.App as Html | |
import Html exposing (Html) | |
import Svg exposing (..) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Translated from code from Sam Kimbrel and Charlie Loyd | |
// via http://basecase.org/env/on-rainbows | |
const PHI = (1 + Math.pow(5, 0.5)) / 2; | |
function sinebow(hue) { | |
// Choose a color from a sin^2-softened rainbow. | |
var red = Math.pow(Math.cos(Math.PI * hue), 2) * 255; | |
var green = Math.pow(Math.cos(Math.PI * (hue + 1/3)), 2) * 255; | |
var blue = Math.pow(Math.cos(Math.PI * (hue + 2/3)), 2) * 255; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# alias remind-me="$HOME/bin/remind_me.py" | |
from sys import argv, exit, stderr | |
import subprocess | |
import time | |
USAGE_STRING = """ | |
usage: remind-me @time "your message goes here" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Exception (bracket_) | |
import Control.Monad.Except (catchError, throwError) | |
import Data.ByteString.Lazy.Char8 (pack) | |
import Data.Digest.Pure.SHA (sha256) | |
import System.IO (hGetEcho, hSetEcho, hFlush, hGetLine, hPutStrLn, stdin, stdout, withFile, IOMode(ReadMode,WriteMode)) | |
import System.IO.Error (isDoesNotExistError) | |
withEcho :: Bool -> IO a -> IO a | |
withEcho echo action = do | |
old <- hGetEcho stdin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -u tmux_session (whoami) | |
set -u EDITOR /usr/bin/vim | |
set -u GIT_EDITOR /usr/bin/vim | |
fish_vi_mode | |
source $HOME/.config/fish/functions/pasteboard.fish | |
if test $TERM != "screen" | |
if tmux list-windows -t $tmux_session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a Modifier implements a modifier function | |
sealed abstract class Modifier { | |
def modify(measure: Measure): Measure | |
} | |
case class Prefix(prefix: String, modify(measure: Measure): Measure) extends Modifier | |
class Exponent(power: Int) extends Modifier { | |
def modify(measure: Measure): Measure = { | |
Range(1, power).foldLeft(measure)(case (m, _) => m.multiply(measure)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- I’m trying to add section/page markers to a list of Monoids. In the first | |
case here, the Monoids are actually strings, but in the second, they aren't. -} | |
{- Case #1 -} | |
import Data.Char (chr) | |
sectionLength :: Int | |
sectionLength = 3 | |
myVocab :: [String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meilichios % ghc AmoAmasAmat.hs && ./AmoAmasAmat | |
Present | |
amo amas amat | |
amamus amatis amant | |
Imperfect | |
amabam amabas amabat | |
amabamus amabatis amabant | |
Future |