Skip to content

Instantly share code, notes, and snippets.

View nponeccop's full-sized avatar

nponeccop

  • Barcelona, Spain
  • 16:20 (UTC +03:00)
View GitHub Profile
@nponeccop
nponeccop / upstream-cblrepo.sh
Created January 1, 2015 14:24
An extended diff with upstream cblrepo.db
#!/bin/bash
function list ()
{
cblrepo --db $1/cblrepo.db list $2 $3 | awk 'BEGIN{OFS="\t"}; { match($2, /(.*)-(.*)/, a);$2=a[1];$3=a[2]; print $1, $2, $3 };'
}
function mkjoin()
{
join <(list . $2 $3) <(list upstream-repos/$1)
@nponeccop
nponeccop / superlist.cpp
Created July 26, 2015 17:00
List of subclasses without default of copy constructors with 1 allocation per node
#include <new>
template <typename T>
struct cons
{
cons<T> *next;
char fake;
};
class evil
{
@nponeccop
nponeccop / ss-load.js
Created March 13, 2012 15:33
Proof of concept SocketStream load test
var io = require('socket.io-client')
var count = 0
function makeClient()
{
var socket = new io.Socket({
handshakeHeaders : { Cookie: 'connect.sid=XM77nAGuFBKumz6EtcK3buNN.RaRD21zOWZnwYNdX1QhQszvyT8K4uQHl1Qz2mNPv6kc' }
, host : 'localhost'
@nponeccop
nponeccop / api-naive.cpp
Last active December 12, 2015 02:59
File writing benchmark
#include <windows.h>
HANDLE f;
void my_open(char *fileName)
{
f = CreateFile(
fileName,
GENERIC_WRITE,
0,
@nponeccop
nponeccop / Foo.hs
Last active December 20, 2015 23:59
Reproduction of EclipseFP issue #135
foo = let
bar = 5
in case True of
True -> 1
@nponeccop
nponeccop / gist:6322227
Last active December 21, 2015 14:49
Hylomorphism example
{-# LANGUAGE DeriveFunctor #-}
import Data.Functor.Foldable
import qualified Data.Set as S
data Solve a x = Conquer a | Bottom | Divide x x deriving (Functor)
data Problem = Solution [Int] | Problem [([Int], S.Set Int)]
g n m = hylo phi psi $ Problem [([i], S.singleton i) | i <- [1..n-1]] where
psi (Solution is) = Conquer is
@nponeccop
nponeccop / commands.md
Last active January 12, 2016 17:10
Proposed Components

Minimal Cloud Management Interface

We assume it's for OpenVZ scenario, so chroot isolation level is used.

The images are self-contained - they include enough metadata for starting and configuration. No incremental imaging and persistence are necessary for a minimal production-ready run. Stopping can delete the chroot as well, and packed images can be deleted just after unpacking.

No provision for per-deployment configuration is required for initial operations. If the same image is to be deployed with slightly different configurations, many different images should be prepared instead.

A rate-limited infinite auto-restart is a reasonable default that is enough for initial production operations.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{-# LANGUAGE Rank2Types #-}
module Main where
-- data Cont r a = Cont { runCont :: (a -> r) -> r }
import Control.Monad.Cont
calculateLength :: [a] -> Cont r Int
calculateLength l = return (length l)
type ContS r a = (a -> r) -> r