Skip to content

Instantly share code, notes, and snippets.

Avatar
🐻
🎷

Dan Buch meatballhat

🐻
🎷
View GitHub Profile
@meatballhat
meatballhat / rotating_log_sync.py
Last active Feb 19, 2020
python3-based rotating log sink
View rotating_log_sync.py
#!/usr/bin/env python3
import logging
import os
import sys
from logging.handlers import RotatingFileHandler
def main(sysargs=sys.argv[:], stdin=sys.stdin):
View tfplan2json.go
package main
import (
"encoding/json"
"io"
"log"
"os"
"github.com/hashicorp/terraform/terraform"
)
View scriptiddly.bash
#!/usr/bin/env bash
echo infra,stack,group,name
for infra in gce docker ; do
for s in amethyst connie cookiecat garnet sugilite; do
for g in edge stable; do
stackname=$(curl -s https://guest:guest@job-board.travis-ci.com/images\?infra\=${infra}\&tags\=language___${s}__:true,group_${g}:true\&limit\=1 \
| jq -r '.data|.[]|.name');
if [[ $stackname ]]; then
echo "$infra,$s,$g,$stackname";
View golang-org-x-crypto-ssh-728b753-e7ba826.diff
diff --git a/ssh/agent/client_test.go b/ssh/agent/client_test.go
index a13a650..5fc47e5 100644
--- a/ssh/agent/client_test.go
+++ b/ssh/agent/client_test.go
@@ -180,9 +180,12 @@ func TestCert(t *testing.T) {
// therefore is buffered (net.Pipe deadlocks if both sides start with
// a write.)
func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", ":0")
+ listener, err := net.Listen("tcp", "127.0.0.1:0")
View golang-org-x-crypto-ssh-728b753-e7ba826.diff
diff --git a/acme/acme.go b/acme/acme.go
index 8619508..a7b6ce4 100644
--- a/acme/acme.go
+++ b/acme/acme.go
@@ -15,6 +15,7 @@ package acme
import (
"bytes"
+ "context"
"crypto"
@meatballhat
meatballhat / video-brightness
Last active Jun 5, 2017
ACPID event handler for video/brightness(up|down)
View video-brightness
#!/bin/sh
set -o errexit
DEVICE=/sys/class/backlight/intel_backlight
BRIGHTNESS_FILE="${DEVICE}/brightness"
MAX_BRIGHTNESS="$(< $DEVICE/max_brightness)"
STEP=$((MAX_BRIGHTNESS / 20))
read_brightness() {
cat "${BRIGHTNESS_FILE}"
View generate_queries.rb
#!/usr/bin/env ruby
def main
if ARGV.length < 2
$stderr.puts "Usage: #{$PROGRAM_NAME} <query-tmpl> <max-id> " \
"[range-size] [range-begin] [sleep]"
exit 1
end
query_tmpl = File.read(ARGV.fetch(0))
View README.md

NOTE: the TEXT const is defined here with value "application/json; chunked=true; version=2, application/json; version=2, text/plain"

@meatballhat
meatballhat / Makefile
Last active Dec 22, 2016
negroni logging benchmark fun
View Makefile
test:
go test -v -bench=. -benchtime=30s 2>&1 | tee results.txt