Skip to content

Instantly share code, notes, and snippets.

Greg gdvalle

Block or report user

Report or block gdvalle

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
gdvalle / nginx_stub_status.lua
Created Jun 24, 2019
Record Prometheus metrics from nginx stub_status module using
View nginx_stub_status.lua
-- A module to export Prometheus metrics from nginx stub_status module.
local ngx = ngx
local ngx_var = ngx.var
local prometheus = prometheus
local select = select
local tonumber = tonumber
local find = string.find
local capture = ngx.location.capture
local log = ngx.log
local ERR = ngx.ERR
gdvalle /
Created Jun 23, 2019
Delete extracted mkv files alongside rar parts.
#!/usr/bin/env python3
import os
import sys
assert sys.version_info[:2] >= (3, 6), "Requires Python 3.6+"
def walk_dir(directory):
for root, dirs, files in os.walk(directory):
gdvalle /
Created Jun 17, 2019
List all GCP IPv4 network blocks using the cloud-netblocks TXT records.
import json
from dns.resolver import Resolver
dns_resolver = Resolver()
def _parse_netblock_includes(txt):
includes = set()
ip4_blocks = set()
gdvalle / netflix-skip-intro.user.js
Last active Mar 29, 2019
Skip intros in Netflix videos.
View netflix-skip-intro.user.js
// ==UserScript==
// @name Netflix Skip Intro
// @namespace
// @version 0.1
// @description Automatically skip intros with Netflix.
// @author goobyndolan
// @match*
// @grant none
// ==/UserScript==
gdvalle / benchmark.lua
Last active Feb 5, 2018
OpenResty micro benchmark lib
View benchmark.lua
local ffi = require "ffi"
local ngx = ngx
local ngx_update_time = ngx.update_time
local ngx_say = ngx.say
local tonumber = tonumber
typedef long time_t;
gdvalle / update_readme
Created Feb 18, 2017
Replace text between invisible markdown comments.
View update_readme
#!/usr/bin/env bash
# This just replaces the text between a couple of hopefully invisible
# markdown comments, like so: `[//]: #` (text within backticks)
set -euo pipefail
main_output="$(cargo run -- --help)"
output="$(printf "### main\n\`\`\`\n%s\n\`\`\`" "$main_output")\n"
output+="### subcommands\n"
gdvalle / prometheus_alert_migrate.vimscript
Created Mar 3, 2016
Convert Prometheus 0.16.x alerts to 0.17 format
View prometheus_alert_migrate.vimscript
:%s/SUMMARY \(.*\)/ANNOTATIONS {\r summary = \1,/g
:%s/DESCRIPTION \(.*\)/ description = \1\r \}/g
gdvalle /
Last active Dec 5, 2015
An atomic file updater in shell.
set -u
# Default temp file suffix
usage() {
printf 'usage: echo foo | %s <file> [lockfile] [tempfile]\n' "$PROG" >&2
gdvalle / Molokai.colorscheme
Created Sep 18, 2014
Molokai color scheme for Konsole
View Molokai.colorscheme
gdvalle /
Created Jun 17, 2014
Script to reproduce slow Ansible file copy
#!/usr/bin/env bash
# Breaking commit:
# Last working commit:
# It appears that the kv_regex.match() hangs ansible during larger file copies.
ANSIBLE_ARGS="-i '$HOST,' -v -D test.yml"
You can’t perform that action at this time.