Skip to content

Instantly share code, notes, and snippets.

View purp's full-sized avatar
🖤
https://xrl.us/mlkbirmletterpdf

Jim Meyer purp

🖤
https://xrl.us/mlkbirmletterpdf
View GitHub Profile
@purp
purp / README.md
Last active January 5, 2017 04:40
Setting up Rails 5, Puma, and nginx on OpenSUSE Leap 42.1

Huge thanks to @bounga for his post that didn't assume you've got a working /etc/nginx.conf. Everyone else's posts just assume that you've got the same /etc/nginx.conf as they do, and when you don't, you're screwed.

I like the sites-available/sites-enabled paradigm so I did this:

mkdir /etc/nginx/sites-available /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-enabled /etc/nginx/vhosts.d

I highly recommend using capistrano-puma. Super basic steps condensed from the capistrano-puma readme:

  1. Add this to your Gemfile in the development group:
@purp
purp / README.md
Last active January 4, 2017 17:05
Installing Nokogiri gem manually on OpenSUSE Leap 42.1

Installing nokogiri manually on OpenSUSE Leap 42.1:

gem install nokogiri -- --use-system-libraries \
    --with-xml2-dir=/usr \
    --with-xslt-dir=/usr \
    --with-exslt-dir=/usr

I can't say I understand why I had to specify those dirs as that's the system default, but it works and I'm in a hurry. I'll update this as I learn more someday.

Meanwhile, you may be interested in the Nokogiri issue that this stems from

@purp
purp / Capfile
Last active October 20, 2021 22:44
Using Capistrano 3, capistrano-rbenv, and capistrano-rbenv-build together with Rails 5
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
@purp
purp / README.md
Last active August 11, 2017 21:06
Measuring how well Homebrew's awscli formula tracks releases, now with measured time deltas. Hacked in a hurry. #notproud #dontjudge

How To Run This Piece Of Junk

  1. clone aws/aws-cli and homebrew-core into ~/work
  2. Run check_awscli_tracking.sh
  3. Run awscli_release_stats.rb
@purp
purp / delegate_matcher.rb
Last active July 31, 2020 10:46 — forked from bparanj/delegate_matcher.rb
RSpec matcher for delegations
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:day).to(:created_at) }
# it { should delegate(:month, :year).to(:created_at) }
# end
#
@purp
purp / rbenv-copy-gems.rb
Created July 7, 2016 16:01
rbenv: install all gems from one version to another
#!/bin/bash
# copy is a misnomer; it's actually LIST + INSTALL
# --from 2.2.1 [--to other-version-else-whatever-is-currently-set]
#
# TODO: install only most-recent version that's installed in FROM
# TODO: use gem names only from FROM, install latest available version (might be more recent than in FROM)
# TODO: pass arguments to gem command (e.g. --no-document)
CURRENT_VERSION=`rbenv version | cut -d' ' -f1`
GEM_LIST_ARGS="--local"
@purp
purp / mapped_open_struct.rb
Created February 21, 2016 05:52
MappedOpenStruct: useful for hashes from JSON with crappy keys
require 'ostruct'
class MappedOpenStruct < OpenStruct
MAP = {}
def initialize(hash=nil)
super
add_mapped_methods
end
@purp
purp / array_expand.rb
Last active January 24, 2016 17:06
Expand a two-element array by an interval
class Array
def expand(interval=1)
raise "Can only expand two-element arrays" if self.size != 2
raise "Can only expand numeric arrays" unless self.first.kind_of?(Numeric) && self.last.kind_of?(Numeric)
result = [self.first]
while result.last < self.last do
next_value = result.last + interval
@purp
purp / openstack_approved_vendors.rb
Created July 16, 2015 09:41
Get the list of OpenStack-approved vendors from the OpenStack Marketplace
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'uri'
class String
def titleize
humanize.split(' ').map(&:capitalize).join(' ')
end
@purp
purp / schedule_urls.csv
Created May 12, 2015 02:06
MLB Team Names, Abbreviations, and Up-to-date iCal link (from http://mlb.com/schedule/downloadable.jsp?c_id=ABBREV&year=2015)
Arizona Diamondbacks ari webcal://mlb.am/tix/diamondbacks_schedule_full
Atlanta Braves atl webcal://mlb.am/tix/braves_schedule_full
Baltimore Orioles bal webcal://mlb.am/tix/orioles_schedule_full
Boston Red Sox bos webcal://mlb.am/tix/redsox_schedule_full
Chicago White Sox cws webcal://mlb.am/tix/whitesox_schedule_full
Chicago Cubs chc webcal://mlb.am/tix/cubs_schedule_full
Cinncinnati Reds cin webcal://mlb.am/tix/reds_schedule_full
Cleveland Indians cle webcal://mlb.am/tix/indians_schedule_full
Colorado Rockies col webcal://mlb.am/tix/rockies_schedule_full
Detroit Tigers det webcal://mlb.am/tix/tigers_schedule_full