Skip to content

Instantly share code, notes, and snippets.

View lewismj's full-sized avatar

Michael Lewis lewismj

  • London
View GitHub Profile
call plug#begin()
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ajmwagar/vim-deus'
Plug 'projekt0n/github-nvim-theme'
Plug 'puremourning/vimspector'
Plug 'tpope/vim-fugitive'
Plug 'godlygeek/tabular'
Plug 'airblade/vim-gitgutter'
#include <iostream>
#include <map>
#include <list>
#include <stack>
#include <algorithm>
#include <vector>
#include <future>
#include <sstream>
@lewismj
lewismj / generic.scala
Created June 19, 2021 04:03
Reading config files - case classes using Shapeless 2
object generic {
sealed trait Schema[A] {
def from(c: Config, p: String): ValidatedConfig[A]
}
object Schema {
def of[A](implicit s: Schema[A]): Schema[A] = s
@lewismj
lewismj / UpdateRepr.scala
Created November 29, 2017 07:07
copy of UpdateRepr
trait UpdateRepr[T, R <: HList] {
def apply(t: T, r: R): T
}
object UpdateRepr {
import ops.record._
implicit def mergeUpdateRepr[T <: HList, R <: HList]
(implicit merger: Merger.Aux[T, R, T]): UpdateRepr[T, R] =
new UpdateRepr[T, R] {
@lewismj
lewismj / Lib.scala
Created November 6, 2017 01:59 — forked from SystemFw/Lib.scala
Shapeless: derive JDBC Results for arbitrary case classes
import shapeless._ // requires.shapeless
import cats._, implicits._, data.Kleisli // requires.cats
import cats.sequence._ //requires kittens
import cats.effect.IO //requires cats-effect
// ofc, uses "-Ypartial-unification" and kind-projector
case class Result() // replace with the JDBC equivalent
case class DB(val r: Result) {
def nextInt: IO[Int] = ??? //IO(g.nextInt)
@lewismj
lewismj / zipper.scala
Last active April 9, 2017 04:37
ListZipper - Scala
/** Trivial example of a Zipper, using lists. */
type ListZipper[A] = (List[A],List[A])
def fst[A](t: (A,A)) = t._1
def snd[A](t: (A,A)) = t._2
def forward[A](z: ListZipper[A]) = (fst(z).tail, fst(z).head :: snd(z))
def backward[A](z: ListZipper[A]) = (snd(z).head :: fst(z), snd(z).tail)
@lewismj
lewismj / install.sh
Last active November 5, 2016 06:03
OpsCenter & Single Node DSE Install
#!/bin/bash
# install.sh
# install.sh with no arguments will install OpsCenter.
# install.sh --with-dse to install DSE
# n.b.
# For running DSE in the cloud we usually install OpsCenter
# on one node, then use OpsCenter to install on the other EC2
# nodes.
#
@lewismj
lewismj / zeppelin.conf
Created October 26, 2016 17:13
Apache Zeppelin Reverse Proxy Configuration.
#
# Apache Reverse Proxy settings for Zeppelin server.
# note:
# Change ZEPPELING_IP_OR_HOST and ZEPPELIN_PORT as appropriate.
#
# FreeBSD put into /usr/local/etc/apache24/Includes directory,
# Linux may vary.
# This is for your-host.your-domain.com/zeppelin
# if you want zeppelin.your-host.your-domain.com