Skip to content

Instantly share code, notes, and snippets.

View gswallow's full-sized avatar

Greg Swallow gswallow

  • Indianapolis, IN, USA
View GitHub Profile
[2014-07-08T23:15:04+00:00] DEBUG: Converging node ip-10-93-168-18.ec2.internal
[2014-07-08T23:15:04+00:00] DEBUG: Saving the current state of node ip-10-93-168-18.ec2.internal
[2014-07-08T23:15:04+00:00] DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
[2014-07-08T23:15:04+00:00] DEBUG: Re-raising exception: Encoding::UndefinedConversionError - "\xE2" from ASCII-8BIT to UTF-8
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/node.rb:418:in `encode'
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/node.rb:418:in `to_json'
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/node.rb:418:in `to_json'
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/node.rb:418:in `to_json'
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/node.rb:418:in `to_json'
/usr/local/lib/ruby/gems/2.0.0/gems/chef-11.12.8/lib/chef/json_compat.rb:102:in `to_json'
root@77b6ef94b4b9:/# su - jenkins
jenkins@77b6ef94b4b9:~$ ls
rvm.sh
jenkins@77b6ef94b4b9:~$ \curl -sSL https://get.rvm.io | sudo bash -s stable --debug |& tee rvmwut.log
Turning on debug mode.
Running(1): Selected RVM branch stableDownloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Running(1): Running(15): curl --fail --location --max-redirs 10 --connect-timeout 30 --retry-delay 2 --retry 3 -sS https://github.com/wayneeseguin/rvm/archive/stable.tar.gz -o /usr/local/rvm/archives/rvm-stable.tgzRunning(1): Running(6): tar xzf /usr/local/rvm/archives/rvm-stable.tgz --no-same-owner --strip-components 1step> 'system_installation_check' started
step< 'system_installation_check' finished with status 0 in 0.008413166 seconds
step> 'setup_rvm_group_and_users' started
Group 'rvm' already exists
@gswallow
gswallow / gist:c5e2b8103f8c180794af
Created August 16, 2014 15:09
right_aws returns empty arrays in response to ec2.create_volume and ec2.describe_volumes
#!/usr/bin/env ruby
require 'right_aws'
require 'open-uri'
require 'json'
def query_role
open("http://169.254.169.254/latest/meta-data/iam/security-credentials/").readlines.first
end
@gswallow
gswallow / 90-ebs.rules.erb
Last active August 29, 2015 14:05
mongodb on ebs
<% unless @prefixes.nil? -%>
<% @prefixes.each do |pfx| -%>
ACTION=="add", KERNEL=="<%= pfx %>", ATTR{bdi/read_ahead_kb}="32"
<% end -%>
<% end -%>
<% unless @raid_dev.nil? -%>
ACTION=="add", KERNEL=="<%= @raid_dev %>", ATTR{bdi/read_ahead_kb}="32"
<% end -%>
x RDS/man/RDS.bootstrap.intervals.Rd
x RDS/man/get.id.Rd
x RDS/man/extract-methods.Rd
x RDS/man/cumulative.estimate.Rd
x RDS/man/as.rds.data.frame.Rd
x RDS/man/gile.ss.weights.Rd
x RDS/man/read.rdsobj.Rd
x RDS/man/get.population.size.Rd
x RDS/man/write.netdraw.Rd
@gswallow
gswallow / gist:ba0d18d4b3aeb0ad28d9
Last active August 29, 2015 14:06
R package installer (handles specific versions)
#!/usr/bin/env Rscript
# Command line options parser. Shamelessly stolen (and even then
# not well understood).
library('getopt');
spec = matrix(c(
'package', 'p', 1, 'character',
'version', 'v', 2, 'character',
'help', 'h', 0, 'logical'
), byrow=TRUE, ncol=4);
server {
listen 443;
server_name customerold.ourplatform.net;
...
location / {
proxy_set_header Host customer.ourplatform.net;
proxy_pass http://upstream_application;
proxy_redirect http://customer.ourplatform.net https://customerold.ourplatform.net;
}
@gswallow
gswallow / fucko.rb
Last active August 29, 2015 14:09
Get the current MongoDB oplog time
#!/usr/bin/env ruby
require 'mongo'
require 'orderedhash'
include Mongo
c = MongoClient.new('localhost').db('admin')
def getReplSetStatus(c)
cmd = OrderedHash.new
@gswallow
gswallow / checkpointtime.rb
Created November 25, 2014 16:55
Get TokuMX Checkpoint times and bytes written
#!/usr/bin/env ruby
require 'mongo'
include Mongo
c = MongoClient.new('localhost')
last_lb = 0
last_nlb = 0
@gswallow
gswallow / mongodb_logrotate.rb
Last active August 29, 2015 14:10
mongodb log rotation with chef
logrotate_app node['mongodb']['instance_name'] do
frequency 'daily'
cookbook 'logrotate'
options ['compress', 'dateext', 'missingok', 'notifempty', 'copytruncate']
path node['mongodb']['config']['logpath']
sharedscripts true
postrotate %Q!kill -USR1 `cat #{['mongodb']['config']['pidfilepath']} 2> /dev/null` 2> /dev/null || true\nfind `dirname #{node['mongodb']['config']['logpath']}` -type f -regex ".*\\.\\(log.[0-9].*-[0-9].*\\)" -exec rm {} \\; 2> /dev/null || true!
rotate 30
end