Skip to content

Instantly share code, notes, and snippets.

View kartben's full-sized avatar

Benjamin Cabé kartben

View GitHub Profile
var http = require('http'),
httpProxy = require('http-proxy'),
connect = require('connect');
//var morgan = require('morgan')
var proxy = httpProxy.createProxyServer({
target: 'http://localhost:8080' // openHAB/SmartHome URL
});
var app = connect();
#!/bin/bash
S3_LOG_LOCATION="s3://thelogbucket/logdir"
LOCAL_LOG_LOCATION="/tmp/log/"
REPORT_TITLE="My report title"
HTML_OUTPUT_DIR="/tmp/reporthtml"
REPORT="/tmp/report.ps"
# Sync log files to a local directory
s3cmd -v sync ${S3_LOG_LOCATION} ${LOCAL_LOG_LOCATION}
@kartben
kartben / keybase.md
Created June 11, 2015 13:58
keybase.md

Keybase proof

I hereby claim:

  • I am kartben on github.
  • I am kartben (https://keybase.io/kartben) on keybase.
  • I have a public key whose fingerprint is E487 65B2 B96F 1453 7F4F 5D37 40EB 756C 6519 8F79

To claim this, I am signing this object:

@kartben
kartben / tagtool.py
Created June 16, 2014 12:45
tagtool.py
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# -----------------------------------------------------------------------------
# Copyright 2010-2013 Stephen Tiedemann <stephen.tiedemann@gmail.com>
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
@kartben
kartben / arduino-sketch.ino
Last active August 29, 2015 13:56
Greenhouse scripts
/*******************************************************************************
* Copyright (c) 2013, 2014 Benjamin Cabé and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Benjamin Cabé - initial API and implementation
*******************************************************************************/
var mqtt = require('mqtt');
var client = mqtt.createClient(1883, "m2m.eclipse.org");
var b = require('bonescript');
var i2c = require('i2c');
var luminosity_pin = 'P9_40';
var led_pin = 'P8_13';
var servo_pin = 'P9_14';
var readSensors = function() {
@kartben
kartben / gist:5650228
Last active December 17, 2015 17:59
eclipse wiki edition stats
package org.wikipedia;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.HashMap;
import java.util.Map;
import org.wikipedia.Wiki.Revision;
require 'rss'
require 'pp'
require 'rss/dublincore'
$totals = Hash.new(0)
$authors = Hash.new(0)
FORUM_ID = 221 # replace this with your frm_id
def calculate(feed)
#!/usr/bin/env ruby
require 'pp'
require 'date'
content = STDIN.read()
REGEX = %r{
(?:
@kartben
kartben / gist:2871147
Created June 4, 2012 22:17
Convert BMP to 12-bit RGB values
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Main {
/**
* @param args