This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rspec' | |
gem 'pry' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This requires tmux 2.1. a lot of these settings will error on anything earlier. | |
# Act like Vim; use h,j,k,l to select panes and move the cursor | |
set-window-option -g mode-keys vi | |
bind-key h select-pane -L | |
bind-key j select-pane -D | |
bind-key k select-pane -U | |
bind-key l select-pane -R | |
# Look good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Profiler | |
## A wrapper for the rblineprof library to pretty-print the profile data | |
## and enable customization of the output | |
## Based heavily on tmm1's examples | |
## This assumes that rblineprof lib is installed in Rails.root + 'vendor/rblineprof/ext' | |
## https://github.com/tmm1/rblineprof | |
class Profiler | |
# see docs for self.log_line method | |
@@logger = Proc.new { |line| Rails.logger.info line } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class PIDFileException extends Exception {} | |
class PIDFileSlotsExhaustedException extends PIDFileException {} | |
class PIDFileErrorException extends PIDFileException {} | |
class PIDFileNoBigDealException extends PIDFileException {} | |
class PIDFileBadPidException extends PIDFileErrorException {} | |
/** | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is such a hack. holy shit. | |
# use it like this: | |
# cap production deploy sandbox deploy | |
require 'capistrano/ext/multistage' | |
set :base_servers, @roles.clone | |
stages.each do |stage| | |
before(stage) do | |
@roles.replace(base_servers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream plex-upstream { | |
# change plex-server.example.com:32400 to the hostname:port of your plex server. | |
# this can be "localhost:32400", for instance, if Plex is running on the same server as nginx. | |
server plex-server.example.com:32400; | |
} | |
server { | |
listen 80; | |
# server names for this server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_quotes(block_of_text) | |
lines = block_of_text.split(/\n+/) | |
lines.map do |line| | |
m = line.match(/^(.+?):\s+(.+)$/) # match the line | |
next unless m # skip any lines that don't look like "some name: some text" | |
[ m[1], m[2] ] | |
end.compact | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.upto(Resque::Failure.count) do |i| | |
job = Resque::Failure.all(i) | |
# inspect failed job | |
args = job['payload']['args'] | |
klass = job['payload']['class'] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Mon, 26 Nov 2012 17:06:54 GMT] [info] [<0.18152.6>] Starting compaction for db "chef" | |
[Mon, 26 Nov 2012 17:06:54 GMT] [info] [<0.20248.6>] 127.0.0.1 - - 'POST' /chef/_compact 202 | |
[Mon, 26 Nov 2012 17:06:54 GMT] [error] [emulator] Error in process <0.20250.6> with exit value: {{badmatch,no_valid_header},[{couch_db_updater,start_copy_compact,1}]} | |
[Mon, 26 Nov 2012 17:06:54 GMT] [error] [<0.20251.6>] ** Generic server <0.20251.6> terminating | |
** Last message in was {'EXIT',<0.20250.6>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash - | |
curl -H "Content-Type: application/json" localhost:5984/chef | |
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact | |
sleep 3 | |
for VIEW in nodes roles registrations clients data_bags data_bags_items users checksums cookbooks sandboxes environments id_map; do | |
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact/$VIEW |