Skip to content

Instantly share code, notes, and snippets.

@paulmooring
paulmooring / knife.rb
Created March 16, 2012 16:26
Knife config
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "user_name"
client_key "#{current_dir}/user_name.pem"
validation_client_name "chef-validator"
validation_key "#{current_dir}/chef-validator.pem"
chef_server_url "http://chef-server:4000"
cache_type 'BasicFile'
@paulmooring
paulmooring / ohai12_debug.txt
Created March 29, 2012 18:57
Ohai 0.6.12 debug on Windows Server 2008 R2
[Thu, 29 Mar 2012 11:53:14 -0700] DEBUG: Loading plugin os
[Thu, 29 Mar 2012 11:53:14 -0700] DEBUG: Loading plugin kernel
[Thu, 29 Mar 2012 11:53:14 -0700] DEBUG: Loading plugin ruby
[Thu, 29 Mar 2012 11:53:14 -0700] DEBUG: Loading plugin languages
[Thu, 29 Mar 2012 11:53:15 -0700] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(platform=#{RUBY_PLATFORM},version=#{RUBY_VERSION},release_date=#{RUBY_RELEASE_DATE},target=#{::Config::CONFIG['target']},target_cpu=#{::Config::CONFIG['target_cpu']},target_vendor=#{::Config::CONFIG['target_vendor']},target_os=#{::Config::CONFIG['target_os']},host=#{::Config::CONFIG['host']},host_cpu=#{::Config::CONFIG['host_cpu']},host_os=#{::Config::CONFIG['host_os']},host_vendor=#{::Config::CONFIG['host_vendor']},bin_dir=#{::Config::CONFIG['bindir']},ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},)" STDOUT ----
[Thu, 29 Mar 2012 11:53:15 -0700] DEBUG: platform=i386-mingw32,version=1.9.2,release_date=2011-07-09,target=i386-pc-mingw3
@paulmooring
paulmooring / gist:3057211
Created July 5, 2012 23:57
Solaris package provider crashing
# Logfile created on 2012-07-05 16:19:15 -0700 by logger.rb/25413
[Thu, 05 Jul 2012 16:19:15 -0700] INFO: *** Chef 0.10.8 ***
[Thu, 05 Jul 2012 16:19:15 -0700] DEBUG: Loading plugin os
[Thu, 05 Jul 2012 16:19:15 -0700] DEBUG: Loading plugin kernel
[Thu, 05 Jul 2012 16:19:15 -0700] DEBUG: Loading plugin ruby
[Thu, 05 Jul 2012 16:19:15 -0700] DEBUG: Loading plugin languages
[Thu, 05 Jul 2012 16:19:15 -0700] DEBUG: ---- Begin ruby -e "require 'rbconfig'; puts %Q(platform=#{RUBY_PLATFORM},version=#{RUBY_VERSION},release_date=#{RUBY_RELEASE_DATE},target=#{::Config::CONFIG['target']},target_cpu=#{::Config::CONFIG['target_cpu']},target_vendor=#{::Config::CONFIG['target_vendor']},target_os=#{::Config::CONFIG['target_os']},host=#{::Config::CONFIG['host']},host_cpu=#{::Config::CONFIG['host_cpu']},host_os=#{::Config::CONFIG['host_os']},host_vendor=#{::Config::CONFIG['host_vendor']},bin_dir=#{::Config::CONFIG['bindir']},ruby_bin=#{::File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])},)" STDOUT -
@paulmooring
paulmooring / chef-restore.sh
Created July 13, 2012 17:58
Private Chef restore script
#!/usr/bin/env bash
# Author:: Paul Mooring (<paul@opscode.com>)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@paulmooring
paulmooring / .vimrc
Created August 10, 2012 16:48
My vimrc
" ~/.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Author: Paul Mooring
"
" Version: 1.4
" Date: 20120925
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" => General
@paulmooring
paulmooring / erlang_vimrc
Created August 24, 2012 16:01
vimrc snippet
""""""""""""""""""""""""""""""
" => Erlang section
""""""""""""""""""""""""""""""
let g:erlang_man_path='/usr/local/share/man'
let erlang_show_errors = 0
let erlang_skel_header = {'author': 'Paul Mooring <paul@opscode.com>'}
au FileType erlang call ErlangFold()
@paulmooring
paulmooring / bootstrap-debug.txt
Created September 13, 2012 18:36
Working winrm bootstrap
paul@paultop ~/chef-orgs/paul-oc $ knife bootstrap windows winrm 192.168.111.143 -r 'role[iis]' -x 'opscode' -P 'p@ssw0rd1' -VV
WARNING: Could not load IOV methods. Check your GSSAPI C library for an update
WARNING: Could not load AEAD methods. Check your GSSAPI C library for an update
DEBUG: Using configuration from /Users/paul/chef-orgs/paul-oc/.chef/knife.rb
Bootstrapping Chef on 192.168.111.143
DEBUG: Looking for bootstrap template in /Users/paul/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/knife-windows-0.5.8/lib/chef/knife/bootstrap
DEBUG: Found bootstrap template in /Users/paul/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/knife-windows-0.5.8/lib/chef/knife/bootstrap
DEBUG: Adding 192.168.111.143
DEBUG: :session => :init
DEBUG: :relay_to_servers => cmd.exe /C echo "Rendering '%TEMP%\bootstrap-3420-1347561227.bat' chunk 1" && >> %TEMP%\bootstrap-3420-1347561227.bat (echo.@rem) && >> %TEMP%\bootstrap-3420-1347561227.bat (echo.@rem Author:: Seth Chisamore ^(^<schisamo@opscode.com^>^)) && >> %
@paulmooring
paulmooring / gist:4119387
Created November 20, 2012 17:22
Reset password via script on ubuntu
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ cat test.sh
password="mypassword"
user="test"
echo -e "${password}\n${password}" | sudo passwd $user
Tue Nov 20, 10:21 AM - git branch: - rbenv version: 1.9.3-p194
paul@paul-linux ~ $ sshpass -p 'mypassword' ssh test@127.0.0.1 "whoami"
Received disconnect from 127.0.0.1: 2: Too many authentication failures for test
@paulmooring
paulmooring / addresses.rb
Created November 20, 2012 23:26
Getting addresses
nodes = search(:node, 'name:*')
nodes.each do |node|
node['network']['interfaces'].each do |int|
addresses = node['network']['interfaces'][int[0]]['addresses']
if addresses.respond_to? :each
addresses.each do |add, details|
if details['family'] == "inet" and add =~ /172\.28\.[0-9]+\.[0-9]+/
puts "#{int[0]}: #{add}"
end
APP_ROOT="/home/gitlab/gitlab"
DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
PID_PATH="$APP_ROOT/tmp/pids"
UNICORN_PID="$PID_PATH/unicorn.pid"
RESQUE_PID="$PID_PATH/resque_worker.pid"
NAME="unicorn"
DESC="Gitlab service"
sudo -u gitlab -H sh -l -c "mkdir -p $PID_PATH && nohup bundle exec rake environment resque:work QUEUE=post_receive,mailer,system_hook RAILS_ENV=production PIDFILE=$RESQUE_PID"