Skip to content

Instantly share code, notes, and snippets.

View bobzoller's full-sized avatar

Bob Zoller bobzoller

View GitHub Profile
@bobzoller
bobzoller / custom_event_transformer.js
Created January 23, 2023 16:57
PagerDuty Custom Event Transformer code for Meraki Alert Webhooks
var body = PD.inputRequest.body;
var eventType;
switch (body.alertType) {
case "Uplink status changed":
eventType = body.alertData.uplink ? PD.Resolve : PD.Trigger;
break;
case "APs went down":
eventType = PD.Trigger;

We have an issue where Snowflake returns a different value for a column depending on the order of joins and usage of using vs on:

join vendors last, with using

this incorrectly returns product_types.created_at_utc in the place of products.created_at_utc.

query id: ef66f8a8-70b2-44eb-a612-f41afb8b5aa2

snowsql>select products__intermediate.product_id, product_types.created_at_utc as product_type, products__intermediate.created_at_utc as product,
        vendors.created_at_utc as vendor from temp.products__intermediate left join staging.product_types on products__intermediate.product_type
function downcaseJSONKeys(obj) {
if (!obj) {
return;
}
if (typeof obj !== 'Object' && typeof obj !== 'object') {
return;
}
var keys = Object.keys(obj);
var result = {};
keys.map(function(k, v) {
@bobzoller
bobzoller / list-deps.cr
Created March 6, 2018 02:10 — forked from bcardiff/list-deps.cr
List binary dependencies to build a minimal docker image from scratch
unless ARGV.size > 0
puts " Missing executable file argument"
puts " Usage (in a Dockerfile)"
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable"
exit 1
end
executable = File.expand_path(ARGV[0])
unless File.exists?(executable)
require "json"
STDIN.each_line do |line|
begin
log = JSON.parse(line).as_h
time = log.delete "time"
line = log.to_json
line = "{\"time\":\"#{time}\",#{line[1..-1]}"
puts line
rescue JSON::Error
@bobzoller
bobzoller / repoint-github-origins-to-ssh
Last active June 15, 2017 21:22
find all the Github repos in a local directory (recursive) and repoint them from HTTPS to SSH
#!/usr/bin/env bash
while read -r dir; do
echo "$dir"
cd "$(dirname "$dir")" || exit 1
origin=$(git remote get-url origin 2>/dev/null)
if echo "$origin" | grep -q '^https://github.com/'; then
repo=$(echo "$origin" | sed 's#^https://github.com/##')
echo "fixing $dir $repo"
git remote set-url origin "git@github.com:$repo"

Keybase proof

I hereby claim:

  • I am bobzoller on github.
  • I am bobzoller (https://keybase.io/bobzoller) on keybase.
  • I have a public key whose fingerprint is A905 691E 9AEE BF8A 6F5D F98F 7A31 A43E A910 0301

To claim this, I am signing this object:

@bobzoller
bobzoller / find_tasks.sh
Created February 21, 2017 22:27
find tasks that aren't using AWS ECR
#!/bin/bash
set -e
set -o pipefail
#set -x
ACCOUNT=prod
arns=$(aws-vault exec "$ACCOUNT" -- aws ecs list-task-definitions | jq -r '.taskDefinitionArns | join("\n")')
families=$(echo "$arns" | awk -F '/' '{print $2}' | awk -F ':' '{print $1}' | sed '/^[[:space:]]*$/d' | sort | uniq)
for family in $families; do
@bobzoller
bobzoller / README.md
Last active February 16, 2016 19:29
A Lego program created by my daughter's preschool class at Career Day

Redwood Montessori 2016 - Career Day for Computer Programming

A Lego program created by my daughter's preschool class (and transcribed by me).

Howto

  1. Download & Install ACSLogo for Mac OSX
  2. Run the program!

Screenshot

@bobzoller
bobzoller / .gitignore
Last active August 29, 2015 14:24
script to recreate rabbitmq exchanges, queues, and bindings from one rabbitmq server on another
/node_modules
/config.*.json