Skip to content

Instantly share code, notes, and snippets.

View Leonidas-from-XIV's full-sized avatar

Marek Kubica Leonidas-from-XIV

View GitHub Profile
% make dev
==> Installing envconsul for darwin/amd64
runner.go:17:2: cannot find package "github.com/hashicorp/consul-template/child" in any of:
/usr/local/Cellar/go/1.9/libexec/src/github.com/hashicorp/consul-template/child (from $GOROOT)
/Users/marek/go/src/github.com/hashicorp/consul-template/child (from $GOPATH)
cli.go:15:2: cannot find package "github.com/hashicorp/consul-template/config" in any of:
/usr/local/Cellar/go/1.9/libexec/src/github.com/hashicorp/consul-template/config (from $GOROOT)
/Users/marek/go/src/github.com/hashicorp/consul-template/config (from $GOPATH)
runner.go:19:2: cannot find package "github.com/hashicorp/consul-template/dependency" in any of:
/usr/local/Cellar/go/1.9/libexec/src/github.com/hashicorp/consul-template/dependency (from $GOROOT)
@Leonidas-from-XIV
Leonidas-from-XIV / with.ml
Created February 10, 2017 22:08
Small example of how the `with` construct on modules works
module type Mapable = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val unsafe_perform_io : 'a t -> 'a
end
module OptionMapper : Mapable
(* comment out the following line to see difference in behaviour *)
with type 'a t = 'a option
module type Mapper = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
module OptionMapper : Mapper
with type 'a t = 'a option
= struct
type 'a t = 'a option
let map f = function
open Printf;;
(*
This was a learning experience in OCaml computation. I had to:
* Change List.map/append to rev_map/rev_append to avoid stack overflow
* Rewrite take to pattern match rather than checking List.length
*)
let length = 35651584;;
let input = [1;1;1;0;1;0;0;0;1;1;0;0;1;0;1;0;0];;
@Leonidas-from-XIV
Leonidas-from-XIV / elm-0.17.1-ghc-8-PKGBUILD.patch
Last active July 12, 2016 19:40
Patch for elm-platform 0.17.1-1 to build against current Arch Linux GHC 8.0.1-1. Apply with `git apply --stat elm-0.17.1-ghc-8-PKGBUILD.patch`
From 066c94fd6c1a59d637d36e9d02c3971c42c736a5 Mon Sep 17 00:00:00 2001
From: Marek Kubica <[email protected]>
Date: Tue, 12 Jul 2016 21:20:35 +0200
Subject: [PATCH] GHC 8 fix from Homebrew repository
---
.SRCINFO | 6 +++---
PKGBUILD | 11 +++++++++--
2 files changed, 12 insertions(+), 5 deletions(-)
@Leonidas-from-XIV
Leonidas-from-XIV / build.sh
Last active January 7, 2016 16:18
js_of_ocaml, not a fan of stdio
$ ocamlbuild foo.byte
Finished, 3 targets (0 cached) in 00:00:00.
$ js_of_ocaml foo.byte
$ node foo.js /tmp/foo
/tmp/foo/foo.js:185
i=ak(r);if(0===i){if(!m)throw D;var
^
248,End_of_file,-5
@Leonidas-from-XIV
Leonidas-from-XIV / pm.swift
Last active December 4, 2015 14:13
switch is not an expression? what?
enum Either<T, V> {
case Left(T)
case Right(V)
}
var lint: Either<Int, Any> = Either.Left(42)
var rstring: Either<Any, String> = Either.Right("at you")
switch rstring {
case .Right(let x): print("right", x)
@Leonidas-from-XIV
Leonidas-from-XIV / untyped-lambda-calculus.clj
Last active November 6, 2015 16:21
Do you even need `if` or `cond` as special forms?
(def TRUE (fn [x] (fn [y] x)))
;=> #'user/TRUE
(def FALSE (fn [x] (fn [y] y)))
;=> #'user/FALSE
(def AND (fn [p] (fn [q] ((p q) p))))
;=> #'user/AND
((AND TRUE) FALSE)
;=> #object[user$FALSE 0x47a57da0 "user$FALSE@47a57da0"]
(def IFTHENELSE (fn [p] (fn [a] (fn [b] ((p a) b)))))
;=> #'user/IFTHENELSE
@Leonidas-from-XIV
Leonidas-from-XIV / core.clj
Created September 24, 2015 09:27
Aleph invalid data
(ns twoohfour.core
(:require [aleph.http :as http])
(:gen-class))
(defn handler [req]
{:status 204
:headers {"content-type" "text/plain"}
:body "Something"})
(defn -main
@Leonidas-from-XIV
Leonidas-from-XIV / Spacemacs.desktop
Created June 19, 2015 21:59
.desktop file for GNOME3, put it in ~/.local/share/applications/spacemacs.desktop
[Desktop Entry]
Name=Spacemacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacs %F
Icon=/home/marek/.emacs.d/core/banners/img/spacemacs.png
Type=Application
Terminal=false
Categories=Development;TextEditor;