Skip to content

Instantly share code, notes, and snippets.

View mrinterweb's full-sized avatar

Sean McCleary mrinterweb

View GitHub Profile
@mrinterweb
mrinterweb / prepare-commit-msg
Last active November 1, 2022 04:28
git hook that modifies your commit messages to how CrowdCompass formats feature commit messages based on current feature branch.
#!/usr/bin/env ruby
# This takes hook changes the commit message based on the branch name
# to prepend the CrowdCompass Jira "CCD-<ticket_number>" to the commit message
# If the branch name begins with a 4+ character number, CCD-<4+char number> will be prepended
# unless the commit contains a ':'
#
# For example:
# Given I am on a feature branch named 1234-my-special-feature
# When I commit with the message "me fixum good"
@mrinterweb
mrinterweb / gift_name_draw.rb
Created November 26, 2021 23:03
Script for gift name draw
require 'pp'
NAMES = %w[Frank Sean Bryn Quinn Beckett Katie Brent Brook Katelynn Adrian].freeze
pickers = NAMES.clone
available = NAMES.clone.shuffle
matches = {}
pickers.each do |picker|
picked = available.shift
@mrinterweb
mrinterweb / sb.rb
Created February 23, 2021 22:21
Easy fuzzy branch switching
#! /usr/bin/env ruby
# Switch to git branch by matching part of a name
results = `git branch -l | grep -i #{ARGV[0]} | cut -f 1`
branchNames = results.split("\n").map { |bn| bn.sub(/^\*/, '').strip }
if branchNames.length == 1
`git checkout #{branchNames.first}`
else
puts 'More than one branch name matched'
@mrinterweb
mrinterweb / vultr-create-docker-server.sh
Created January 31, 2020 08:53
Creating, connecting to, and destroying a server on Vultr
#!/bin/bash
set -e
# creates in Seattle using 2 core, 2GB RAM, 64GB storage on Ubuntu 19.04
# note I was using a custom script to install docker. Basically "snap install docker"
vultr-cli server create --region 4 --plan 401 --os 338 --script-id <redacted> --label="docker-dev"
echo ""
echo "Wait about a minute to auto-connect..."
#!/bin/sh
set -e
set -u
set -o pipefail
service_name="${1:-monolith}"
container_id="$(docker container ls | grep "opal_$service_name" | head -n1 | cut -d " " -f 1)"
docker logs -f $container_id
This file has been truncated, but you can view the full file.
Date/Time: 2020-01-21 22:46:49 -0800
End time: 2020-01-21 22:47:10 -0800
OS Version: Mac OS X 10.15.2 (Build 19C57)
Architecture: x86_64h
Report Version: 29
Data Source: Stackshots
Shared Cache: 0x6b67000 1C9C4B5C-0A12-39CC-965C-B305BF7F36AA
Command: VimR
version: "2"
options:
verbose: true
syncs:
rails-app-sync:
compose-dev-file-path: 'docker-compose-dev.yml'
notify_terminal: false
src: './'
sync_strategy: 'native_osx'
sync_host_ip: '127.0.0.1'
@mrinterweb
mrinterweb / deploy.rb
Created July 25, 2012 02:46
Wordpress site deployment using capistrano
set :application, 'www.mysite.com'
set :deploy_to, "/srv/www.mysite.com"
set :domain, "www.mysite.com"
set :user, "deploymentuser"
set :scm, :git
set :repository, "git@github.com:myusername/myproject.git"
set :branch, :master
set :deploy_via, :remote_cache
set :copy_exclude, ['.git']
ssh_options[:forward_agent] = true
# This is a ActiveRecord STI class
class Hyundai < Car
has_one :hyundai_details
delegate *HyundaiDetails::ACCESSIBLE_ACCESSOR_METHODS, to: :hyundai_details
default_scope { includes(:hyundai_details) }
def initialize(args = {})
hyundai_details_attrs = {}
args.each do |key, _val|
@mrinterweb
mrinterweb / gist:25eac01663309741240c45d18a0a3026
Created January 19, 2018 22:46
switch branches by name match
#! /usr/bin/env ruby
# Switch to git branch by matching part of a name
results = `git branch -l | grep -i #{ARGV[0]} | cut -f 1`
branchNames = results.split("\n").map { |bn| bn.sub(/^\*/, '').strip }
if branchNames.length == 1
`git checkout #{branchNames.first}`
else
puts 'More than one branch name matched'