Skip to content

Instantly share code, notes, and snippets.

View tombh's full-sized avatar

Thomas Buckley-Houston tombh

View GitHub Profile
Japanese, Hokkaido, Jingisukan
Japanese, Hokkaido, Rui-be
Japanese, Hokkaido, Hokkaido
Japanese, Tohoku region, Wanko soba
Japanese, Tohoku region, Morioka
Japanese, Tohoku region, Kiritanpo
Japanese, Tohoku region, Gy
Japanese, Chubu and Kanto regions, Inago no tsukudani
Japanese, Chubu and Kanto regions, Monjayaki
Japanese, Chubu and Kanto regions, Sushi
{
"nodes": [
{
"name": "Testing",
"contact": "[email protected]",
"locations": [
{
"type": "s3",
"bucket_name": "oam-uploader"
}

Keybase proof

I hereby claim:

  • I am tombh on github.
  • I am tombh (https://keybase.io/tombh) on keybase.
  • I have a public key whose fingerprint is 3317 BFD3 B392 2F6C 0DAE BE40 62CC 4ABB D9C0 B437

To claim this, I am signing this object:

These are some opiniated ideas for improvements to OAM/OIN. They are first of all straw men: merely ideas to stimulate conversation. My guiding principles here are the general software engineering best practices I've come to appreciate over the years. Therefore there is little here in terms of new features and little that an end-user would explicitly notice. They concern the health of the code: reduction of regression bugs, ease and confidence of refactoring, reduction of the learning curve for newcomers and contributors, scalability and browser performance.

These are of course good things in any circumstances. Though I have also borne in mind HOT's plans to promote and expand OAM beyond its current audience and vision.

Github Improvements

Contribution policies

  • Always rebase, rather than merge, by default on github. This makes the Git logs more readable.
  • PRs must include new/amended test cases.
  • master as the default branch, with staging and production reflecting increasing stability.
#! env ruby
loop do
begin
ping = `ping -n -c 1 -W 3 google.in 2>&1`
rescue
puts "Failed ping"
sleep 1
next
class ErrorHandler
def foo
potential_error
rescue StandardError
puts 'An error was handled'
end
end
RSpec.describe do
let(:instance) { ErrorHandler.new }
task calculate_per_location_costs: :environment do
year = ENV['YEAR'].to_i
month = ENV['MONTH'].to_i
# Method 1: By server usage
# Get all servers that were created in the given month
servers_by_location = Server.with_deleted
.where('extract(year from created_at) = ?', year)
.where('extract(month from created_at) = ?', month)
.group_by(&:location)
@tombh
tombh / gist:b45e86788620435adc5a
Last active November 9, 2021 13:49
Use .env file to filter sensitive data from VCR cassettes
# Assuming that you're using .env to store your sensitive app credentials, then you can
# use VCR's `filter_sensitive_data` method to convert occurrences of those credentials
# to `<%= ENV['#{key}'] %>` in your recorded VCR cassettes.
require 'vcr'
# Use the .env file to compile the list of sensitive data that should not be recorded in
# cassettes
def sensitive_strings
contents = File.read "#{Rails.root}/.env"
@tombh
tombh / gist:f66de84fd3a63e670ad9
Created January 3, 2015 17:38
Convert OpenSSH public key to OpenSSL public key using ruby
require 'base64'
require 'openssl'
# Parse SSH keys to be used by OpenSSL lib
# Taken from Zerg Support project.
# See: https://github.com/pwnall/zerg_support/blob/faaa5dd140c95588a1db2a25f6c9d9cacb4f9b0a/lib/zerg_support/open_ssh.rb
module OpenSSHKeyConverter
# The components in a openssh .pub / known_host RSA public key.
RSA_COMPONENTS = ['ssh-rsa', :e, :n]
# The components in a openssh .pub / known_host DSA public key.
chocolates = ['maltesers', 'minstrels', 'green & blacks', 'montezuma']
we_ate = chocolates[0..1]
# Outputs: ['maltesers', 'minstrels']