Skip to content

Instantly share code, notes, and snippets.

❤️
Building software with love

Patrick Howard Wiseman thephw

View GitHub Profile
View README.md

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 / config_fix.rb
Last active Jul 25, 2017
Horseshit webkit_server fix
View config_fix.rb
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
View locknkey.ru
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
View movie_finder.rb
movie_names = File.read('/Users/patrickwiseman/Desktop/movie_names.txt').split("\n")
movies = movie_names.map do |movie_name|
JSON.parse(Net::HTTP.get(URI("http://www.omdbapi.com/?t=#{movie_name}&y=&plot=short&r=json")))
end
movies = movies.sort_by{|m| m["imdbRating"].to_i}.reverse
File.write('/Users/patrickwiseman/Desktop/movies.json', movies.to_json)
View snippets.cson
'.source.ruby, .source.ruby.rails':
'Bang Logger':
prefix: 'bang'
body: 'Rails.logger.debug "#{\'=\'*100}\\\\n$1"'
View README.md

Relentlessly Gay™

Each method takes in a set of hue lights and an option set of other parameters for desired visual effect.

Basic setup

Optionally set export HUE_USERNAME=3N70R9-kFFVm-L2GvVOOEpXdDV6Th4yCUsdLrmcb if you know your username already. Otherwise you have to go click the sync button.

require 'hue'
require_relative "./hue_pride.rb"
View sign_stuff.sh
$ 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 / example.md
Last active Feb 4, 2016
Automaton girl - leveraging factory girl for QA data
View example.md

Set your vars

email = "patrick.wiseman@salesloft.com"
user = User.find_by(email: email)
account = user.account
team = account.team
@thephw
thephw / merge_tool_basics.sh
Created Jan 18, 2016
Please use your merge tool
View merge_tool_basics.sh
# Setup your merge tool
$ git config --global merge.tool opendiff
# Use your merge tool when you have conflicts
$ git mergetool
# Cleanup after your merge (delete .orig files)
$ find . -name "*.orig" -delete
View rubocop_precommit_hook.sh
rubocop_happy = $(rubocop -a)
if [ "$rubocop_happy" != "true" ]
then
cat <<\EOF
Error: Rubocop detected style conflicts, commit cancelled, please review.
EOF
exit 1
fi
You can’t perform that action at this time.