Skip to content

Instantly share code, notes, and snippets.

View m-philipp's full-sized avatar
🏠
Working from home

Martin Philipp m-philipp

🏠
Working from home
View GitHub Profile
@m-philipp
m-philipp / classifyDatum.java
Last active May 17, 2016 17:44
Learn with WEKA in JAVA
public class classifyDatum {
public static void main(String[] args) throws Exception {
// load the classifier
Classifier cls = (Classifier) weka.core.SerializationHelper.read("your/path/to/training/data.csv.model");
// now classify data from a csv file
classifyCsv(cls, "your/path/to/test/data.csv");
// or classify some value captured from somewhere
/*
Objects can have the following parameters:
color: '#fff' by default
impassable: true if it blocks the player from movement (false by default)
onCollision: function (player, game) called when player moves over the object
onPickUp: function (player, game) called when player picks up the item
symbol: Unicode character representing the object
type: 'item' or null
*/
@m-philipp
m-philipp / gist:3a3b6400e141d8b28c76
Created October 28, 2014 23:24
AltBeacon Lib with easibeacons
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24")); // iBeacons
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24")); // Estimotes
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:0-3=a7ae2eb7,i:4-19,i:20-21,i:22-23,p:24-24")); // easiBeacons
@m-philipp
m-philipp / gist:50c60d82367251b3bc55
Created September 27, 2014 18:43
Guake dynamically set Window Position on the second Screen if existing
def get_final_window_rect(self):
"""Gets the final size of the main window of guake. The height
is the window_height property, width is window_width and the
horizontal alignment is given by window_alignment.
"""
screen = self.window.get_screen()
height = self.client.get_int(KEY('/general/window_height'))
width = 90
halignment = self.client.get_int(KEY('/general/window_halignment'))
@m-philipp
m-philipp / util.js
Created September 11, 2014 18:49
Adding CORS to express
function allowCrossDomain(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'x-requested-with, Content-Type, Auth-Token');
// intercept OPTIONS method
if ('OPTIONS' == req.method) {
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.send(204);
}
@m-philipp
m-philipp / gist:9064268
Created February 18, 2014 03:38
CORS Jquery Test
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>get demo</title>
<style>
span {
color: red;
}
div {
// Define various ADC prescaler
const unsigned char PS_16 = (1 << ADPS2);
const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
// Setup the serial port and pin 2
void setup() {
Serial.begin(115200);