Skip to content

Instantly share code, notes, and snippets.

View dougbarth's full-sized avatar

Doug Barth dougbarth

View GitHub Profile
FROM ubuntu:trusty
RUN apt-get update && \
apt-get install -y build-essential software-properties-common python-software-properties
RUN apt-add-repository ppa:brightbox/ruby-ng && \
apt-get update && \
apt-get install -y ruby2.2 ruby2.2-dev zlib1g-dev liblzma-dev
RUN gem2.2 install --no-ri --no-rdoc jsonlint bundler
@dougbarth
dougbarth / ruby_details.rb
Created February 10, 2017 20:50
jsonlint debug
require 'rubygems'
require 'jsonlint'
puts "=== Ruby version: #{RUBY_VERSION}"
puts "=== gem env"
system("gem env")
puts "=== Load Path"
puts $:
puts "=== Loaded features"
puts $LOADED_FEATURES
@dougbarth
dougbarth / unscoped_gotcha_test.rb
Last active February 9, 2016 19:48
Gotcha with STI and unscoped queries against the base class
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
@dougbarth
dougbarth / innobackup.backup.log
Created June 5, 2014 22:57
SST failing the complete right at the end
xtrabackup: Creating suspend file '/tmp/xtrabackup_suspended_2' with pid '6701'
>> log scanned up to (3225206169821)
140605 22:34:43 innobackupex: Continuing after ibbackup has suspended
140605 22:34:43 innobackupex: Starting to lock all tables...
>> log scanned up to (3225206203261)
>> log scanned up to (3225206235126)
>> log scanned up to (3225206235221)
>> log scanned up to (3225206235221)
>> log scanned up to (3225206235221)
@dougbarth
dougbarth / gist:9765559
Created March 25, 2014 16:25
keybase.md
### Keybase proof
I hereby claim:
* I am dougbarth on github.
* I am dougbarth (https://keybase.io/dougbarth) on keybase.
* I have a public key whose fingerprint is E311 A6FA 87A5 A5B1 8548 B2E2 F147 4600 851F 4F13
To claim this, I am signing this object:
@dougbarth
dougbarth / gist:1114736
Created July 29, 2011 21:03
Rate Controlled AMQP Subscriptions
EM.run do
channel = AQMP::Channel.new
# Allow 10 unacked messages to be delivered to this worker.
channel.prefetch(10)
# Configure this worker to send at 1 msg/s on average with occassional bursts
# up to 5 messages.
token_bucket = TokenBucket.new(1, 5)
-bash: /Users/doug/.rvm/scripts/utility: line 457: syntax error near unexpected token `('
-bash: /Users/doug/.rvm/scripts/utility: line 457: ` \rm -rf "${rvm_tmp_path}/$1"*(N) >/dev/null 2>&1'
-bash: __rvm_conditionally_add_bin_path: command not found
# An example config deploy file using the Accurev SCM integration. The Accurev
# integration uses the Accurev CLI tool, so that needs to be installed and
# configured on the machines that are running Accurev commands.
#
# For illustrative purposes, we will assume we have a depot called my_depot.
# The root stream, my_depot, is what should be in production. There is a stream hanging off
# the root, my_depot-staging, which is holds what should be in the staging environment.
set :scm, :accurev
set :repository, 'my_depot'
source :gemcutter
source Bundler::Source::GemCache.new("path" => File.expand_path("../vendor/plugins/utils/local_gems", __FILE__))
gem "rails", "2.3.4"
gem "rake", "0.8.7"
gem "mysql", "2.8.1"
# Required gems
################### couchrest ##########
# new versions of rest-client break couchrest
def foo=(bar)
puts "in foo="
bar*1.5
end
def original_code
puts "The original quiz code sets a local var, and does not call the method"
puts("return val: #{foo = 8}")
puts("local variables: " + local_variables.inspect)
end