Skip to content

Instantly share code, notes, and snippets.

esphome:
name: "sensibo-sky"
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
@davehng
davehng / restartos.sh
Created May 20, 2021 23:02
bash script to restart opensprinkler
#!/bin/bash
echo `date`: Rebooting opensprinkler >> /home/user/sandbox/os/log.txt
curl -s "http://192.168.1.20:80/cv?pw=[md5hashedpassword]&rbt=1" >> /home/user/sandbox/os/log.txt
echo >> /home/user/sandbox/os/log.txt
@davehng
davehng / deleteoslogs.sh
Created May 20, 2021 23:00
bash script to delete opensprinkler logs more than a week old
#!/bin/bash
# os wants dates in epoch time divided by 86400 (86400 = 1 day)
# we want to ensure that logs are only kept on the OS for a week, so get the epoch date one week ago and ask OS to delete logs for that day
epochdate=`date --date="1 week ago" +%s`
osdate=$((epochdate / 86400))
echo `date`: Deleting logs for `date --date="1 week ago"`: $epochdate / 86400 = $osdate >> /home/user/sandbox/os/log.txt
# replace ip address and [md5hashedpassword] with your opensprinkler's details
curl -s "http://192.168.1.20:80/dl?pw=[md5hashedpassword]&day=$osdate" >> /home/user/sandbox/os/log.txt
echo >> /home/user/sandbox/os/log.txt
@davehng
davehng / gist:062dbe64de15c333d702
Created December 30, 2014 00:17
StructureMap registration to register NHibernate Linq IQueryables for all entity types
/// <summary>
/// Creates registrations for NHibernate implementations of IQueryable<> for all derivatives of Entity.
/// </summary>
public class QueryableRegistrationConvention : IRegistrationConvention
{
private static readonly ILog Log = LogManager.GetLogger(typeof(QueryableRegistrationConvention));
private static readonly Type OpenQueryableType = typeof(IQueryable<>);
public void Process(Type type, Registry registry)