Skip to content

Instantly share code, notes, and snippets.

View cb372's full-sized avatar

Chris Birchall cb372

View GitHub Profile
@mjuric
mjuric / kafka-useful-commands.md
Last active September 6, 2023 03:59
Useful Kafka wrangling commands

Utilities you'll care about

All these are already installed on epyc.

  • kafkacat (conda install -c conda-forge kafkacat)

  • kt (grab it from https://github.com/fgeller/kt/releases)

  • kafka-* (come with kafka, if you yum install if from Confluent's repo, or via Docker if you're so inclined). Warning -- JVM based and dreadfully slow.

  • jq (conda install -c conda-forge jq or use your favorite package manager)

Revisiting Tagless Final Interpreters

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA

#!/bin/bash
#
# Open a URL in Chrome after SSH'ing to the URL's host and setting up a SOCKS proxy.
if [ $# -ne 1 ]
then
echo "usage: browse-with-proxy.sh <URL>"
echo
echo "Opens the given URL in a browser using an SSH tunnel to the host as a proxy"
echo
@milessabin
milessabin / gist:cadd73b7756fe4097ca0
Last active September 16, 2019 13:44
A new approach to encoding dependently-typed chained implicits, using singleton types ...
object Demo {
// A couple of type classes with type members ...
trait Foo[T] {
type A
}
object Foo {
implicit val fooIS = new Foo[Int] { type A = String }
}
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@wouter-swierstra
wouter-swierstra / gist:0b6062c9660e751cd535
Created October 13, 2014 06:54
A type-level SAT solver in Swift
// A type-level SAT solver in Swift
// Two types to model Booleans
struct True { }
struct False { }
// Negation, Conjunction, Disjunction
@lloydmeta
lloydmeta / lazyDropMax.scala
Last active August 29, 2015 14:03
Lazy generic dropMax in Scala so you can work with infinitely (why? dunno) long traversables. Should be fairy efficient wrt traversal complexity, stack and heap used.
import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds
/**
* Returns the input collection without the biggest element.
*/
def dropMax[A, T[A] <: Traversable[A]](coll: T[A])(implicit ord: Ordering[A], cbf: CanBuildFrom[_, A, T[A]]): T[A] = {
def streamWithoutMax(currentMax: A, listTail: Traversable[A]): Stream[A] = {
if (listTail.isEmpty) {
Stream.Empty
} else {
@kevinwright
kevinwright / scaladays2014.md
Last active March 8, 2018 20:25
Scaladays 2014 slides

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

@lloydmeta
lloydmeta / gist:11280714
Created April 25, 2014 07:30
Results of https://github.com/derekwyatt/spray-json-vs-argonaut on my work MBR 15, Java7, 8GB ram, 2Ghz Core i7
[info] Json4sJacksonSpec:
[info] Json4sJackson
[info] - should parse it 1,000 times (01) (713 milliseconds)
[info] - should parse it 1,000 times (02) (248 milliseconds)
[info] - should parse it 1,000 times (03) (84 milliseconds)
[info] - should parse it 1,000 times (04) (77 milliseconds)
[info] - should parse it 1,000 times (05) (73 milliseconds)
[info] - should parse it 1,000 times (06) (77 milliseconds)
[info] - should parse it 1,000 times (07) (62 milliseconds)
[info] - should parse it 1,000 times (08) (59 milliseconds)
@chantastic
chantastic / gulpfile.js
Last active October 13, 2023 03:20
This a script for a Full Stack Talk, given 3/13/14. Feel free to follow along at your own pace.
var gulp = require('gulp');
var coffee = require('gulp-coffee');
gulp.task('scripts', function () {
gulp.src('src/*.coffee')
.pipe(coffee())
.pipe(gulp.dest('./'));
});
gulp.task('watch', function () {