Skip to content

Instantly share code, notes, and snippets.

View KeithYJohnson's full-sized avatar

Keith Johnson KeithYJohnson

View GitHub Profile
@KeithYJohnson
KeithYJohnson / ssh-background
Last active December 22, 2017 18:48 — forked from BugRoger/ssh-background
Changes iTerm2's background color based on host configuration
#!/bin/bash
# Installation:
# 1. Save this script to /some/bin/ssh-background
# 2. chmod 755 /some/bin/ssh-background
# 3. alias ssh=/some/bin/ssh-background
# 4. Configure your host colors below.
set_color() {
local HEX_FG=$1
local HEX_BG=$2
def nested_delete_keys(*invalid_keys)
invalid_keys = invalid_keys.flatten
keys.each do |key|
key = key.to_s
if key.to_s.in?(invalid_keys)
delete(key)
elsif self[key].is_a?(Hash)
self[key].nested_delete_keys(invalid_keys.flatten)
elsif self[key].is_a?(Array) && self[key].first.is_a?(Hash)