Skip to content

Instantly share code, notes, and snippets.

View dechamps's full-sized avatar

Etienne Dechamps dechamps

View GitHub Profile
@dechamps
dechamps / spec.json
Created June 28, 2020 16:34
Vega-Lite spec from Sun Jun 28 2020
{
"config": {
"view": {"continuousWidth": 400, "continuousHeight": 300, "opacity": 0}
},
"vconcat": [
{
"data": {"name": "data-9a3bc27729824677a04f57dcb5a098d3"},
"facet": {"type": "nominal", "field": "speaker", "title": null},
"spec": {
"layer": [
@dechamps
dechamps / atlas2006.sitemap
Created December 22, 2019 18:10
Example OpenHAB BACnet configuration (Atlas 2006)
// /etc/openhab2/sitemap/atlas2006.sitemap
sitemap atlas2006 label="Atlas 2006" {
Frame {
Switch item=Atlas2006_Presence label="Presence" icon="presence"
}
Frame label="Living Room" {
Text item=Atlas2006_HVAC_RoomTemperature_Living_eTCH label="Temperature [%.1f °C]" icon="feels_like_temperature"
Setpoint item=Atlas2006_HVAC_Setpoint_Living label="Setpoint [%.1f °C]" icon="setpoint" minValue=18 maxValue=26 step=0.5
Switch item=Atlas2006_HVAC_RunStatus_Living label="HVAC" icon="switch"
@dechamps
dechamps / bac0-exporter.py
Last active April 19, 2024 02:36
A Prometheus exporter for BACnet device properties using the BAC0 library.
#!/usr/bin/python3 -u
import argparse
argument_parser = argparse.ArgumentParser('Run the HVAC BAC0 server')
argument_parser.add_argument('--local-address', help='local IP address to bind to', required=True)
argument_parser.add_argument('--local-port', help='UDP port to bind to')
argument_parser.add_argument('--bbmd-address', help='IP:port of the BACnet BBMD to register against, if any')
argument_parser.add_argument('--bbmd-ttl', help='TTL of the BACnet foreign device registration, in seconds', type=int)
argument_parser.add_argument('--bacnet-network', help='BACnet network to discover devices on; can be specified multiple times', type=int, action='append', required=True)
argument_parser.add_argument('--prometheus-port', help='Serve Prometheus metrics on this port', type=int)
@dechamps
dechamps / bfr.xml
Created December 22, 2019 16:18
Example BFR Configuration for routing between BACnet/Ethernet and BACnet/IP
<BFR>
<!-- Example configuration for a BACnet/Ethernet <-> BACnet/IP router -->
<!-- Note: this config has a number of Debug statements to make troubleshooting easier. In production use you'll likely want to remove them. -->
<!-- Replace "eth0" with the name of the network interface that is attached to the BACnet/Ethernet network. -->
<Ethernet server="hvac-eth" device="eth0" />
<Debug server="hvac-eth-debug" client="hvac-eth" prefix="hvac-eth" />
<!-- Replace "192.168.1.2" with the IP address of your machine. -->
<!-- Make sure to use the correct subnet length, otherwise broadcasts won't work. -->
[ 0.000000] microcode: microcode updated early to revision 0x2d, date = 2018-02-07
[ 0.000000] Linux version 4.17.0-1-amd64 (debian-kernel@lists.debian.org) (gcc version 7.3.0 (Debian 7.3.0-26)) #1 SMP Debian 4.17.8-1 (2018-07-20)
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.17.0-1-amd64 root=ZFS=zyklos/durable/system ro boot=zfs zfs_force=1 panic=3600 consoleblank=0 root=ZFS=zyklos/durable/system
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
@dechamps
dechamps / lux.json
Created October 14, 2017 14:13
Domoticz V3.8153 LUX sensor JSON output
{
"ActTime": 1507990266,
"ServerTime": "2017-10-14 15:11:06",
"Sunrise": "07:24",
"Sunset": "18:08",
"result": [
{
"AddjMulti": 1,
"AddjMulti2": 1,
"AddjValue": 0,
grub-probe: info: cannot open `/boot/grub/device.map': No such file or directory.
grub-probe: info: /dev/sdd1 is not present.
grub-probe: info: Looking for /dev/sdd1.
grub-probe: info: /dev/sdd is a parent of /dev/sdd1.
grub-probe: info: /dev/sdd1 starts from 2048.
grub-probe: info: opening the device hostdisk//dev/sdd.
grub-core/kern/disk.c:196: Opening `hostdisk//dev/sdd'...
grub-probe: info: drive = 0.
grub-probe: info: the size of hostdisk//dev/sdd is 5860533168.
grub-core/kern/disk.c:196: Opening `hostdisk//dev/sdd'...
@dechamps
dechamps / tap-win32-test.c
Last active December 7, 2020 00:20
TAP-Win32 trivial test program
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include "tap-windows.h"
static void winerror(const char* message)
{
int err = GetLastError();
fprintf(stderr, "%s: (%d) ", message, err);
FSTYP -- zfs
PLATFORM -- Linux/x86_64 zyklos 3.11-1-amd64
MKFS_OPTIONS -- -f -O mountpoint=legacy /dev/sdi2
MOUNT_OPTIONS -- /dev/sdi2 /scratch
generic/001 2s ... 2s
generic/002 0s ... 0s
generic/005 1s ... 0s
generic/006 1s ... 0s
generic/007 1s ... 1s
@dechamps
dechamps / msync-multisize.c
Created November 9, 2013 19:42
Sample program that exhibits extremely slow msync() on ZFS.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>