Skip to content

Instantly share code, notes, and snippets.

View tmeissner's full-sized avatar
🏠
Home-Office

T. Meissner tmeissner

🏠
Home-Office
View GitHub Profile
@tmeissner
tmeissner / tb_adder_osvvm.vhd
Created August 14, 2014 15:43
Simple example of functional coverage using CoveragePkg of OSVVM
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.env.all;
library OSVVM;
use OSVVM.RandomPkg.all;
use OSVVM.CoveragePkg.all;
@tmeissner
tmeissner / speiseplan.py
Last active August 29, 2015 14:05
Extract menu data from html file
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import xml.dom.minidom as DOM
class SpeisePlan:
'''Class for parsing and extracting the meal data for each day of a week
lying in a given HTML file'''
@tmeissner
tmeissner / py3_closures.py
Last active August 29, 2015 14:07
Some experiments with closures in Python 3
def closure():
container = 0
def inc():
nonlocal container
container += 1
def get():
return container
def dec():
nonlocal container
container -= 1
@tmeissner
tmeissner / gist:4246604
Created December 9, 2012 19:19
Generic function to send commands over the SPI interface of an AVR uC
// defines for all commands and the max length of spi messages
#define CHIPERASE "\xc7\x94\x80\x9a"
#define SPILENGTH 32
// array to receive data
unsigned char spi_rxdata[SPILENGTH];
// transfer a byte on spi
static unsigned char spi_transfer (unsigned char c) {
SPDR = c;
@tmeissner
tmeissner / file_upload.py
Created December 16, 2012 23:28
Python file upload
#!/usr/bin/python
import yate
import cgi
import os
form = cgi.FieldStorage()
item = form["filename"]
message = 'File uploaded'
@tmeissner
tmeissner / file_upload.html
Created December 16, 2012 23:30
HTML file upload
<!DOCTYPE html>
<html>
<head>
<title>File upload</title>
</head>
<body>
<h1>File upload</h1>
<p>
@tmeissner
tmeissner / yate.py
Created December 16, 2012 23:34
Yet another template engine: a collection of simple functions to generate HTML content (taken from 'Head first Python' and expanded)
def start_response(resp="text/html"):
return('Content-type: ' + resp + '\n\n')
def html_header(title="default"):
return("""
<head>
<meta charset="utf-8" />
<title>""" + title + """</title>
</head>"""
)
@tmeissner
tmeissner / w1-mail.sh
Last active December 19, 2015 16:39
Spam yourself with eMails containing the temperature measured by your 1wire temperature sensor ;)
#!/bin/bash
read -r BLA
TEMP=$(echo $BLA | sed "s/.*\([0-9][0-9].[0-9][0-9][0-9]\)/\1/")
echo $TEMP | mail -s "Temperatur" $1
@tmeissner
tmeissner / raspifoto.sh
Created July 21, 2013 10:27
Take a foto with the camera board and save it under name with date in it
#!/bin/bash
raspistill -t 100 -vf -hf -q 50 -o $(date +%Y-%m-%d-%T).jpg
@tmeissner
tmeissner / raspiTemp.js
Last active December 20, 2015 08:49
draw a nice chart of measured temperatures with the help of highchart.js
// variable to en-/disable debug
// set to 1 to enable debug log
if (DEBUG === undefined) {
var DEBUG = 0;
}
// wrap all in anonymous function to get out of global scope
(function () {