Skip to content

Instantly share code, notes, and snippets.


Larry Gregory legrego

View GitHub Profile
legrego /
Created Aug 19, 2019
Kibana HAR Instructions

A HAR archive of the network timings from a compatible browser is extremely useful in pinpointing which issues with Kibana talking to Elasticsearch.

Note on information gathered in a HAR archive

Please note that HAR archives contain sensitive information:

  • content of the pages you downloaded while recording
  • your cookies, which will allow anyone with the HAR file to impersonate your account
  • all the information that you submitted to your browser while recording (i.e., search values, authentication details).
legrego /
Created Feb 27, 2019
Unifi Dynamic DNS using namecheap
  1. Get public IP via dyndns. Otherwise, a NAT'd USG will try to publish the internal IP instead of the true external one. This will need to be rerun anytime the controller re-provisions the USG :( set service dns dynamic interface eth0 web dyndns
  2. Configure DDNS service in Controller UI (examples assume
  • hostname: the subdomain to use (ex: example)
  • username: the domain (ex:
  • password: the auto-generated password from namecheap ddns setup
  • server: fixed:
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
legrego / route.ts
Created Nov 25, 2019
Using @kbn/config-schema to validate Legacy Platform routes
View route.ts
import { schema } from '@kbn/config-schema';
function defineMyRoute(server) {
const routeValidationSchema = schema.object({
foo: schema.string(),
bar: schema.maybe(schema.number({ min: 2, max: 200 })),
baz: schema.boolean()
$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate
$ pip3 install --upgrade homeassistant

Keybase proof

I hereby claim:

  • I am legrego on github.
  • I am legrego ( on keybase.
  • I have a public key ASBiVZwz8hEHv021pu4nOVbY2rSPxE5xVdXeJfZTtQiGVwo

To claim this, I am signing this object:

legrego / bulk_index_country_codes.json
Created Jun 19, 2018
Elasticsearch bulk index country codes
View bulk_index_country_codes.json
post country-data/doc/_bulk
{"index": {}}
{"name": "Afghanistan", "code": "AF"}
{"index": {}}
{"name": "Åland Islands", "code": "AX"}
{"index": {}}
{"name": "Albania", "code": "AL"}
{"index": {}}
{"name": "Algeria", "code": "DZ"}
{"index": {}}