Skip to content

Instantly share code, notes, and snippets.

yelouafi / delimited-continuations.js
Last active Jun 25, 2020
delimited continuations using javascript generators
View delimited-continuations.js
// We model the call stack using a linked list of Generators
// Each Generator has a _return field pointing back to its parent
function stepGen(gen, arg) {
const {done, value} =
if(done) {
if(gen._return) {
stepGen(gen._return, value)
dradtke /
Created Jun 22, 2018
A script for importing GitHub issues into a Fossil repository
# +o histexpand is to avoid issues with ! showing up in ticket descriptions.
# The rest are just good Bash script practice.
set -eu -o pipefail +o histexpand
if [[ $# -lt 2 ]]; then
echo "usage: $0 <user> <repo>"
exit 1
View index.html
<!DOCTYPE html>
<title>Large Type</title>
<link rel="stylesheet/less" type="text/css" href="style.less">
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="lib/less.min.js"></script>
<div class="out"><span contenteditable autofocus>*hello*</span></div>
esrever10 /
Last active Mar 18, 2021
gstreamer send and receive h264 rtp stream
# linux send h264 rtp stream:
gst-launch-1.0 -v ximagesrc ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host= port=5000
# Macos send h264 rtp stream:
gst-launch-1.0 -v avfvideosrc capture-screen=true ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host= port=5000
# receive h264 rtp stream:
gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
twanvl / machinesbench.hs
Created Jun 7, 2016
Machines benchmark modified to include vector stream fusion. Addapted from, which is in turn based on
View machinesbench.hs
{-#LANGUAGE NoMonomorphismRestriction #-}
module Main (main) where
import Control.Monad (void)
import Control.Monad.Identity
import Criterion.Main
import qualified Data.Conduit as C
import qualified Data.Conduit.Combinators as CC
import qualified Data.Conduit.List as C
import qualified Data.Machine as M
tonyg / monad.rkt
Last active Sep 9, 2016
Monads in Racket
View monad.rkt
#lang racket/base
;; Monads in Racket, including polymorphic bind, return and fail.
;; Haskell-like do-notation.
(provide define-monad-class
(struct-out monad-class)
jozefg / closconv.lhs
Last active Mar 27, 2021
Tutorial on Closure Conversion and Lambda Lifting
View closconv.lhs
This is my short-ish tutorial on how to implement closures in
a simple functional language: Foo.
First, some boilerplate.
> {-# LANGUAGE DeriveFunctor, TypeFamilies #-}
> import Control.Applicative
> import Control.Monad.Gen
> import Control.Monad.Writer
> import Data.Functor.Foldable
thomasfr / autossh.service
Last active Mar 17, 2021
Systemd service for autossh
View autossh.service
Description=Keeps a tunnel to '' open
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
Fuuzetsu / hackagedocs
Last active Apr 9, 2016
Script for generating and uploading missing documentation for your Hackage packages. Now with fixed package links and contents page.
View hackagedocs
#!/usr/bin/env bash
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
pauloricardomg / cors.nginxconf
Last active Apr 14, 2021
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
View cors.nginxconf
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
# Based on:
# *
# *
server {