Skip to content

Instantly share code, notes, and snippets.

Ry Biesemeyer yaauie

Block or report user

Report or block yaauie

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
yaauie / dpkg-cat
Created Apr 26, 2018
I had a need the other day to read files out of RPM and DEB packages, but wanted to avoid extracting them to my local filesystem; the following scripts cobble together the various tools I found to simply read a single file from either to stdout.
View dpkg-cat
#!/usr/bin/env bash -x
# prereq: tar
tar -xOf $package data.tar.gz | tar -zxO $file
View gzip-decode-filter.rb
# Copyright 2018 Ry Biesemeyer (@yaauie)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
yaauie / ensure-trailing-newline.bash
Created Apr 12, 2018
Ensure Trailing Newline: ensures that the given plaintext file ends with a newline character, appending in-place only if it is missing.
View ensure-trailing-newline.bash
#!/usr/bin/env bash -e
# Ensure Trailing Newline: ensures that the given plaintext file ends with a
# newline character, appending in-place only if it is missing.
# Portable on POSIX-based or POSIX-compatible systems, as it uses POSIX-standard
# invocations of `wc`, `tail`, and `echo`.
# Copyright 2018 Ry Biesemeyer
yaauie / logstash-filters-cache-common.rb
Created Jan 12, 2018
View logstash-filters-cache-common.rb
class Logstash::Filters::CacheCommon < LogStash::Filters::Base
config :get, validate: :hash, required: false
config :set, validate: :hash, required: false
def register
@get ||= {}
@set ||= {}
if (@get.empty? && @set.empty?)
yaauie / json2csv
Created Aug 1, 2017
Script that takes an JSON-blob on stdin containg an array of objects, and outputs a CSV.
View json2csv
#!/usr/bin/env sh
if which jq ; then
cat | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
>&2 echo "\033[31mERROR: $(basename $0) requires jq\033[0m"
exit 127
yaauie /
Last active Feb 9, 2017
A simple command-line tool for creating randomised pairings, written in Ruby.


It creates randomised pairings from the given inputs.



╭─{ yaauie@durin:~ }
╰─● rando-pair Alice Bob Charlie Donald Evelyn Frank Gertrude
package com.yaauie.guava-utils;
yaauie / jsonpp
Last active Aug 12, 2016
order-preserving jsonpp
View jsonpp
#!/usr/bin/env ruby
# encoding: utf-8
require 'json'
rescue JSON::ParserError => e
exit 1
yaauie / Iso8601.g4
Created May 29, 2016
ISO-8601 Grammar
View Iso8601.g4
grammar Iso8601;
temporal : year (HYPHEN subyear)? offset? EOF
subyear : month (HYPHEN submonth)?
| W_LITERAL week (HYPHEN subweek)?
| Q_LITERAL quarter (HYPHEN subquarter)?
| oday (T_LITERAL subday)?
yaauie / kafka-lag-top.rb
Created Feb 8, 2016
a top-like version of put this in the bin of the kafka tarball you downloaded from and invoke it with the path to the zookeeper node as its only argument.
View kafka-lag-top.rb
#!/usr/bin/env ruby
require 'shellwords'
require 'time'
zookeeper = ARGV.shift || fail("Usage #{$0} <zookeeper>")
$stderr.puts("Getting stats via #{zookeeper}")
one_five_fifteen = []
You can’t perform that action at this time.