Skip to content

Instantly share code, notes, and snippets.

View koeninger's full-sized avatar

Cody Koeninger koeninger

View GitHub Profile
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {

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

@jkreps
jkreps / benchmark-commands.txt
Last active January 21, 2024 11:02
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@san81
san81 / gist:15843df713054852f748
Last active December 7, 2022 00:35
Building LPSolver binary from source - for MAC OSX
#How to build and install the lp_solve Java extension on Mac OS X:
#Download and expanded lp_solve_5.5_source.tar.gz into a directory named 'lp_solve_5.5'.
#Download and expand lp_solve_5.5_java.zip into a directory named 'lp_solve_5.5_java'.
# 1) Build the lp_solve library.
$ cd lp_solve_5.5/lpsolve55
$ sh ccc.osx
@AndreasHassing
AndreasHassing / InstallingFsYaccFsLexOSX.md
Last active August 8, 2022 06:47
How to get FsYacc and FsLex (FsLexYacc) on OS X

Installing FsYacc and FsLex (FsLexYacc) on OS X

Step by step guide to getting FsYacc and FsLex for development on OS X.

Changes

  • 2017-01-09: Updated guide to reflect latest version of FsLexYacc (7.0.3)
  • 2016: Created

1. Install Mono

By doing one of these:

@jbrisbin
jbrisbin / NioScalabilityTest.java
Created January 3, 2012 22:14
Pure Java NIO scalability test
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
@jirutka
jirutka / install_osx.md
Last active March 6, 2022 09:07
How to install Cabot on OS X for development

How to install Cabot on OS X

This manual describes a complete procedure how to install and run Cabot on OS X for development. It was tested on OS X 10.9.1 and Cabot version 2014-01-23.

Important notes

We’re using Homebrew to install the required dependencies on OS X. If you don’t have Homebrew yet (how is that possible? ;), see http://brew.sh/ for an installation script. Note: MacPorts can be probably used too, but we didn’t test it.

Although you can use Python and Ruby that comes with OS X, it’s better to use Python installed via Homebrew and use rbenv to manage Rubies. Then you don’t need to use sudo and mess up your system. If you’re already using rvm instead of rbenv, then stay with it and skip the rbenv installation steps.

@chelmertz
chelmertz / pre-commit
Created February 8, 2011 09:25
pre-commit hook for git, running php lint
#!/usr/bin/php
<?php
// copied from http://phpadvent.org/2008/dont-commit-that-error-by-travis-swicegood
// authored by Travis Swicegood
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
@ibuenros
ibuenros / SparkUtils.scala
Created June 29, 2014 17:12
Spark productionizing utilities developed by Ooyala, shown in Spark Summit 2014
//==================================================================
// SPARK INSTRUMENTATION
//==================================================================
import com.codahale.metrics.{MetricRegistry, Meter, Gauge}
import org.apache.spark.{SparkEnv, Accumulator}
import org.apache.spark.metrics.source.Source
import org.joda.time.DateTime
import scala.collection.mutable