-
Kafka Binary files : http://kafka.apache.org/downloads.html
-
Atleast 2 AWS machines : AWS EMR or EC2 will be preferable
-
A Kafka Manager Utility to watch up the Cluster : https://cwiki.apache.org/confluence/display/KAFKA/Ecosystem
// a simple module to be hosted in the console app | |
public class MainModule : NancyModule | |
{ | |
public MainModule() | |
{ | |
Get["/"] = x => { return "Hello World"; }; | |
} | |
} | |
static void Main(string[] args) |
/// <summary> | |
/// Interface definition of Either | |
/// </summary> | |
/// <typeparam name="Tl">type of the Left value</typeparam> | |
/// <typeparam name="Tr">type of the Right value</typeparam> | |
public interface IEither<out Tl, out Tr> | |
{ | |
/// <summary> | |
/// Check the type of the value held and invoke the matching handler function | |
/// </summary> |
#r "../packages/Microsoft.Azure.Documents.Client.0.9.1-preview/lib/net40/Microsoft.Azure.Documents.Client.dll" | |
#r "../packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll" | |
open System | |
open Microsoft.Azure.Documents | |
open Microsoft.Azure.Documents.Client | |
open Microsoft.Azure.Documents.Linq | |
let endpointUrl = "yourEndpoint" |
var Optional = (value) => { | |
var isNull = value === null || value === undefined; | |
return { | |
filter:(action) => (isNull || !action(value)) ? Optional() : Optional(value), | |
map:(action) => isNull ? Optional() : Optional(action(value)), | |
isPresent:() => !isNull, | |
ifPresent:(action) => { | |
if(!isNull) action(value); | |
}, | |
get:() => isNull ? null : value, |
'use strict'; | |
const buildMatcher = (cases) => (actual) => | |
cases | |
.find((cse) => cse.matches(actual)) | |
.result(actual); | |
const buildNextOn = (previousCases) => { | |
var build = (matchesPred, result) => { | |
const cases = previousCases.concat( |
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
For a while, JSX
and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.
This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.
Set up web-mode
web-mode
provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.
type 'a NonEmpty = NonEmpty of 'a * 'a list | |
let inline (&|) head tail = NonEmpty (head, tail) | |
let inline (|&|) head = NonEmpty (head, []) | |
let toList = function NonEmpty (head, xs) -> head :: xs | |
let mapNonEmpty f = function | |
NonEmpty (head, xs) -> NonEmpty (f head, List.map f xs) | |
let bindNonEmpty (f: 'a -> 'b NonEmpty) = function |
Spoilers for Advent of Code 2019 follow.
Fuel required to launch a given module is based on its mass. Specifically, to find the fuel required for a module, take its mass, divide by three, round down, and subtract 2.
This describes a simple function. There seems to be an oversight in the problem statement that modules with very low mass have a negative fuel requirement. I'm going to assume that's not right, and that instead of integer subtraction, we want natural number subtraction (sometimes called "monus"). In Unison, we can use the Nat
type instead of integers, so we don't have to consider negatives. The subtraction operation is called drop
: