Skip to content

Instantly share code, notes, and snippets.

🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.

Patrick Mueller pmuellr

🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.
Block or report user

Report or block pmuellr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pmuellr
pmuellr / alertsx100.sh
Last active Jul 3, 2019
create 100 alerts in Kibana
View alertsx100.sh
#!/usr/bin/env bash
# get the ids of all the current alerts, for xargs
# kbn-alert ls | jq ".[] | .id"
# delete all the current alerts
# kbn-alert ls | jq ".[] | .id" | xargs -L 1 kbn-alert delete
export KIBANA_BASE=zgj
export ACTION_ID=2461a6ad-59f4-4381-8284-87184ce3e9a5
@pmuellr
pmuellr / generic-kibana-rfc.md
Created Jul 2, 2019
generic template for Kibana RFCs
View generic-kibana-rfc.md
  • Start Date: 20yy-mm-dd
  • RFC PR: (leave this empty)
  • Kibana Issue: TBD

Summary

@pmuellr
pmuellr / index.ts
Created Jun 26, 2019
Kibana plugin for functional test server to run raw action type executors
View index.ts
// path: x-pack/test/api_integration/fixtures/plugins/action_runner/index.ts
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import Joi from 'joi';
@pmuellr
pmuellr / async-early-return.js
Last active Jul 3, 2018
see what async functions return when returning early, and after an await
View async-early-return.js
'use strict'
async function delay (ms) {
return new Promise((resolve, reject) => setTimeout(resolve, ms))
}
async function foo (returnEarly) {
if (returnEarly) return new Date()
await delay(1000)
@pmuellr
pmuellr / throwing-catching-logging.js
Created May 10, 2018
see what stack traces look like for nested async await calls
View throwing-catching-logging.js
'use strict'
const states = 'abcde'.split('') // [ 'a', 'b', ... ]
async function main () {
for (let state of states) {
try {
await a(state)
} catch (err) {
console.log(`state: ${state}`, err)
@pmuellr
pmuellr / nscm-network-debugging.md
Last active Apr 12, 2018
nscm network debugging
View nscm-network-debugging.md

nscm network debugging

HTTP(S)_PROXY env vars

$ set | grep -i HTTP

print nscm config

@pmuellr
pmuellr / weather-data-info.txt
Created Jan 2, 2018
weather data from api.weather.gov
View weather-data-info.txt
weather forecast from api.weather.gov:
given geolocation:
GET https://api.weather.gov/points/35.6912,-78.8012
extract:
properties.forecastGridData: eg, https://api.weather.gov/gridpoints/RAH/67,53
properties.relativeLocation.properties.city, eg, "Holly Springs"
View observable-object.js
'use strict'
module.exports = create
// Observable Objects are objects which contain properties for which you can
// observe changes.
//
// To create an ObservableObject, use:
// observableObject = ObservableObject.create()
//
@pmuellr
pmuellr / rpromise.js
Last active Sep 26, 2017
Promise class that returns promises that can be directly resolved or rejected via `.resolve(data)` or `.reject(data)`
View rpromise.js
'use strict'
// prints "0ms", then "1000ms", then "2000ms", ...
function main () {
for (let i = 0; i < 5; i++) {
const pr = new RPromise()
const millis = i * 1000
setTimeout(() => pr.resolve(`${millis}ms`), millis)
pr.then(data => console.log(data))
View profile.d.ts
interface Profile {
meta: Meta
nodes: Node []
scripts: Script []
pkgs: Pkg []
urlBase: string // common full url across packages and mainModule
totalTime: number // microseconds
maxSelfTime: number // microseconds
maxTotalTime: number // microseconds
}
You can’t perform that action at this time.