Skip to content

Instantly share code, notes, and snippets.

@mrkgnao
mrkgnao / IosevkaConfigGen.hs
Last active November 8, 2022 18:28
Render Iosevka ligatures to Private Use Area glyphs, for Emacs
{-# LANGUAGE RecordWildCards, Arrows #-}
import Numeric
import Data.Char
import Control.Monad
import Data.Monoid ((<>))
import Data.List (nub, sort, reverse)
data RepeatBounds = RB
@stig
stig / New Mac Setup.org
Last active September 9, 2017 19:37
SETUP of new machine

How I set up a new Mac

Install Apps

First I install some apps. I try to use the AppStore for everything if I can, buth unfortunately that’s not possible. YMMV.

AppStore

@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.

@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Lens -- lens
import Control.Monad.IO.Class -- transformers
import Control.Monad.Trans.AWS -- amazonka
import Network.AWS.EC2 -- amazonka-ec2
main :: IO ()
@aphyr
aphyr / gist:aa3de337d12ac886eb96
Created October 9, 2014 23:59
Functional clojure.test
(require '[clojure.test :as test])
; Rewrite clojure.test to generate data structures instead of writing to
; stdout
(def ^:dynamic *results*
"Bound dynamically to an atom wrapping a vector of test report maps")
(defn add-name
"Given a testing report map, assoc's on a :name derived from the current
`clojure.test/testing` context."
@pchiusano
pchiusano / type-inhabitants.markdown
Last active January 7, 2023 17:23
Reasoning about type inhabitants in Haskell

This is material to go along with a 2014 Boston Haskell talk.

We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.

Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?

wrangle :: Int -> Int
@otoolep
otoolep / influxdb-grafana-howto.sh
Last active March 14, 2021 06:32
Shell script to download, and configure, InfluxDB, nginx, and Grafana
#!/bin/bash
# Check out the blog post at:
#
# http://www.philipotoole.com/influxdb-and-grafana-howto
#
# for full details on how to use this script.
AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
INFLUXDB_DATABASE=test1
@bitemyapp
bitemyapp / gist:ac316a6eb666695ff7d2
Last active November 4, 2020 04:11
How I talk about Haskell when I want people to care about learning Haskell

Fire up ghci. Make the text real big. Always show the types for everything as you go!

Takes ~1 hour generally.

Note: if you object to "uncertainty" (evocative of data/value flow possibilities), consider wording like "simultaneously possible values". It's a reference to how the compiler won't know whether Maybe a is a Just a or a Nothing statically. Don't blather at me about dependent types; I know.

Alternate verbiage for uncertainty: product - simultaneous altogetherness, sum - simultaneous singlehood. Also consider what the category theoretic diagrams look like. Can be instructive.

Suggestions taken under advisement.

import Control.Monad.State
type App = StateT String IO
main :: IO ()
main = do
x <- runStateT code ""
print x -- ("stateResult","stateValue")
return ()