Skip to content

Instantly share code, notes, and snippets.

View hazeledmands's full-sized avatar

Hazel Edmands hazeledmands

View GitHub Profile
@hazeledmands
hazeledmands / otel-collector-config-compact-metrics.yaml
Last active July 23, 2021 18:53
Config creating compact metrics with otel collector
exporters:
otlp:
endpoint: api.honeycomb.io:443
headers:
x-honeycomb-team: $HNY_API_KEY
x-honeycomb-dataset: $HNY_DATASET
logging: {}
receivers:
hostmetrics:
collection_interval: 1m
@hazeledmands
hazeledmands / 1_request.txt
Last active June 9, 2021 23:56
OpenTelemetry Collector Hostmetrics Request Example
(*v1.ExportMetricsServiceRequest)(0xc0007a4300)(
resource_metrics:{
resource:{
attributes:{key:"host.name" value:{string_value:"vm2"}}
attributes:{key:"service.name" value:{string_value:"webserver"}
}
}
instrumentation_library_metrics:{
instrumentation_library:{}
metrics:{
@hazeledmands
hazeledmands / aasm.rb
Created September 9, 2019 22:15
Example of the aasm gem
aasm column: 'state' do
state :pending, initial: true
state :enqueued
state :cancelled
state :failed
event :enqueue do
transitions from: :pending, to: :enqueued
end
end
@hazeledmands
hazeledmands / disposer-with-timeout.js
Created May 4, 2016 18:50
Tests on bluebird disposers
const Promise = require('bluebird');
console.log('starting promise');
Promise.resolve()
.then(function () {
console.log('grabbing resource');
return Promise.using(getDisposer(), function () {
console.log('starting delay');
return Promise.delay(2000)
.then(function () {
@hazeledmands
hazeledmands / install_hooks.sh
Created December 26, 2015 00:14
Pre-commit hooks to prevent .only and console.log
#!/bin/sh
# this lives in ./scripts/install_hooks.sh
SCRIPT_DIR=$(cd $(dirname "${0}") && pwd -L)
if [ "${NODE_ENV:="development"}" != "development" ]; then
echo 'Not in dev'
exit 0
fi
pivotal = require 'pivotal'
fibrous = require 'fibrous'
shelljs = require 'shelljs'
slug = require 'slug'
humanparser = require 'humanparser'
token = # ????
projectId = # ???
name = # ???
@hazeledmands
hazeledmands / keybase.md
Last active September 8, 2019 01:02
Keybase proof

Keybase proof

I hereby claim:

  • I am maxedmands on github.
  • I am thismax (https://keybase.io/thismax) on keybase.
  • I have a public key ASAxShkGgiqKDdYqO7kkKmrHx0pLkkKIajUcePszNW6paAo

To claim this, I am signing this object:

@hazeledmands
hazeledmands / amqplib_firehose.coffee
Last active August 29, 2015 14:03
a simple AMQP firehose console logger
amqplib = require 'amqplib'
exec = require('child_process').exec
child = exec('rabbitmqctl trace_on')
child.stdout.pipe process.stdout
child.stderr.pipe process.stderr
connection = null
channel = null
@hazeledmands
hazeledmands / ui_sref_nested.coffee
Created January 15, 2014 15:50
ui-sref-nested implementation, while we wait for something to officially get rolled into angular-ui-router.
# Basically, ui-sref-active as implemented does not support nested states
# which is not particularly useful for many of the cases in this app.
#
# For more information take a look at this github issue:
# https://github.com/angular-ui/ui-router/issues/704
#
# And if it's fixed in core, then let's get rid of this directive! :D
app = angular.module 'lentilDirectives'
parseStateRef = (ref) ->
@hazeledmands
hazeledmands / setup.sh
Last active December 26, 2015 12:09
Initial, lightweight, suggested Goodeggs setup
### #### ### out-of-date! use https://github.com/goodeggs/developer-start ### ### ###
# download command line tools at https://developer.apple.com
# some tools will complain about not knowing where binaries are, until you do this:
sudo xcode-select --switch /
# set up a basic .profile
cat <<EOF > ~/.profile
export PATH="/usr/local/bin:$PATH"