Skip to content

Instantly share code, notes, and snippets.

View thephw's full-sized avatar
❤️
Building software with love

Patrick Howard Wiseman thephw

❤️
Building software with love
View GitHub Profile
@thephw
thephw / index_of_max_ascending_slice.rb
Last active March 29, 2021 09:17
Find the index of the max ascending slice in an array
def index_of_max_ascending_slice(a)
slices = a.slice_when{|i,j| i >= j}.to_a
max_size = slices.map(&:length).max
start_index = slices[0...slices.find_index{|v| v.length == max_size}].flatten.count
end
# Get the digest from a tag on a remote repository
docker inspect ${IMAGE_TAG} --format '{{index .RepoDigests 0 }}'
# Get the tags from digest
docker inspect ${IMAGE_DIGEST} --format '{{index .RepoTags }}'
Identifier_WidthxHeight.ext
Rectangle/
_150x84.{jpg,png}
_250x141.{jpg,png}
_500x281.{jpg,png}
_800x450.{jpg,png}
Square/
_150x150.{jpg,png}
_250x250.{jpg,png}
_500x500.{jpg,png}
@thephw
thephw / jameswhitemanifesto.txt
Created April 30, 2020 17:17 — forked from coliver/jameswhitemanifesto.txt
James White Manifesto
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
### Keybase proof
I hereby claim:
* I am thephw on github.
* I am thephw (https://keybase.io/thephw) on keybase.
* I have a public key ASDcgr8YA9DMCiDr3Wd3E_YJs9U-4P60dphV9DtmgfkHAQo
To claim this, I am signing this object:

Minikube VirtualBox on OS X Mojave Issues

Apple and Oracle can't see eye to eye on security so all the current Virtual Box Installers (5.2/6.0RC1) do not work. I actually blame oracle as they won't take simple steps to keep their software up to date and compatible, but that is neither here nor there.

Expected Results

VirtualBox will install correctly.

Actual Results

VirtualBox install will fail for all current version.

Work Around

@thephw
thephw / gist:4743827
Last active January 24, 2018 23:28
Taxes 2017 for IRB
################
## Taxes 2017 ##
################
SINGLE_STD_DEDUCTION = 6350
MARRIED_STD_DEDUCTION = 12700
FEDERAL_INDIVIDUAL_INCOME_TAX_RATES = {
9325 => 0.10,
37950 => 0.15,
91900 => 0.25,
$ brew update
$ brew boxen-install gnupg
$ gpg --gen-key # Use the same email address as github, local gitconfig, and SSH key
$ gpg --list-secret-keys --keyid-format LONG # Take everything after the / in pub to use in the following command
$ git config --global user.signingkey <YOUR KEY HASH HERE i.e. 0A123456>
$ git config --global commit.gpgsign true
$ gpg --armor --export <YOUR_EMAIL_ADDRESS_HERE> | pbcopy
$ open https://github.com/settings/keys # Paste the key into GPG keys here
@thephw
thephw / config_fix.rb
Last active July 25, 2017 03:25
Horseshit webkit_server fix
config.after(:suite) do
webkit_server_pid = %x[ps].split("\n").select{|str| str.match /webkit_server/ }.first.to_i
if webkit_server_pid != 0
puts "webkit_server did not quit... killing webkit_server PID ##{webkit_server_pid}"
`kill -9 #{webkit_server_pid}`
end
end
require "redis"
class LockNKey
def call(env)
req = Rack::Request.new(env)
case req.path_info
when /bootstrap/
redis = Redis.new
taken_environments = redis.get("environments").split(",").map(&:to_i)
available_environments = (1..24).to_a - taken_environments