Skip to content

Instantly share code, notes, and snippets.

@KtorZ
KtorZ / Makefile
Last active August 18, 2020 06:09
A Makefile for toying around Haskell Program Coverage overlays and stack.
# Haskell Program Coverage - Makefile
#
# This Makefile contains a few top-level build commands for easily making
# code coverage reports using stack and hpc. It is typically used in two
# ways:
#
# a) Locally, to construct an coverage overlay template to purposely ignore
# some part of the source code in the coverage reports.
#
# b) In a continuous integration setup, to generate reports possibly using the
@tomsmalley
tomsmalley / default.nix
Created December 23, 2017 11:18
Example cabal2nix output, internal library pull request
{ mkDerivation, base, exeBuildDepends, exeBuildToolDepends
, exeBuildTools, exeExtraLibraries, exePkgConfig, intBuildDepends
, intBuildToolDepends, intBuildTools, intExtraLibraries
, intPkgConfig, libBuildDepends, libBuildToolDepends, libBuildTools
, libExtraLibraries, libPkgConfig, stdenv, testBuildDepends
, testBuildToolDepends, testBuildTools, testExtraLibraries
, testPkgConfig
}:
mkDerivation {
pname = "example";
@kovacshuni
kovacshuni / Proxy.scala
Created June 10, 2015 00:27
akka-http-streams-proxy
package sample.stream
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.server.Route
import akka.stream.ActorFlowMaterializer
import akka.stream.scaladsl.{Sink, Source}
object Proxy extends App {
@j3tm0t0
j3tm0t0 / loadkey.sh
Last active April 18, 2016 09:06
loadkey
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
configure
loadkey vyos http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
set service ssh disable-password-authentication
commit
@risacher
risacher / user.js
Last active December 7, 2016 17:47
tty.js/static/user.js to enable context-menu pasting in Firefox/gecko with tty.js web terminal.
var on = window.Terminal.on;
var isGecko = navigator.userAgent.indexOf('WebKit')==-1 && navigator.product == 'Gecko';
var isChromium = window.chrome;
// replace bindPaste with a variant that:
// 1. doesn't set contentEditable back to 'inherit'
// 2. replaces newlines with carriage returns in the clip
// 3. moves the caret (i.e. the contentEditable cursor) out of sight.
window.Terminal.bindPaste = function(document) {
@irumiha
irumiha / Application.scala
Last active January 23, 2017 21:53
play-2.1.0-chat
// This is the part in the Controller that creates the EventSource connection
def liveListen(event: String) = Action { request =>
AsyncResult {
implicit val timeout: Timeout = 5.seconds
(MegaRoomActor.ref ? (MegaRoomActor.Join(event)) ).
mapTo[Enumerator[JsValue]].map(startEventStream)
}
}
@chrsan
chrsan / AkkaUnfilteredSample.scala
Created February 17, 2012 09:47
Akka 2.0 unfiltered RESTful sample
package akka.unfiltered
import akka.actor._
import akka.dispatch.Future
import akka.pattern.ask
import akka.util.duration._
import akka.util.Timeout
import unfiltered.Async
import unfiltered.request._