Skip to content

Instantly share code, notes, and snippets.

Alexey Kuleshevich lehins

Block or report user

Report or block lehins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lehins /
Last active Jan 24, 2019
Performance of safe-decimal backed by Int64 and Word64


Name 1 10 100 1000 10000 100000 1000000
Int 6.712 ns 11.81 ns 0.066 μs 0.606 μs 11.19 μs 0.112 ms 1.118 ms
Double 13.95 ns 29.11 ns 0.247 μs 2.272 μs 22.35 μs 0.224 ms 2.233 ms
Integer 46.33 ns 251.5 ns 1.296 μs 12.71 μs 126.4 μs 1.309 ms 19.36 ms
lehins / stack-build-loop.hs
Created Nov 24, 2018
An infinite loop that runs `stack build` periodically killing it and restarting it again until either finished or build error occurs.
View stack-build-loop.hs
#!/usr/bin/env stack
{- stack
--resolver lts-12.2 script
--package filepath
--package rio
--package bytestring
--package time
--package random
--package process
--package unix
lehins / Lib.hs
Last active Jun 27, 2018
Make QuickCheck instances optional, but part of the library.
View Lib.hs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Lib
( someFunc
, Foo(..)
) where
-- In practice instead of CPP possibly use a separate module for optional instances
#ifdef QuickCheck_Instances
import Test.QuickCheck
lehins /
Last active Mar 13, 2018
ELK ELB/ALB switch
# elasticsearch_external_alb = "${module.kibana-elasticsearch-alb.alb}"
elasticsearch_external_alb = {
"security_group_id" = "${}"
"deploy_elb" = true
"deploy_elb_internal" = false
"certificate_arn" = "${data.aws_acm_certificate.wildcard-cert.arn}"
lehins /
Last active Jan 8, 2019
Setting up EC2 instance and S3 bucket for cache-s3
terraform {
backend "s3" {
encrypt = "true"
bucket = "my-remote-tfstate-bucket"
key = "my-remote-tfstate/ec2/terraform.tfstate"
region = "us-east-1"
lehins / encodeOctal.hs
Last active Jan 18, 2018
encodeOctal Benchmark
View encodeOctal.hs
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import Control.Monad.Catch
import Criterion.Main
import Data.ByteString (ByteString)
import qualified Data.ByteString as S
import Data.ByteString.Builder
import Data.Monoid

Development with minikube

Among many guides on how to start with Kubernetes and Minikube here is most consise one I'd recommend:

Disclaimer: This guide was tested with minikube 0.16.0 and due to this issue getting volume mounting with KVM was impossible. Althoug it was tested with development version at the time and above issue was no longer was a problem, so it should be fixed by now.

lehins /
Created Aug 16, 2017
Three terraform modules that should be applied individually
provider "aws" {
region = "us-east-1"
terraform {
backend "s3" {
bucket = "example-tfstate"
key = "remote-tfstate/credstash/terraform.tfstate"
region = "us-east-1"
encrypt = true
lehins /
Created May 25, 2017
My Keybase Identity

Keybase proof

I hereby claim:

  • I am lehins on github.
  • I am lehins ( on keybase.
  • I have a public key ASB26veyqfKNn9oBIuPQTetZRc2e2R5TX1cLnm7K7gXXgwo

To claim this, I am signing this object:

lehins / array.hs
Last active Mar 29, 2017
Explicit array fusion
View array.hs
#!/usr/bin/env stack
-- stack --resolver lts-8.3 exec --package vector --package criterion -- ghc -O2
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Monad.ST (ST)
import Criterion.Main
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as MVU
You can’t perform that action at this time.