Skip to content

Instantly share code, notes, and snippets.

View rbaarda's full-sized avatar

Robert Baarda rbaarda

View GitHub Profile
@rbaarda
rbaarda / hs110-data-collect.py
Created November 19, 2017 22:43
Python3 script which collects data from a HS110 power plug and tries to send it to a local Graphite instance.
import sys
import time
import socket
import json
import threading
# https://stackoverflow.com/questions/21017698/converting-int-to-bytes-in-python-3
def int_to_bytes(x):
return x.to_bytes((x.bit_length() + 7) // 8, 'big')
@rbaarda
rbaarda / BlockViewModel.cs
Created April 24, 2015 19:27
EPiServer default block controller plus block preview controller which uses block type name as controller name in view location.
using System;
using EPiServer;
using EPiServer.Core;
namespace Example.Models.ViewModels
{
public class BlockViewModel<TBlock> : IBlockViewModel<TBlock> where TBlock : BlockData
{
public TBlock CurrentBlock { get; private set; }
@rbaarda
rbaarda / DefaultPageController.cs
Last active August 29, 2015 14:19
EPiServer default page controller which uses page type name as controller name in view locations.
using System.Web.Mvc;
using Example.Models.ViewModels;
using EPiServer;
using EPiServer.Core;
using EPiServer.Framework.DataAnnotations;
using EPiServer.Web.Mvc;
namespace Example.Controllers.Pages
{