Skip to content

Instantly share code, notes, and snippets.

View zachwalton's full-sized avatar

Zach Walton zachwalton

  • San Francisco, CA
View GitHub Profile
@zachwalton
zachwalton / wtftls.bash
Created October 7, 2020 04:52
wtftls - monitor network devices for TLS alerts and display helpful error messages from RFC 5246
#!/usr/bin/env bash
interpreter=$(ps h -p $$ -o args='' | cut -f1 -d' ')
if [[ "$interpreter" != *zsh* ]] && [[ ${BASH_VERSINFO:-0} -lt 4 ]]; then
echo "bash version 4 or greater required" >&2
exit 1
fi
declare -A messages
openapi: "3.0.0"
info:
version: 0.1.0
title: Johnny Cache
license:
name: MIT
paths:
/records:
post:
summary: Create a cache record
@zachwalton
zachwalton / has_one_through_bug.rb
Created February 12, 2018 22:22
has_one through not available on unpersisted instances
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
@zachwalton
zachwalton / association_bug_reproduction.rb
Created October 5, 2017 02:40
has_and_belongs_to_many association bug
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "5.1.3"
@zachwalton
zachwalton / remote_sync.sh
Last active September 25, 2017 20:45
rsync files when an fswatch event is detected
#!/bin/bash
function tracked_by_git() {
cd $(dirname $1)
git ls-files --error-unmatch $1 &>/dev/null
ret=$?
cd - &>/dev/null
return $ret
}
@zachwalton
zachwalton / rpi.js
Created August 7, 2017 04:37
interacting with raspberry pi gpio via react-hardware
/**
* Pulsing LED example.
* Insert an LED into Pin 9 and run this example.
*/
import Raspi from 'raspi-io';
import React, {Component} from 'react';
import ReactHardware from '../../src';
import five from 'johnny-five';
@zachwalton
zachwalton / keybase.md
Created July 11, 2017 00:15
keybase.md

Keybase proof

I hereby claim:

  • I am zachwalton on github.
  • I am zachwalton (https://keybase.io/zachwalton) on keybase.
  • I have a public key ASDSRXIphhDdORuYOPDX_p53YEa4nFWY0mhNzo3sGGFNRgo

To claim this, I am signing this object:

begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "4.2.7.1"
@zachwalton
zachwalton / git-prompt.sh
Created July 17, 2016 22:40
git-prompt.sh, emoji version
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@zachwalton
zachwalton / GOOOOOOOOAL
Last active February 19, 2016 20:26
GOOOOOOOOAL
zach (python):
import inspect
def g(v=None):
f=str(inspect.currentframe().f_back)
if not v:
g.__dict__[f] = g.__dict__[f] + 'O' if g.__dict__.get(f) else 'GO'
return g
print g.__dict__.pop(f, 'G') + 'AL'