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 / consul-cluster.md
Created February 10, 2017 16:02
Getting a broken consul cluster up

Consul: 0.7.2

You may have crashed your cluster so that all Consul servers have been offline at some point. You may be running on Kubernetes. The default 96 hours didn't pass, so there was no reaping of Consul servers. Restarting it all doesn't work. You've read this issue five times over and nothing works. On top of it all, which makes it harder, you're running a StatefulSet on Kubernetes, so you need to do kubectl delete pods/consul-1 to make the container arguments (kubectl replace consul/consul.yml) bite. On top of this, if you kubectl exec -it consul-1 and then kill -9 5, Kubernetes goes into a crash loop with exponential backoff, eating into your time.

Sounds like a Friday pleasure, right?

The tools you have at your disposal are:

  • -bootstrap
  • kubectl replace consul/consul.yml
@haf
haf / gist:ed9adfbadade14ca86fa9683bfdc7d49
Created October 19, 2016 17:04
Shownotes redux/react
# What's redux?
- state + action -> reducer -> store -> connect (utils)(component) -> render
- reducers are scoped to action types
## redux's connect function
Responsible for mapping { state, dispatch } to props as first curried parameter. Second curried parameter is the component.
=> export default connect(mS, mD)(Comp);
@haf
haf / Find ip
Last active September 5, 2016 16:08
Make your OS X firewall mess with connections to js.stripe.com to test your async JavaScript
dig js.stripe.com
@haf
haf / Supervisor.fs
Last active August 29, 2016 07:18
Supervision Hopac
module Logary.Supervisor
open System
open Hopac
open Hopac.Infixes
open NodaTime
type PolicyStep =
| Sleep of dur:Duration
| RestartOne
@haf
haf / Usage.txt
Last active April 20, 2018 13:33
Unlist lots of NuGet packages
Unlist all v4.* packages:
$ ./unlist.rb MyPackage v4.
Unlist specific version:
$ ./unlist.rb MyPackage v2.3.5
Unlist all versions:
@haf
haf / gist:1b02df5f9aef88addfc27a61f26d07da
Last active August 5, 2016 17:06
Checklist when adding a new F# project
- Do you have the latest mono?
- .travis.yml
- appveyor.ml
- Ensure .Net is 4.5 or mono doesn't compile it
- Ensure all .Tests have App.config or Windows doesn't compile it
- Add the bloody app.config as content to the fsproj file or it doesn't end up in the output folder
- Remove reference to FSharp.Core because you're a effing bot who likes to edit XML
- `add -f` `paket-files/`-files to make it more approachable
- `system` doesn't work with quotes in albacore, use `sh` instead
- Stare at the build complexity here https://github.com/fsprojects/FsProjectsAdmin/issues/10#issuecomment-237898162 to
'GET /': 2.0.0.0 was 1.25x faster and 1.95x more memory efficient than 0.34.0.0.
'GET /': 2.0.0.0 was 1.83x faster and 0.22x more memory efficient than 1.0.0.0.
'GET /': 2.0.0.0 was 1.68x faster and 0.31x more memory efficient than 1.1.1.0.
'POST / n' mirror': 2.0.0.0 was 1.20x faster and 3.54x more memory efficient than 0.34.0.0.
'POST / n' mirror': 2.0.0.0 was 1.72x faster and 0.34x more memory efficient than 1.0.0.0.
'POST / n' mirror': 2.0.0.0 was 1.49x faster and 0.48x more memory efficient than 1.1.1.0.
@haf
haf / index.js
Created February 23, 2016 17:36
Intro to JavaScript
// Hello World
@haf
haf / keybase.md
Last active December 7, 2015 11:58

Please publicly post the following Gist, and name it keybase.md

Keybase proof

I hereby claim:

  • I am haf on github.
  • I am haf (https://keybase.io/haf) on keybase.
  • I have a public key ASDJ2Iyjt10Q0n7_jRMQrKDVoTqpBFN0Vlx1iaFKtTXMjQo
Trouble with Transactions
This is a piece on why you should use transactions.
The trouble with transactions in contemporary programming is that the APIs for
transactions don't fit how applications are written. Say you want to support
transactions in your app, how would you go about?
First of all, you're already doing implicit transactions around each SQL
statements. So you are moving away from this model if you're changing how you