Skip to content

Instantly share code, notes, and snippets.

View legrego's full-sized avatar

Larry Gregory legrego

View GitHub Profile
@legrego
legrego / bulk_index_country_codes.json
Created June 19, 2018 12:25
Elasticsearch bulk index country codes
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": {}}
@legrego
legrego / keybase.md
Created June 27, 2018 15:47
keybase.md

Keybase proof

I hereby claim:

  • I am legrego on github.
  • I am legrego (https://keybase.io/legrego) on keybase.
  • I have a public key ASBiVZwz8hEHv021pu4nOVbY2rSPxE5xVdXeJfZTtQiGVwo

To claim this, I am signing this object:

@legrego
legrego / instructions.md
Created February 27, 2019 19:25
Upgrade HASS
$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate
$ pip3 install --upgrade homeassistant
@legrego
legrego / route.ts
Created November 25, 2019 16:21
Using @kbn/config-schema to validate Legacy Platform routes
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()
});
@legrego
legrego / machine.js
Created March 23, 2020 18:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@legrego
legrego / instructions.md
Created February 27, 2019 19:19
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 example.domain.com):
  • hostname: the subdomain to use (ex: example)
  • username: the domain (ex: domain.com)
  • password: the auto-generated password from namecheap ddns setup
  • server: fixed: dynamicdns.park-your-domain.com
@legrego
legrego / har_instructions.md
Created August 19, 2019 12:52
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).