Skip to content

Instantly share code, notes, and snippets.

View pklaus's full-sized avatar

Philipp Klaus pklaus

  • Frankfurt, Germany
View GitHub Profile
/************************************************************************
* Arduino Due: Reading & Writing to I2C EEPROM Version: 1.00 *
* Function : Reads and Writes to Atmel 24C64 Serial EEPROM *
* Exp. Level : Beginner/Elementary *
************************************************************************
* Arduino IDE v1.5.2 from http://arduino.cc/en/Main/Software *
* Configuration: Arduino Due (Programming Port) on /dev/ttyACM0 *
* Operating System: Xubuntu Linux 13.10 Saucy Salamander (32-bit) *
* Created: June 13, 2013 Latest Revision: June 13, 2013 *
************************************************************************
#include <string>
#include <iostream>
#include "H5Cpp.h"
#define MAX_NAME_LENGTH 32
const std::string FileName("SimpleCompound.h5");
const std::string DatasetName("PersonalInformation");
const std::string member_age("Age");
const std::string member_sex("Sex");
const std::string member_name("Name");
@pklaus
pklaus / dictcn.js
Created January 24, 2010 18:41 — forked from hzmangel/x
shadow removed (+ js markup on gist.github.com)
CmdUtils.CreateCommand({
name: ["dictcn", "dcn"],
author: {
name: "Hu Ziming",
email: "hzmangel@gmail.com"
},
contributors: ["Hu Ziming", "azuwis"],
icon : "http://dict.cn/favicon.ico",
description: "Consulting the word from <a href=\"http://dict.cn\">http://dict.cn</a>.",
help: "Consulting the word from <a href=\"http://dict.cn\">http://dict.cn</a>.",
@pklaus
pklaus / 60-lxc.conf
Created April 28, 2012 14:48 — forked from jersub/60-lxc.conf
Automates the steps to set up LXC containers with virtualized environments on Ubuntu Linux
net.ipv4.ip_forward=1
net.ipv4.conf.eth0.proxy_arp=1
@pklaus
pklaus / JSONPSensorServer.ino
Created October 5, 2012 11:31 — forked from sfentress/JSONPSensorServer.ino
Arduino Server for JSON-P pin values
/*
Web Server returning data as JSON-P
A simple web server that returns the value of the analog input
pins as a JSON-P object, using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13 (standard configuration)
* Analog inputs attached to pins A0 through A5 (optional)
* Example of reading LM35 on pin A0:
@pklaus
pklaus / index.html
Created October 5, 2012 13:56 — forked from sfentress/dgApi.js
Arduino Data
<html>
<head>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var graph = null,
formatter = null,
dataSet = [],
graphPin = null;
@pklaus
pklaus / perceptron.py
Last active December 16, 2015 09:39 — forked from benui-dev/perceptron.py
#!/usr/bin/env python
# Ben's Magical Perceptron
def dot_product(a, b):
return sum([a[i]*b[i] for i in range(len(a))])
def decision( x, w, theta ):
return (dot_product(x, w) > theta)
@pklaus
pklaus / print-png-label-to-networked-brother-label-printer.sh
Created December 23, 2016 00:45 — forked from StefanHamminga/print-png-label-to-networked-brother-label-printer.sh
Bash function to print black and white PNG (and JPEG, GIF, BMP) files to a networked Brother label printer (such as the QL-720NW)
# Print a black and white PNG file on the first available Brother label printer
# Requires https://github.com/pklaus/brother_ql
# Source (.) this file to set bash completion and add the print function.
function print-png-label() {
if [ -f "$1" ]; then
# Change these to match your printer:
local LBLPMODEL="QL-720NW"
local LBLPSIZE="62"
@pklaus
pklaus / bottle-server.py
Last active January 12, 2019 15:59 — forked from anjackson/gist:2888380
Mounting a proxy server to a /path of a Bottle app
import bottle
from hacks import ProxyServer
root = bottle.Bottle()
ps = ProxyServer()
root.mount(ps.wrapped_proxy_app, "/proxyapp")
@root.route('/hello/:name')
@pklaus
pklaus / run_docker_x11.sh
Last active May 13, 2019 14:11 — forked from slok/run_docker_x11.sh
x11 with docker archlinux
#!/bin/bash
KEY=$(xauth list | grep "$(hostname)/unix:0" | awk '{ print $3 }' | head -n 1)
CONT_HOSTNAME=docker-skype
xauth add $CONT_HOSTNAME/unix:0 . $KEY
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/tmp/.Xauthority \
-v /dev/snd:/dev/snd \
-e DISPLAY=unix$DISPLAY \