Skip to content

Instantly share code, notes, and snippets.

View emaxerrno's full-sized avatar
💭
I may be slow to respond.

Alexander Gallego emaxerrno

💭
I may be slow to respond.
View GitHub Profile
@chetan
chetan / mesos_isolators.md
Last active January 18, 2019 21:55
Description of available Apache Mesos isolators
@daniel-j-h
daniel-j-h / pgo.sh
Last active August 21, 2024 03:18
pgo: profile guided optimization with gcc
# Instrument binaries, pgo data to /data/pgo, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-generate=/data/pgo' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
# Run instrumented program, generate and write pgo data
./runIt
# Use profile data and feed into gcc, correct for threading counter noise, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-use=/data/pgo -fprofile-correction' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
@nputnam
nputnam / gist:e96be6fd83f266de0b3a
Created April 6, 2015 17:29
Security Handler for Nifty
...
NiftySecurityHandlers niftySecurityHandlers = new NiftySecurityHandlers() {
@Override
public ChannelHandler getAuthenticationHandler() {
return noOpHandler;
}
@Override
public ChannelHandler getEncryptionHandler() {
@johnynek
johnynek / AliceInAggregatorLand.scala
Last active January 24, 2024 19:38
A REPL Example of using Aggregators in scala
/**
* To get started:
* git clone https://github.com/twitter/algebird
* cd algebird
* ./sbt algebird-core/console
*/
/**
* Let's get some data. Here is Alice in Wonderland, line by line
*/
@jkreps
jkreps / benchmark-commands.txt
Last active September 15, 2024 11:37
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
@fanatoly
fanatoly / LazyMap.scala
Created February 25, 2014 21:46
LazyMap ftw
package com.yieldmo.rtb.util
class LazyMap[A,B](delegate: Map[A,() => B]) extends scala.collection.immutable.Map[A,B]{
def get(key: A): Option[B] = delegate.get(key).map{ _() }
def iterator: Iterator[(A,B)] = delegate.iterator.map{ pair => (pair._1, pair._2()) }
def +[B1 >:B](kv: (A, B1)): Map[A, B1] = new LazyMap[A,B1](delegate + (kv._1 -> (() => kv._2)))
def -(key: A): Map[A, B] = new LazyMap[A,B](delegate - key)
}
@bigs
bigs / lambda.js
Last active August 29, 2015 13:56
lambda functions in javascript
var lambda = function (str) {
var res = str.match(/^\s*([a-z]+(?:\s+[a-z]+)*)\s*\->\s*(.+?)\s*$/);
if (!res) {
throw new Error('Invalid lambda expression');
}
var args = res[1].replace(/\s{2,}/g, ' ').split(' ')
, body = 'return ' + res[2] + ';';
@elyzion
elyzion / echo.rs
Last active August 29, 2015 13:56
A very simple echo server.
//! A simplistic echo server that allows client to exit using the quit command.
#![crate_id = "echo:0.1pre"]
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
use std::io::{Listener, Acceptor, BufferedStream};
use std::io::net::tcp::TcpListener;
@bzg
bzg / emacs-strip.el
Last active January 2, 2023 21:22
Emacs, naked
;; Prevent the cursor from blinking
(blink-cursor-mode 0)
;; Don't use messages that you don't read
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
;; Don't let Emacs hurt your ears
(setq visible-bell t)
;; You need to set `inhibit-startup-echo-area-message' from the
;; customization interface:
class PartialFunctionBuilder[A, B] {
import scala.collection.immutable.Vector
// Abbreviate to make code fit
type PF = PartialFunction[A, B]
private var pfsOption: Option[Vector[PF]] = Some(Vector.empty)
private def mapPfs[C](f: Vector[PF] ⇒ (Option[Vector[PF]], C)): C = {
pfsOption.fold(throw new IllegalStateException("Already built"))(f) match {