Skip to content

Instantly share code, notes, and snippets.

View tjweir's full-sized avatar

Tyler Weir tjweir

View GitHub Profile
@tjweir
tjweir / Main.hs
Created January 5, 2018 15:11 — forked from gelisam/Main.hs
Distributing a computation using Cloud Haskell
-- in response to https://twitter.com/jfischoff/status/948768178070470656
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Control.Concurrent (threadDelay)
import Control.Monad.IO.Class (liftIO)
import Data.Traversable (for)
import Text.Printf (printf)
import Control.Distributed.Process (Process, NodeId, spawn)
import Control.Distributed.Process (SendPort, newChan, sendChan, receiveChan)
@tjweir
tjweir / Pseudo.hs
Last active October 2, 2017 17:54 — forked from eckyputrady/Pseudo.hs
Haskell Clean Architecture
{-
This is from:
https://www.reddit.com/r/haskell/comments/73jj32/snapservant_servant_scotty_snap_spockthe_sweet/dnsz25v/
Basically:
Domain doesn't know about persistence
Persistence knows about domain, but doesn't know Routing
Routing knows about domain, but doesn't know Persistence
Main know all of them and tie them all together
If you want to expose the application via command line, you can just create a "CommandLine.hs" that basically parse command line args into domain types. Domain + Persistence need not to change.
-}
@tjweir
tjweir / jason.json
Last active November 23, 2016 11:36
jason.json
{
"$jason": {
"head": {
"title": "shazbots",
"actions": {
"$foreground": {
"type": "$reload"
},
"$pull": {
"type": "$reload"
@tjweir
tjweir / service-checklist.md
Last active September 13, 2016 17:10 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@tjweir
tjweir / http_is_a_thing.elm
Last active May 23, 2016 23:43
Make http requests. You can add your own topic.
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Http
import Json.Decode as Json
import Task
main =
Html.program
@tjweir
tjweir / yeahok.elm
Created November 29, 2015 17:59
elm start app
import Html exposing (div, button, text)
import Html.Events exposing (onClick)
import StartApp.Simple as StartApp
main : Signal Html.Html
main =
StartApp.start { model = model, view = view, update = update }
model : Int
model = 0
@tjweir
tjweir / tmk_shift
Created April 16, 2015 16:46
Dedicated shifted/modded keys in tmk
Is there a way to have a dedicated ~ key?
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MODS_KEY( MOD_LSFT, KC_GRV ), // ~
}
@tjweir
tjweir / hhkb-viper.hex
Created March 29, 2015 18:28
Viper .hex for HHKB layout.
:10000000CCC00000E7C00000E5C00000E3C0000075
:10001000E1C00000DFC00000DDC00000DBC0000068
:10002000D9C00000D7C000000C946823D3C00000E2
:10003000D1C00000CFC00000CDC00000CBC0000088
:10004000C9C00000C7C00000C5C00000C3C0000098
:100050000C94E60EBFC00000BDC00000BBC0000095
:10006000B9C00000B7C00000B5C00000B3C00000B8
:10007000B1C00000AFC00000ADC00000ABC00000C8
:10008000A9C00000A7C00000A5C000000C94850E08
:10009000A1C000009FC000009DC000009BC00000E8
@tjweir
tjweir / gist:236ab2695b95f7c363b7
Last active August 29, 2015 14:17
Octagon: TMK Firmware compilation and dfu programming.
# OS X - 10.10.2
# if you're on windows, I can't help with the firmware compilation, but dfu-programming is the same.
# Set crosspack avr-gcc
> export PATH=/usr/local/CrossPack-AVR/bin:$PATH
# avr-gcc version
> avr-gcc --version
avr-gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]