Skip to content

Instantly share code, notes, and snippets.

@georgeh
georgeh / configuration.yaml
Last active May 22, 2022
DTE Insight Home Assistant configuration
View configuration.yaml
sensor:
# Read in DTE Insight via MQTT. You can add an MQTT integration in Home Assistant with the DTE Insight's IP address on port 2883
- platform: mqtt # this is my DTE Insight, if you have multiple MQTT servers this might be different
name: Instant Energy Usage
state_topic: "event/metering/instantaneous_demand"
unit_of_measurement: W
value_template: "{{ value_json.demand }}"
state_class: measurement
device_class: energy
@georgeh
georgeh / server.js
Last active Jun 9, 2021
CSV logging server
View server.js
/**
* Usage: node server.js foo.csv
*
* Test with: curl -d "{\"Foo\":1,\"Bar\":\"baz\"}" -X POST http://localhost:8000/
*
*/
const http = require('http');
const fs = require('fs');
const fsPromises = require('fs/promises');
View index.js
/**
* External dependencies
*/
import { times, property, omit } from 'lodash';
import classnames from 'classnames';
import memoize from 'memize';
/**
* WordPress dependencies
*/
View tabletop.csv
Name Sale Price Original Price Discount
5 Second Rule $13.50 $24.99 45.98%
7 Wonders $28.00 $49.99 43.99%
7 Wonders: Duel $18.49 $29.99 38.35%
A Column of Fire: The Game $26.17 $49.95 47.61%
Adventure Time Card Wars Doubles Tournament Card Game $18.70 $35.00 46.57%
Arcadia Quest Board Game $52.99 $99.99 47.00%
Arcadia Quest Frost Dragon Board Game $19.99 $29.99 33.34%
Arcadia Quest: Chaos Dragon Board Game $21.66 $29.99 27.78%
Arcadia Quest: Fire DRAGON Board Game $22.10 $29.99 26.31%
View .babelrc
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime",
"transform-es3-property-literals",
"transform-es3-member-expression-literals"
]
}
View rssgopher.py
#!/usr/local/Python-2.4/bin/python
import feedparser, html2text, os, sys
from textwrap import fill
feed = feedparser.parse("http://george.hotelling.net/index.xml")
filepath = "~/public_html/gopher"
i = 0
for entry in feed['entries']:
View keybase.md

Keybase proof

I hereby claim:

  • I am georgeh on github.
  • I am georgeh (https://keybase.io/georgeh) on keybase.
  • I have a public key whose fingerprint is ED13 EEA2 0284 5625 147D 0D6A 8175 515C 8175 D485

To claim this, I am signing this object:

@georgeh
georgeh / gist:8317224
Created Jan 8, 2014
Angular dependency injection
View gist:8317224
angular.module('module')
.factory('myService', function($scope, $http, otherService) {
// ...
});
// is the same as
angular.module('module')
.factory('myService', ['$scope', '$http', 'otherService', function(scopy, ಠ_ಠ, $scope) {
// scopy == Angular's $scope
// ಠ_ಠ == Angular's $http
@georgeh
georgeh / values.dot
Created Oct 11, 2013
Compare PHP values for truthiness - to generate http://i.imgur.com/B8R3PVK.png
View values.dot
graph values {
"''" -- "0"
"''" -- "0.0"
"''" -- "false"
"''" -- "null"
"'0'" -- "'0.0'"
"'0'" -- "0"
"'0'" -- "0.0"
"'0'" -- "false"
"'0.0'" -- "0"