Skip to content

Instantly share code, notes, and snippets.

View haf's full-sized avatar
💹
currently succeeding...

Henrik Feldt haf

💹
currently succeeding...
View GitHub Profile
@haf
haf / gist:412666c5d230528e610f8353a15d9d79
Last active April 29, 2020 12:41
My YAML snippet in vscode for kubernetes
{
// Place your snippets for yaml here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"kind: PodDisruptionBudget": {
"prefix": "poddisruptionbudget",
"body": [
"apiVersion: policy/v1beta1",
@haf
haf / dirprofile.plugin.zsh
Last active September 21, 2019 09:08
Dirprofile ZSH plugin — loads a different script depending on active directory
# Similar to https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/profiles/profiles.plugin.zsh
# but adapted to suit my needs; basically, source the profile or dotfile if it exists:
# cd ~/dev/qv2
# => /Users/h/.oh-my-zsh/custom/profiles/qv2
# => /Users/h/.oh-my-zsh/custom/profiles/dev.qv2
# => /Users/h/.oh-my-zsh/custom/profiles/h.dev.qv2
# => /Users/h/.oh-my-zsh/custom/profiles/Users.h.dev.qv2
# cd ~/dev/qv2
@haf
haf / circularBuffer.js
Last active February 23, 2019 19:18
Circular buffer in JS
import { List } from "immutable";
export default class CircularBuffer {
constructor(capacity) {
if (capacity < 1) {
throw new Error("Invalid argument: capacity; must ≥1")
}
this.len = 0 // tracks current size
this.pos = 0 // points to most recent value
this.capacity = capacity
@haf
haf / Dockerfile
Last active January 27, 2019 13:18
Using multi-stage docker build with smart caching of dependencies
FROM microsoft/dotnet:2.2-sdk as build
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \
locale-gen C C.UTF-8 && \
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \
DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates
ENV LC_ALL=C.UTF-8
WORKDIR /build/
COPY paket.dependencies paket.lock ./
namespace ChironB.Benchmarks
open Chiron
open BenchmarkDotNet.Attributes
open Newtonsoft.Json
open Newtonsoft.Json.Linq
module Bench =
open System.IO
open System.Text
@haf
haf / Pipe.fs
Created April 19, 2018 11:38
Riemann
Events.events
|> Pipe.filter (Message.tryGetContext "service" >> (=) "web.api")
|> Pipe.filter (Message.getExns >> List.isEmpty >> not)
|> Pipe.bufferTime (TimeSpan.FromSeconds 3600)
|> Events.sink [ "email" ]
@haf
haf / output.png
Created March 25, 2018 08:03 — forked from endolith/output.png
Detecting rotation and line spacing of image of page of text using Radon transform
output.png
@haf
haf / 1 - Versions.md
Last active January 10, 2018 14:27
F# versions

Deps

[Suave.Testing][st] for net461:

  • [FSharp.Core][fs] >= 4.0.0.1

Suave.Testing for netstandard2.0:

  • FSharp.Core >= 4.2.3
function unfoldWith(fn) {
return value => {
let a = [],
{ next, element, done } = fn(value);
while (!done) {
a.push(element);
({ next, element, done } = fn(next));
}
return a;
}
@haf
haf / A vision for F#.md
Last active March 27, 2018 00:46
A vision for F#

What should F# as a language contain?

  • A default test framework like Expecto
  • A default HTTP client like HTTP.fs
  • A default web framework like Suave
  • A default JS framework like Fable
  • A default logging framework like Logary
  • A default character parser combinator library like FParsec
  • A default binary parser combinator library like FsAttoparsec
  • A default concurrent programming framework like Hopac