Skip to content

Instantly share code, notes, and snippets.

Kyle Brandt kylebrandt

Block or report user

Report or block kylebrandt

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
@kylebrandt
kylebrandt / dumpResponseToFile.go
Created Aug 6, 2019
Dump HTTP Req -- appending to file
View dumpResponseToFile.go
func dumpResponseToFile(resp *http.Response, filename string) error {
dump, err := httputil.DumpResponse(resp, true)
if err != nil {
return err
}
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
return err
}
@kylebrandt
kylebrandt / bosun.json5
Last active Jan 25, 2019
Bosun VSCode Snippets
View bosun.json5
{
// Place your snippets for bosun here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@kylebrandt
kylebrandt / i3hangout.md
Last active Jul 29, 2019
i3 Hangout / Meet VLC screensharing workaround mutli-monitor
View i3hangout.md

Share an area of your screen by using vlc screen capture, and then sharing the vlc capture window

Make sure the VLC window floats

In i3 config:

for_window [window_role="vlc-video"] floating enable move down 100px;

We float it so the tiling window manager doesn't resize the window and mess up the scale. We also move the window placement down at launch so it easy to drag somewhere mostly offscreen.

View gist:85ab9ff0cb4f61394b7796e429ca25dc
slack = `
{{- $attachments := makeSlice -}}
{{- /* Set some slack properties on the attachment */ -}}
{{- $fallback := printf "Alert on %v" .Alert.Vars.url_host -}}
{{- $title := printf "%v: HTTPUnit Check for %v returned error(s)" .Last.Status .Alert.Vars.url_host -}}
{{- $ts := .LastAbnormalTime.Unix -}}
{{- $color := "good" -}}
{{- if .Last.Status.IsWarning -}}
{{- $color = "warning" -}}
@kylebrandt
kylebrandt / ghook.go
Last active Oct 30, 2018
Bosun git saving and pulling
View ghook.go
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"<replaceme>/bogit/util"
)
@kylebrandt
kylebrandt / docker.sh
Last active Jun 8, 2018
Bosun Data in ES PoC
View docker.sh
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.5.3 && docker run -d -p 5601:5601 --net=host -e "ELASTICSEARCH_URL=http://localhost:9200" docker.elastic.co/kibana/kibana:5.5.3
@kylebrandt
kylebrandt / linelrforecastlr.txt
Created May 30, 2018
Bosun Expr: linelr based on forecastlr
View linelrforecastlr.txt
# Only works for single result in series due to ungroup()
$q = q("sum:hbase.region.percentFilesLocal{host=literal_or(co-tsdb05)}", "20m", "")
$to100 = tod(ungroup(forecastlr($q, 100)))
$line = linelr($q, $to100)
merge($q, $line)
View kernel.txt
Apr 18 09:11:11 kbrandtlx kernel: perf: interrupt took too long (4966 > 4957), lowering kernel.perf_event_max_sample_rate to 40250
Apr 18 13:29:38 kbrandtlx kernel: pciehp 0000:00:03.0:pcie004: Slot(5-3): Link Down
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: AER: Multiple Uncorrected (Fatal) error received: id=0018
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: PCIe Bus Error: severity=Uncorrected (Fatal), type=Transaction Layer, id=0018(Requester ID)
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: device [8086:0e08] error status/mask=00004020/00000000
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: [ 5] Surprise Down Error (First)
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: [14] Completion Timeout
Apr 18 13:29:38 kbrandtlx kernel: pcieport 0000:00:03.0: broadcast error_detected message
Apr 18 13:29:38 kbrandtlx kernel: radeon 0000:06:00.0: device has no AER-aware driver
Apr 18 13:29:38 kbrandtlx kernel: snd_hda_intel 0000:06:00.1: device ha
@kylebrandt
kylebrandt / limb.go
Created Nov 26, 2017
drum limb combinations
View limb.go
package main
import (
"fmt"
"math/bits"
"sort"
)
type Limb byte
@kylebrandt
kylebrandt / gist:536300a5b1d6208394b264736ed76612
Last active Oct 12, 2017
Draft of Port-Channel Admin/Oper Alert
View gist:536300a5b1d6208394b264736ed76612
template network.nexus.portchannel.bad {
subject = {{.Last.Status}}: {{.Eval .Alert.Vars.upDownByHost | printf "%.f" }} down Port-Channels on {{.Group.host}}
body = `{{ template "header" . }}
{{/* source is http://www.net-snmp.org/docs/mibs/interfaces.html . Oper and Admin are actually different in that Admin only includes up/down/testing. However, 1, 2, 3 of Oper status is the same as the first 3 of admin status, so the same map can be used */}}
{{ $statusReference := makeMap "1" "up" "2" "down" "3" "testing" "4" "unknown" "5" "dormat" "6" "not present" "7" "lowerLayerDown" }}
{{ $joinResult := .LeftJoin .Alert.Vars.adminUpAndOperDown .Alert.Vars.operStatus .Alert.Vars.adminStatus }}
{{ if notNil $joinResult }}
<h2>Port-Channels with Non-Healthy Status</h2>
You can’t perform that action at this time.