Skip to content

Instantly share code, notes, and snippets.

@jg
jg / logo.svg
Created November 4, 2016 08:18
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
let rec eval1 ctx t = match t with
TmApp(fi,TmAbs(_,x,t12),v2) when isval ctx v2 ->
termSubstTop v2 t12
| TmApp(fi,v1,t2) when isval ctx v1 ->
let t2' = eval1 ctx t2 in
TmApp(fi, v1, t2')
| TmApp(fi,t1,t2) ->
let t1' = eval1 ctx t1 in
TmApp(fi, t1', t2)
| _ ->
@jg
jg / Alexer.x
Last active October 24, 2016 16:01
{
module Alexer (scan, test, Token(..), AlexPosn(..), PosToken(..)) where
import Syntax
}
%wrapper "posn"
$digit = 0-9 -- digits
$alpha = [a-zA-Z] -- alphabetic characters
@jg
jg / syb.hs
Created October 18, 2016 15:40
{-# LANGUAGE DeriveDataTypeable #-}
module Syb where
import Data.Generics.Aliases
import Data.Generics.Schemes
import Data.Data
data Company = C [Dept] deriving (Data, Typeable, Eq, Show)
data Dept = D Name Manager [SubUnit] deriving (Data, Typeable, Eq, Show)
data SubUnit = PU Employee | DU Dept deriving (Data, Typeable, Eq, Show)
-- arithmetic operators:
data AExpr = Var String Info
| IntConst Integer Info
| Neg AExpr Info
| ABinary ABinOp AExpr AExpr Info
deriving (Show, Eq)
aExpression :: Parser AExpr
aExpression = buildExpressionParser aOperators aTerm
@jg
jg / psi.0
Created August 26, 2016 14:09
ShieldBattery
[2016-08-26T04:31:32.531Z] <system> Logging started
[2016-08-26T04:31:32.531Z] <system> Version: 3.0.1
[2016-08-26T04:31:32.697Z] <verbose> environment:
{"allowedHosts":["https://shieldbattery.net","https://www.shieldbattery.net","https://dev.shieldbattery.net"],"updateUrl":"https://shieldbattery.net/update","autoUpdate":true}
[2016-08-26T04:31:39.766Z] <verbose> websocket (site) connected.
[2016-08-26T04:31:39.790Z] <debug> StarCraft path is valid
[2016-08-26T04:31:39.794Z] <verbose> Got new rally-point servers for https://shieldbattery.net: [{"address4":"::ffff:46.101.171.83","address6":"2a03:b0c0:3:d0::8f7:4001","port":14098,"desc":"EU Central"},{"address4":"::ffff:128.199.180.179","address6":"2400:6180:0:d0::8a7:b001","port":14098,"desc":"Southeast Asia"},{"address4":"::ffff:104.131.88.42","address6":"2604:a880:800:10::f9d:f001","port":14098,"desc":"US East"},{"address4":"::ffff:198.199.111.141","address6":"2604:a880:1:20::813:2001","port":14098,"desc":"US West"}]
[2016-08-26T04:31:39.851Z] <verbose> Got
@jg
jg / freemonads.scala
Created October 21, 2015 07:04 — forked from kciesielski/freemonads.scala
Free Monads example
package com.softwaremill.freemonads
import cats.free.Free
import cats.~>
import cats._, cats.std.all._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
sealed trait External[A]
case class Tickets(count: Int) extends AnyVal
@jg
jg / MessageStore_FluxBone.js
Last active August 29, 2015 14:27 — forked from rattrayalex/MessageStore_FluxBone.js
Flux and Backbone
var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher');
var ChatConstants = require('../constants/ChatConstants');
var ChatMessageUtils = require('../utils/ChatMessageUtils');
var EventEmitter = require('events').EventEmitter;
var ThreadStore = require('../stores/ThreadStore');
var merge = require('react/lib/merge');
var ActionTypes = ChatConstants.ActionTypes;
var CHANGE_EVENT = 'change';

#Container Resource Allocation Options in docker-run You have various options for controlling resources (cpu, memory, disk) in docker. These are principally via the docker-run command options.

##Dynamic CPU Allocation -c, --cpu-shares=0
CPU shares (relative weight, specify some numeric value which is used to allocate relative cpu share)

##Reserved CPU Allocation

match "css/main.less" $ do
route $ setExtension "css"
compile $ lessCompiler
lessCompiler :: Compiler (Item String)
lessCompiler =
getResourceString >>=
withItemBody (unixFilter "lessc" [])