Skip to content

Instantly share code, notes, and snippets.

View johnbellessa's full-sized avatar

John Bellessa johnbellessa

View GitHub Profile
@johnbellessa
johnbellessa / jq-filter-properties-by-key-pattern.sh
Created July 14, 2021 20:51
jq one-liner to update a parent object with properties filtered out by key pattern
#!/usr/bin/env bash
# Input: { "parent": { "foobar": "hello", "foobaz": "world" } }
# Output: { "parent": { "foobaz": "world" } }
jq '.parent |= with_entries(select(.key | test("bar") | not))'
@johnbellessa
johnbellessa / capture.sh
Last active November 18, 2020 04:52
Capture stdin
# As far as I can tell, this only works in zsh
stdin="$(<&0)"
echo $stdin
# Pretty sure this should work everywhere (or at least bash and zsh)
stdin="$(cat <&0)"
echo $stdin
psg () {
ps aux | {
# Read and print the ps header
local ps_header
read ps_header && echo $ps_header && \
# Grep through the rest of the input with the provided pattern
grep --color=always -E "$1" | grep --color=always -v grep
}
}
@johnbellessa
johnbellessa / parse-artifactory-docker-images.jq
Last active June 23, 2020 19:13
jq script to transform the output of `jfrog rt search` commands, where the results are constituent files of Docker images
# jq script to transform the output of `jfrog rt search` commands, where the results are constituent files of
# Docker images.
#
# Usage:
# jfrog rt search <pattern> | jq --arg artifactoryHostDomain "<domain>" -f parse-artifactory-docker-images.jq
# jq --arg artifactoryHostDomain "<domain>" -f parse-artifactory-docker-images.jq <jsonfile>
#
# Example:
# ```shell
# jfrog rt search my-docker-repo/my-docker-image-name/ | \
@johnbellessa
johnbellessa / packages
Created October 18, 2015 02:16
packages
acpi-support
app-install-data-partner
apport-gtk
apt-offline
avahi-autoipd
avahi-daemon
blueman
bluez
bluez-alsa
bluez-cups

Keybase proof

I hereby claim:

  • I am johnbellessa on github.
  • I am johnbellessa (https://keybase.io/johnbellessa) on keybase.
  • I have a public key whose fingerprint is 8700 9F38 5DDC 7FC4 FE3A 0353 D626 CA50 2DFE D281

To claim this, I am signing this object:

swid tablesize missed pkts hitrate
0 1 371233 437000 0.150496567506
0 2 305971 437000 0.299837528604
0 3 229541 437000 0.474734553776
0 4 170783 437000 0.60919221968
0 5 125456 437000 0.712915331808
0 6 92568 437000 0.788173913043
0 7 67513 437000 0.845508009153
0 8 48377 437000 0.889297482838
0 9 34360 437000 0.921372997712