Skip to content

Instantly share code, notes, and snippets.

View mcollina's full-sized avatar

Matteo Collina mcollina

View GitHub Profile
@mcollina
mcollina / 1-NetworkButtonJSON.md
Last active December 15, 2015 23:00
NetworkButtonJSON

NetworkButtonJSON

NetworkButtonJSON is a forest of network enabled leds that switch on and off on simultaneosly. Join the forest, build a networked LED.

You should:

  • mount an Arduino Ethernet Shield.
  • build an Arduino-based prototype with the following schema:
@mcollina
mcollina / leveldown-throw-error.js
Created May 8, 2013 23:47
Error: cannot call next() after end()
var leveldown = require("leveldown")
, db = leveldown("./db")
, async = require("async")
, count = 0
, iterators = []
, mythrow = function(err) {
console.log(err)
}
async.series([
@mcollina
mcollina / proposal.html
Last active December 17, 2015 17:19
Ponte Technology Proposal
<!--
This document is provided as a template along with some guidance for creating
your project proposal. This is just a template. Feel free to change it as
you see fit (add sections, remove section). We feel, however, that the
suggestions represented in this document represent the reasonable minimum
amount of information to move forward.
Please keep the formatting in this document simple. Please do not edit
this document in Microsoft Word as it adds huge piles of markup that make
it difficult to restyle.
var level = require("levelup");
var sublevel = require("level-sublevel");
var db = sublevel(level("/tmp/buuuug"));
var sub = db.sublevel("gh");
sub.put("key", "value", function() {
var emitted = 0;
sub.createReadStream()
.on("data", function(data) {
@mcollina
mcollina / review.md
Created January 21, 2014 17:50
Getting Started with LevelDB book review.

LevelDB is amazing, and it represent a new trend in the whole NoSQL space: build your own database. Thanks to a small core, you can build just the data store you want and need. This book teaches you how, ignore it at your own peril.

I started tinkering with LevelDB last April, after I heard the amazing NodeUp podcast about it. Not much later I wrote LevelGraph, a graph database on top of LevelDB, and I became a LevelUp's committer -- LevelUp is the node.js high-level API for LevelDB. What all this relates to this book? I wish I had this book when I started, as it explains how to use the C++ binding of LevelDB in a hands-on way, something I had to figure out myself.

var five = require("johnny-five"),
board, sensor;
board = new five.Board();
board.on("ready", function() {
sensor = new five.Sensor({ pin: 0, freq: 250 });
board.repl.inject({
sensor: sensor
});
@mcollina
mcollina / jschan
Last active August 29, 2015 14:04
libchan vs jschan
00000000 86 a4 41 72 67 73 91 a5 68 65 6c 6c 6f a3 43 6d |..Args..hello.Cm|
00000010 64 a4 65 63 68 6f aa 53 74 61 74 75 73 43 68 61 |d.echo.StatusCha|
00000020 6e c7 05 01 02 00 00 00 03 a6 53 74 64 65 72 72 |n.........Stderr|
00000030 d6 02 00 00 00 05 a5 53 74 64 69 6e d6 02 00 00 |.......Stdin....|
00000040 00 07 a6 53 74 64 6f 75 74 d6 02 00 00 00 09 |...Stdout......|

Keybase proof

I hereby claim:

  • I am mcollina on github.
  • I am matteocollina (https://keybase.io/matteocollina) on keybase.
  • I have a public key whose fingerprint is 93D5 470F 79EB D334 120A 3710 41E7 5C25 33C8 E6EA

To claim this, I am signing this object:

@mcollina
mcollina / tarappend.js
Created June 19, 2015 10:57
Appending to a tar file
var tar = require('tar-stream')
var concat = require('concat-stream')
var assert = require('assert')
var pack1 = tar.pack()
pack1.entry({
name: 'hello'
}, 'hello world')
@mcollina
mcollina / settuning.sh
Last active April 16, 2024 17:12
m3medium config
#!/bin/bash
sysctl net.core.rmem_default=268435456
sysctl net.core.wmem_default=268435456
sysctl net.core.rmem_max=268435456
sysctl net.core.wmem_max=268435456
sysctl net.core.netdev_max_backlog=100000
sysctl "net.ipv4.tcp_rmem=4096 16384 134217728"
sysctl "net.ipv4.tcp_wmem=4096 16384 134217728"
sysctl "net.ipv4.tcp_mem=786432 1048576 268435456"