Skip to content

Instantly share code, notes, and snippets.

View emidoots's full-sized avatar
😸
Herding cats

Emi emidoots

😸
Herding cats
View GitHub Profile
// +build ignore
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"facebook/create-react-app",
"reduxjs/redux",
"GoogleChrome/puppeteer",
"trekhleb/javascript-algorithms",
"30-seconds/30-seconds-of-code",
"zeit/next.js",
"yarnpkg/yarn",
"storybooks/storybook",
"thedaviddias/Front-End-Checklist",
"NARKOZ/hacker-scripts",

breakdown of changes between current staging version (3.3.5) -> 3.3.7

3.4.0 (unreleased)

Added

Fixed

[ec2-user@ip-10-0-0-145 zoekt-shared-disk]$ pwd
/data/zoekt-shared-disk
[ec2-user@ip-10-0-0-145 zoekt-shared-disk]$ du -m -a | sort -n
0 ./.trash
1 ./50.112.230.151%2FTEST%2F00benallen--gui_core_00_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F057a3dd61f99517a3afea0051a49cb27994f94d--rslinux_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F0ang3el--hibernate-injection-study_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F0ovicero0--serverspeeder_install_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F0ovicero0--serverspeeder_install_v15.00001.zoekt
1 ./50.112.230.151%2FTEST%2F0rkgrrr1--hello-world_v15.00000.zoekt
This file has been truncated, but you can view the full file.
[ec2-user@ip-10-0-0-145 zoekt-shared-disk]$ pwd
/data/zoekt-shared-disk
[ec2-user@ip-10-0-0-145 zoekt-shared-disk]$ du -m -a | sort -n
0 ./.trash
1 ./50.112.230.151%2FTEST%2F00benallen--gui_core_00_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F00benallen--gui_core_00_v16.00000.zoekt
1 ./50.112.230.151%2FTEST%2F057a3dd61f99517a3afea0051a49cb27994f94d--rslinux_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F057a3dd61f99517a3afea0051a49cb27994f94d--rslinux_v16.00000.zoekt
1 ./50.112.230.151%2FTEST%2F0ang3el--hibernate-injection-study_v15.00000.zoekt
1 ./50.112.230.151%2FTEST%2F0ang3el--hibernate-injection-study_v16.00000.zoekt
CREATE EXTENSION IF NOT EXISTS dblink;
CREATE OR REPLACE FUNCTION remote_exec(suffix text, query text) RETURNS void AS $$
BEGIN
PERFORM dblink_exec('dbname=' || current_database() || suffix || ' password=MYPASSWORD user=' || current_user, query);
END;
$$
LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION create_lsif_db() RETURNS void AS $$
package main
import (
"fmt"
"time"
"golang.org/x/crypto/bcrypt"
)
func main() {
@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:
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@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.