Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
window.WebSocket = window.WebSocket || window.MozWebSocket;
var websocket = new WebSocket('ws://127.0.0.1:9000',
@pulcheri
pulcheri / testarrows.scm
Created June 30, 2016 19:43 — forked from carloscm/testarrows.scm
-> ->> -<> -<>> for S7 Scheme
; -> ->> -<> -<>> for S7 Scheme
; inspired by https://github.com/nightfly19/cl-arrows and https://github.com/rplevy/swiss-arrows
(require stuff.scm)
; using: any? while
; replace those with your favorite scheme alternatives
; direct translation from https://github.com/nightfly19/cl-arrows
(define (arrow-proto handler initial-form forms)
(let ((output-form initial-form)
{-# LANGUAGE OverloadedStrings #-}
module SimpleThings where
import Control.Applicative ((<$>), (<*>))
import Control.Monad (mzero)
import Data.Aeson
import qualified Data.Aeson as A
-- | sum type containing all possible payloads
@pulcheri
pulcheri / ThreadPool.hs
Created June 24, 2016 16:50 — forked from NicolasT/ThreadPool.hs
Haskell worker threadpool using STM
{-# LANGUAGE CPP, FlexibleContexts, BangPatterns #-}
module Control.Concurrent.ThreadPool (
createPool
, destroyPool
, withPool
, pushWork
, popResult
, popResult'
@pulcheri
pulcheri / ecldemo.c
Created June 24, 2016 16:48 — forked from vwood/ecldemo.c
Example of ECL in a C program.
/*
Example of a C program embedding ECL with callbacks to C functions.
Compiled via: gcc ecldemo.c -lecl
*/
#include <stdio.h>
#include <stdlib.h>
#include "ecl/ecl.h"
#define DEFUN(name,fun,args) \
cl_def_c_function(c_string_to_object(name), \
// Not quite as bad as https://twitter.com/ivansafrin/status/457248037157740544 but still hairy.
#include <memory>
#include <type_traits>
#include <iostream>
template <typename Creator, typename Destructor, typename... Arguments>
auto make_resource(Creator c, Destructor d, Arguments &&... args) {
using value_t = typename std::decay<decltype(*c(std::forward<Arguments>(args)...))>::type;
using ptr_t = std::unique_ptr<value_t, void (*)(value_t *)>;
@pulcheri
pulcheri / main.cpp
Created February 8, 2016 20:48 — forked from Jiwan/main.cpp
Final C++14 example for my post - An introduction to C++'s variadic templates: a thread-safe multi-type map
#include <iostream>
#include <memory>
#include <string>
#include "repository.hpp"
// Incomplete types used as compile-time keys.
struct Key1;
struct Key2;
@pulcheri
pulcheri / howto
Last active August 29, 2015 14:27 — forked from coopernurse/howto
the world's dumbest Haskell json-rpc example
cabal install scotty
cabal install aeson
runhaskell server.hs
curl -X POST -d '{"jsonrpc":"2.0", "method":"Calc.Add", "params":[10,50], "id":"abc"}' http://localhost:3000/api
// solution for https://www.hackerrank.com/challenges/even-tree
#include <iostream>
#include <fstream>
#include <map>
#include <deque>
#include <vector>
#include <cstring>
#include <algorithm>

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results