Skip to content

Instantly share code, notes, and snippets.

View emidoots's full-sized avatar
😸
Herding cats

Emi emidoots

😸
Herding cats
View GitHub Profile
const std = @import("std");
const Allocator = std.mem.Allocator;
const Parser = @import("parser.zig").Parser;
const Error = @import("parser.zig").Error;
pub fn Literal(comptime Reader: type) type {
return struct {
parser: Parser([]u8, Reader) = .{
._parse = parse,
},
const std = @import("std");
const testing = std.testing;
const Reader = struct {
reader: anytype,
seekableStream: anytype,
};
const Node = struct {
value: isize,
panic(cpu 4 caller 0xffffff7f81fa1a8d): watchdog timeout: no checkins from watchdogd in 96 seconds (18327 total checkins since monitoring last enabled)
Backtrace (CPU 4), Frame : Return Address
0xffffff81f13c3c40 : 0xffffff800151a65d
0xffffff81f13c3c90 : 0xffffff8001654a75
0xffffff81f13c3cd0 : 0xffffff80016465fe
0xffffff81f13c3d20 : 0xffffff80014c0a40
0xffffff81f13c3d40 : 0xffffff8001519d27
0xffffff81f13c3e40 : 0xffffff800151a117
0xffffff81f13c3e90 : 0xffffff8001cc1ad8
0xffffff81f13c3f00 : 0xffffff7f81fa1a8d
--- FAIL: TestString (53.23s)
--- FAIL: TestString/comby_options (0.66s)
autogold.go:91: mismatch (-want +got):
--- want
+++ got
@@ -1 +1,4 @@
-[2]interface{}{&st.Query{}, &parse.Error{Offset: 13, Parsing: parse.NodeType(parse.NodeType)("OptionsFuzzy"), Message: ": valid options are (multiline, case), found delimiter"}}
+[2]interface{}{&st.Query{}, &parse.Error{
+ Offset: 13, Parsing: parse.NodeType(parse.NodeType)("OptionsFuzzy"),
+ Message: ": valid options are (multiline, case), found delimiter",
"t=2020-08-07T02:25:16+0000 lvl=eror msg=\"syntax highlighting failed (this is a bug, please report it)\" filepath=packages/shn-modal/src/shn-modal.vue repo_name=github.com/ShnHz/shn-ui revision=a65aa54d465fb508a7da1b40aec36e750ab59146 snippet=\"\\\"<template>\\\\n <div class=\\\\\\\"shn-modal\\\\\\\">\\\\n <transition name=\\\\\\\"shn-fade\\\\\\\">\\\\n <div\\\"?\" error=\"http://syntect-server:9238: syntect panic while highlighting\"\n"
"t=2020-08-07T02:24:16+0000 lvl=eror msg=\"syntax highlighting failed (this is a bug, please report it)\" filepath=packages/shn-preview-img/src/shn-preview-img.vue repo_name=github.com/ShnHz/shn-ui revision=a65aa54d465fb508a7da1b40aec36e750ab59146 snippet=\"\\\"<template>\\\\n <transition name=\\\\\\\"shn-fade\\\\\\\">\\\\n <div class=\\\\\\\"shn-preview-img\\\\\\\" v-if=\\\"?\" error=\"http://syntect-server:9238: syntect panic while highlighting\"\n"
"t=2020-08-07T02:23:56+0000 lvl=warn msg=\"syntax highlighting took longer than 3s, this *could* indicate a bug
This file has been truncated, but you can view the full file.
t=2020-06-23T20:47:31+0000 lvl=info msg="opentracing: TracePolicy" oldValue=none newValue=selective
t=2020-06-23T20:47:31+0000 lvl=info msg="opentracing: Jaeger enablement change" old=false newValue=true
t=2020-06-23T20:47:31+0000 lvl=dbug msg="detected frontend ready"
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-11.gitserver:3178 path=/ping code=200 duration=97.988894ms
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-0.gitserver:3178 path=/ping code=200 duration=100.078616ms
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-10.gitserver:3178 path=/ping code=200 duration=98.487071ms
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-2.gitserver:3178 path=/ping code=200 duration=99.918674ms
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-5.gitserver:3178 path=/ping code=200 duration=100.081071ms
t=2020-06-23T20:47:31+0000 lvl=dbug msg="TRACE gitserver" host=gitserver-8.gitserver:3178 path=
@emidoots
emidoots / cadvisor_hack.md
Last active November 2, 2021 11:16
cAdvisor's missing `container_restart_count` metric

Problem: cAdvisor's missing container_restart_count metric

cAdvisor doesn't monitor container restarts, but it does pass through / expose the Docker label container_restart_count to you.

Unfortunately, being a label, you cannot really monitor it. And it looks like this isn't something cAdvisor plans to support soon, as the issue has been closed.

Solution

I am not proud of this and hope cAdvisor will support this more easily in the future, but, it does work well. Here is a Prometheus rule you can use to define this metric.

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@emidoots
emidoots / regex.go
Created January 23, 2020 05:46
Go | Golang | Regex replace all byte submatches | regexp.ReplaceAllSubmatchFunc |
// replaceAllSubmatchFunc is the missing regexp.ReplaceAllSubmatchFunc; to use it:
//
// pattern := regexp.MustCompile(...)
// data = replaceAllSubmatchFunc(pattern, data, func(groups [][]byte) [][]byte {
// // mutate groups here
// return groups
// })
//
// This snippet is MIT licensed. Please cite by leaving this comment in place. Find
// the latest version at:
package main
import (
"fmt"
"time"
"golang.org/x/crypto/bcrypt"
)
func main() {