Skip to content

Instantly share code, notes, and snippets.

@stuartnelson3
stuartnelson3 / bash_strict_mode.md
Created April 11, 2022 10:31 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@stuartnelson3
stuartnelson3 / elastic-agent.yml
Created August 3, 2021 10:26
example elastic-agent config file
id: bd9ca420-f0ad-11eb-82bc-a1d739a667fe
revision: 1
outputs:
default:
type: elasticsearch
hosts:
- 'http://localhost:9200'
username: admin
password: changeme
output_permissions:
@stuartnelson3
stuartnelson3 / elastic-agent-apm-server.json
Last active July 26, 2021 16:24
Comparison of legacy xpack monitoring output to the currently available metrics from elastic-agent managing apm-server
{
"_index": ".ds-metrics-elastic_agent.elastic_agent-default-2021.07.21-000001",
"_id": "nX1gynoB54y3ZSSKBgXb",
"_score": 1,
"_source": {
"agent": {
"name": "47814b6747ad",
"id": "a8072f99-82a2-4c63-b502-177324189638",
"ephemeral_id": "5a125964-4a16-41fe-bf97-341af5bc2964",
"type": "metricbeat",
@stuartnelson3
stuartnelson3 / reverse_proxy.go
Created July 14, 2021 21:25
reverse proxy to intermittently interrupt requests to /_xpack
package main
import (
"log"
"math/rand"
"net/http"
"net/http/httputil"
"net/url"
"time"
)
@stuartnelson3
stuartnelson3 / otel.go
Last active July 19, 2021 13:08
Example go otel server
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@stuartnelson3
stuartnelson3 / retrigger_retry.go
Created March 24, 2021 16:19
trigger retries by responding with a retryable status code
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("got request")
@stuartnelson3
stuartnelson3 / path_timing_server.go
Last active March 16, 2021 16:56
sample file for logging incoming requests and timing between requests
package main
import (
"log"
"net/http"
"time"
)
func main() {
// Map to record timings between different paths
@stuartnelson3
stuartnelson3 / output.txt
Created September 12, 2018 14:02
fwupdtool output
# sudo /usr/lib/fwupd/fwupdtool --verbose --plugin-whitelist=uefi get-devices --show-all-devices
(fwupdtool:11427): As-DEBUG: 16:01:48.106: run FuEngine:load
(fwupdtool:11427): Fu-DEBUG: 16:01:48.106: loading config values from /etc/fwupd/daemon.conf
(fwupdtool:11427): Fwupd-DEBUG: 16:01:48.107: looking for os-release at /etc/os-release
(fwupdtool:11427): As-DEBUG: 16:01:48.107: run AsStore:load-installed{/usr/share/fwupd/metainfo}
(fwupdtool:11427): As-DEBUG: 16:01:48.107: adding existing file: /usr/share/fwupd/metainfo/org.freedesktop.fwupd.remotes.lvfs-testing.metainfo.xml
(fwupdtool:11427): As-DEBUG: 16:01:48.107: adding existing file: /usr/share/fwupd/metainfo/org.freedesktop.fwupd.remotes.lvfs.metainfo.xml
(fwupdtool:11427): As-DEBUG: 16:01:48.109: Emitting ::changed() [load-installed]
(fwupdtool:11427): Fu-DEBUG: 16:01:48.109: using config path of /etc/fwupd
(fwupdtool:11427): Fu-DEBUG: 16:01:48.109: loading config from /etc/fwupd/remotes.d/lvfs.conf
@stuartnelson3
stuartnelson3 / memberlist.go
Last active June 1, 2018 15:52
Probability of a peer in memberlist not receiving a message
// Modeled on
// https://github.com/hashicorp/memberlist/blob/0b981/state.go#L478-L501
package main
import (
"fmt"
"math"
"math/rand"
)
@stuartnelson3
stuartnelson3 / Cargo.toml
Last active July 18, 2017 22:32
borrowing + lifetime issues
[package]
name = "rust_learning"
version = "0.1.0"
authors = ["Stuart Nelson <stuartnelson3@gmail.com>"]
[dependencies]
prometheus = "0.2"