Skip to content

Instantly share code, notes, and snippets.

View zachwalton's full-sized avatar

Zach Walton zachwalton

  • San Francisco, CA
View GitHub Profile
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 / 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:

@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 / 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"
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 / 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 / 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
@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