Skip to content

Instantly share code, notes, and snippets.

View caius's full-sized avatar
👻

Caius Durling caius

👻
View GitHub Profile

Average of 10 pings from EC2 instance in the from region to the EC2 endpoint in the to region.

ping ec2.%s.amazonaws.com/
From To Avg (ms)
ca-central-1 us-east-1 14.4
ca-central-1 us-west-2 75.4
require "factory_bot"
require "active_support/all"
module LocalFactory
class Factory
attr_reader :factories
def initialize
@factories = {}
end

Requirements

  • Apple pencil 2 (just because)
  • USB-C charging (same charger as laptop then)
  • iOS 15 support, and unlikely to be unsupported in iOS 16
  • Wifi/sim card model, so it has GPS included

Models meeting criteria

iPad models with USB-C or Thunderbolt / USB 4 connector

@caius
caius / ShowDerivedData.rb
Created November 5, 2011 13:49
A script for showing the derived data folder for an Xcode workspace. Intended to be invoked from a custom behaviour
#!/usr/bin/env ruby
# This script currently only works if you have your derived data in the default location.
# Get the workspace name to search for, or exit with code 1 if no value in envariable
xcodeWorkspacePath = ENV["XcodeWorkspacePath"] || exit(1)
projectName = xcodeWorkspacePath[%r{/(\w+)\.xcodeproj}, 1]
#Get the folders in derived data that could match the workspace
derived_data = File.expand_path("~/Library/Developer/Xcode/DerivedData")
# Glob out the files matching our project
#!/usr/bin/env ruby
#
# SitePinger.rb
# Pings a list of sites
#
# Created by Caius Durling <dev at caius dot name> on 2007-07-16.
# Copyright 2007 Hentan Software.
# Licenced under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License.
#
require "sqlite3"
require "active_record"
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
database: ":memory:",
)
ActiveRecord::Schema.define do
create_table "employees", force: :cascade do |t|
require "net/http"
A_CHUNK_TOO_FAR = Class.new(StandardError)
# @param url [URI] uri to fetch title of
def url_title(url)
title = nil
Net::HTTP.start(url.host, url.port, use_ssl: (url.scheme == "https"), open_timeout: 5, read_timeout: 5) do |http|
request = Net::HTTP::Get.new(url)
module GivenWhenThen
module ClassMethods
def def_Given(name, *args, &block)
_gwt_define(:Given, name, *args, &block)
end
def def_When(name, *args, &block)
_gwt_define(:When, name, *args, &block)
end
@caius
caius / spss_macos.md
Last active November 13, 2020 21:54
IBM SPSS Version 26 on macOS Big Sur
  1. install homebrew - https://brew.sh
brew install openjdk
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
(check `brew info openjdk` if that's still the correct command)
  1. Check java runs
@caius
caius / thing_spec.rb
Last active September 24, 2020 16:25
require "net/http"
require "json"
require "rspec/autorun"
module Thing
def self.thing(response)
case response
when Net::HTTPSuccess
:ok
when Net::HTTPNotFound