Skip to content

Instantly share code, notes, and snippets.

💭
Grinning; It works! XamarinForms Mqtt secure mosquitto broker connection.

Jeff Albrecht jhalbrecht

💭
Grinning; It works! XamarinForms Mqtt secure mosquitto broker connection.
View GitHub Profile
@jhalbrecht
jhalbrecht / Readme.md
Last active Jul 9, 2019 — forked from sarmis/foldergallery.html
Justified Image Gallery as Hugo shortcode
View Readme.md

Forked and making some changes to better support how I'm using page resources in a Hugo Page bundle.

Usage { {< foldergallery src="imgs" >} } I changed this to;

{ {< foldergallery src="." >} } Which picks up all the files in my leaf page bundle including index.md

I want to change the "imgs" in the shortcode to something like;

{{ with .Resources.ByType "image" }}

@jhalbrecht
jhalbrecht / PirParts.yaml
Created Jun 12, 2019
Home assistant sonoff tasmota rf bridge pir configuratiion
View PirParts.yaml
# binary_sensors.yaml
- platform: template
sensors:
test_pir_00:
value_template: '{{ is_state("sensor.sonoff_rf_bridge", "EA0FDE") }}'
# delay_off: '00:05:30'
delay_off: '00:00:30'
device_class: motion
friendly_name: "PIR One"
@jhalbrecht
jhalbrecht / HomeAssistantRfButtonStuff.yaml
Created Dec 10, 2018
Home Assistant sensor and automation .yaml to toggle a SonOff light with a 433mhz RF Bridge w/tasmota for the buttons...
View HomeAssistantRfButtonStuff.yaml
Given this topic make sensor/button unique in this working example any button on that topic will fire the automation.
tele/homeamation/sonoff02/STATE {"Time":"2018-12-10T16:30:27","Uptime":"30T22:46:46","Vcc":3.121,"POWER":"OFF","Wifi":{"AP":1,"SSId":"ADP","BSSId":"F8:32:E4:AE:00:F8","Channel":3,"RSSI":100}}
# commented lines are failed attempts
in sensors....
#
# button
#
# 12/9/2018
@jhalbrecht
jhalbrecht / mqttclient.cs
Last active Nov 4, 2017 — forked from mauroa/mqttclient
System.Net.Mqtt client sample
View mqttclient.cs
//Note that you can set more properties and also not set the port,
//in which case the MQTT default will be used
var configuration = new MqttConfiguration { Port = 55555 };
//Creation of the MQTT client
var client = await MqttClient.CreateAsync("192.168.1.29", configuration);
//MQTT connection of the client. You can pass optional args to the
//ConnectAsync method and credentials
await client.ConnectAsync(new MqttClientCredentials("testClient"));
View adafruit beaglebone cape universal spi pin config.txt
Here is example of configuring the SPI0 pins.
First, verify cape unverisal is loaded:
[quote]
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
@jhalbrecht
jhalbrecht / LinqPadBogusDemo.cs
Created Feb 8, 2017
Worked up a nice seed of fake data in LinqPad before implementing in my Visual Studio solution.
View LinqPadBogusDemo.cs
void Main()
{
var playlists = PlayListFaker.Generator.Generate(5).ToList();
playlists.Dump();
}
public class PlayListFaker : PlayList
{
static Random random = new Random();
public static Faker<PlayList> Generator
@jhalbrecht
jhalbrecht / til311.js
Created Feb 9, 2015
til311 demo in bonescript
View til311.js
/*
Jeff Albrecht February 9, 2015
An experiment to display digits on a Texas Instruments TIL311. And practice my .js
http://www.ti.com/lit/ds/symlink/til311.pdf
Not implemented in this til311 experiment
left and right decimal points
configurable blank leading zeros
@jhalbrecht
jhalbrecht / J5TennisBall.js
Last active Dec 28, 2015 — forked from rwaldron/J5TennisBall.js
This is @rwaldron suggestion (unTested) for me to learn a bit better coding style. Removing some of Rick's "Nit's" See lines 18, 21 for my additions, and 37 for pesky error (fixed).
View J5TennisBall.js
var j5 = require("johnny-five"),
board = new j5.Board();
board.on("ready", function () {
var ping, button, lights, ginches, lowerLimit, offset;
ping = new j5.Ping({
pin: 8,
freq: 250
});
@jhalbrecht
jhalbrecht / check_temperature_wo
Created Aug 17, 2013
Plugin for Nagios I wrote to monitor temperature data from sensors serving XML in homeAmation format. See: http://homeamation/azurewebsites.net
View check_temperature_wo
#!/bin/env python
'''
Created on Jan 21, 2012
@author: jeffa aka @jhalbrecht
'''
# jha 8/17/2013
# Prepare code for publishing.
@jhalbrecht
jhalbrecht / HeadsOrTailsToColorConverter.cs
Last active Dec 17, 2015
This ValueConverter expects a string of either "Heads" or "Tails" and returns Green or Red respectively or yellow as a default or unknown value. I use it in a Windows Store Application, "Decisive" to color the text result of a coin toss. I've been using a long weekend as a sprint to focus on learning VS2012 and blend design tools. Blend made it …
View HeadsOrTailsToColorConverter.cs
using System;
using Windows.UI;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace Decisive.Common
{
public sealed class HeadsOrTailsToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
You can’t perform that action at this time.