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
View keybase.md

Keybase proof

I hereby claim:

  • I am yaauie on github.
  • I am yaauie (https://keybase.io/yaauie) on keybase.
  • I have a public key whose fingerprint is 0FA5 1969 4D7F 08F0 083F A1B6 CF2C 1D14 E392 052D

To claim this, I am signing this object:

View capture-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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@yaauie
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
package="${1:?package}"
file="${2:?file}"
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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@yaauie
yaauie / logstash-filters-cache-common.rb
Created Jan 12, 2018
logstash-filters-cache-common
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?)
View redis-expiry-helper.md

Sometimes your redis needs a little help keeping up with expiries.

First, it's helpful to know how expiries are handled in redis internals:

Redis keys are expired in two ways: a passive way, and an active way.

A key is actively expired simply when some client tries to access it, and the key is found to be timed out.

@yaauie
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'
else
>&2 echo "\033[31mERROR: $(basename $0) requires jq\033[0m"
exit 127
fi
@yaauie
yaauie / jason-voorhees.rb
Last active Jun 29, 2017
JSON-decode recursively until it isn't JSON anymore.
View jason-voorhees.rb
# encoding: utf-8
require 'json'
# For when someone puts JSON in your JSON
# (because MurderingRampage™)
class JasonVoorhees
def self.load(*args)
self.new(JSON).load(*args)
end
@yaauie
yaauie / README.md
Last active Feb 9, 2017
A simple command-line tool for creating randomised pairings, written in Ruby.
View README.md

Rando-Pair

It creates randomised pairings from the given inputs.

Examples:

Simple:

╭─{ yaauie@durin:~ }
╰─● rando-pair Alice Bob Charlie Donald Evelyn Frank Gertrude
View immutable-collectors.java
package com.yaauie.guava-utils;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
You can’t perform that action at this time.