Skip to content

Instantly share code, notes, and snippets.

@HappyCodingRobot
HappyCodingRobot / rpi.py
Created May 14, 2015 12:10
Simple XBMC/Kodi controller via http POST request and JSONRPC
#!/usr/bin/python
'''
Very simple XBMC/Kodi controller via http POST request and JSONRPC
(testing the principle..)
'''
import httplib
import sys, argparse
import json
PI = '192.168.162.33'
@HappyCodingRobot
HappyCodingRobot / LED_cie1931.py
Created June 6, 2015 16:20
Create correction table for PWM values based on CIE1931 algorithm
#!/usr/bin/python3
#
''' Script to create a correction table for PWM values
to create linear brightness for a LED
based on the CIE1931 algorithm
original author: ??
'''
PWM_BIT_SIZE = 8 # Bit size of used PWM
CORR_TABLE_SIZE = 16 # Number of elements in vector
####
@HappyCodingRobot
HappyCodingRobot / Makefile
Last active December 7, 2017 19:04
slightly enhanced Arduino makefile framework
# Hey Emacs, this is a -*- makefile -*-
#
# see: http://ed.am/dev/make/arduino-mk
#
# SOURCES := main.c other.cpp
# LIBRARIES := EEPROM SPI Adafruit_GFX Adafruit_ST7735
# LIBRARYPATH :=
# CPPFLAGS := -std=c++11 -Wl,-Map=foo.map -Wa,-aln=OUT.s
# SERIALMON := cutecom
#
@HappyCodingRobot
HappyCodingRobot / tmp100_i2c_read.py
Created October 29, 2015 20:42
Reading TI TMP100 sensor via i2c and libmpsse
# -*- coding: utf-8 -*-
from mpsse import *
import time
i2c = MPSSE(I2C, FOUR_HUNDRED_KHZ)
#i2c = MPSSE(I2C, ONE_HUNDRED_KHZ)
# Adress: \x4A (base) -> write: \x94 , read: \x95
# Configuration: \x60 (01100000b : 12bit resolution)
@HappyCodingRobot
HappyCodingRobot / multimeter.py
Created December 11, 2015 17:00
Reading data from Voltcraft VC506 multimeter for long-term measurements
#!/usr/bin/python
'''
Read data from Voltcraft VC506
and write to file or console
see:
https://pythonhosted.org/pyserial/
'''
import serial
import time
@HappyCodingRobot
HappyCodingRobot / Scheduler_Example.c
Last active August 22, 2019 19:32
Very basic Round Robin scheduler for AVR
#include <avr/io.h>
#include <avr/interrupt.h>
#include <inttypes.h>
#include "scheduler.h"
// Task definitions
#define nTask1 1
#define nTask2 2
@HappyCodingRobot
HappyCodingRobot / xanes_xi_protocol_rev_eng.md
Created February 7, 2018 13:17
XANES X1 Programmable LED light badge protocoll reverse engineering

XANES X1 Programmable LED light badge protocoll reverse engineering

General informations

  • VID:PID - 0416:5020
  • Product ID: LS32 Custm HID
  • uses HID Protocoll
  • 2 endpoints, uses endpoint 1 for data, all with report 0
  • 64 byte paket size

The Protocol

@HappyCodingRobot
HappyCodingRobot / 61-hp-mic-mute-hotkey.hwdb
Created January 8, 2019 14:22
Activate mic mute function key, ubuntu 18.04, HP Elitebook 820
# see also: /lib/udev/hwdb.d/60-keyboard.hwdb
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pn*EliteBook*:pvr*
KEYBOARD_KEY_81=f20 # Fn+F8 on Elitebook, map to F20
# KEYBOARD_KEY_81=fn_esc # org entry
@HappyCodingRobot
HappyCodingRobot / class_attribute_test.py
Created May 31, 2019 22:02 — forked from sente/class_attribute_test.py
Example of how to use __getattribute__(self,name) and __setattr__(self,name,val)
class Foo(object):
def __getattribute__(self, name):
print "getting attribute %s" % name
return object.__getattribute__(self, name)
def __setattr__(self, name, val):
print "setting attribute %s to %r" % (name, val)
return object.__setattr__(self, name, val)
@HappyCodingRobot
HappyCodingRobot / VerticalScrolledFrame.py
Created May 31, 2019 22:20 — forked from novel-yet-trivial/VerticalScrolledFrame.py
A vertical scrolled frame for python tkinter that behaves like a normal Frame. Tested with python 2 and 3, windows and linux.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
class VerticalScrolledFrame:
"""