Skip to content

Instantly share code, notes, and snippets.

View jarus's full-sized avatar

Christoph Heer jarus

  • Ludwigshafen, Germany
View GitHub Profile
core@core-01 ~ $ etcdctl set /nodes/fuu bar
bar
core@core-01 ~ $ etcdctl ls
/coreos.com
/nodes
core@core-01 ~ $ etcdctl get /nodes/fuu
Error: 100: Key not found (/nodes) [12386]
core@core-01 ~ $ etcdctl get /nodes
Error: 100: Key not found (/nodes) [12386]

Tables

Nodes

  • id (big int)
  • meta (jsonb)
  • tags (jsonb)
  • lat
  • lng
@jarus
jarus / gist:4560318
Created January 17, 2013 22:14
Simple example to use requests to get and set a custom variable in RWE SmartHome System
import re
import time
import requests
URL = 'https://mobile.rwe-smarthome.de/MobileWeb'
request_validation_re = re.compile(r'<input name="__RequestVerificationToken" type="hidden" value="(.*?)" />')
@jarus
jarus / ssh_tunnel
Created December 28, 2012 12:40
Simple init script to dig a ssh tunnel
#!/bin/sh
# Simple init script to dig a ssh tunnel
# Author: Christoph Heer <christoph.heer@googlemail.com>
SSH_ARGS="user@remote.host -p 22 -N -n -L 4950:localhost:4949"
PID_FILE="/var/run/remote_host_tunnel.pid"
case "$1" in
start)
if [ -f $PID_FILE ]; then
@jarus
jarus / excel.py
Created August 1, 2012 09:20
Excel in Python
import xlrd
# Example excel file under: http://d.pr/f/7ELQ
wb_addresses = xlrd.open_workbook('addresses.xls').sheet_by_index(0)
for rownum in range(wb_addresses.nrows):
print "%s: " % rownum,
row = wb_addresses.row_values(rownum)
for cell in row:
print cell,
@jarus
jarus / gist:3080420
Created July 10, 2012 01:27
Magnet Link for EuroPython2012 Videos
magnet:?xt=urn:btih:D416308F29FA029BC068546F18588885C3FB88B1&dn=EuroPython2012Videos&tr=http%3a//thelabmill.de%3a4570/announce
@jarus
jarus / test.py
Created August 21, 2011 14:52
Testing Flask application with basic authentication
import base64
from myapplication import app
class MyTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
@jarus
jarus / base64.js
Created April 29, 2011 07:52 — forked from stubbetje/base64.js
Base64 encode and decode in javascript
var Base64 = {
characters: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" ,
encode: function( string )
{
var characters = Base64.characters;
var result = '';
var i = 0;
do {