Skip to content

Instantly share code, notes, and snippets.

View clifferson's full-sized avatar

Cliff Erson clifferson

View GitHub Profile
@clifferson
clifferson / noit.rb
Created August 17, 2012 04:51 — forked from thommay/noit.rb
Modify a file line inline in chef
ruby_block "configure #{p} module" do
block do
require 'chef/util/file_edit'
nc = Chef::Util::FileEdit.new("/etc/reconnoiter/noit.conf")
nc.insert_line_after_match(/lua.*noit.module.smtp/, "<module loader=\"lua\" name=\"#{p}\" object=\"noit.module.#{p}\"/>")
nc.write_file
Chef::Log.info "Inserted module config for #{p}"
end
http://tickets.opscode.com/browse/CHEF-78?focusedCommentId=10781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-10781
@clifferson
clifferson / knife-config
Created November 10, 2012 04:11 — forked from capoferro/knife-config
Shell script to swap knife configs
#!/bin/sh
die () {
echo >&2 "$@"
exit 1
}
available_configs () {
echo "Available configs:"
ls -A ~ | grep .chef- | sed 's/.chef-//'
}
@clifferson
clifferson / hack.sh
Created December 6, 2012 13:30 — forked from DAddYE/hack.sh
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@clifferson
clifferson / gist:4243867
Created December 9, 2012 08:20
chef-solr change solr document commit interval
/var/lib/chef/solr/home/conf/solrconfig.xml
<autoCommit>
<maxDocs>100</maxDocs>
<maxTime>60000</maxTime>
</autoCommit>
@clifferson
clifferson / gist:4399205
Last active December 10, 2015 07:09 — forked from grantm/gist:4367372
scp override function for when you forget the :.
# a useful addition to anyone's .bashrc
#
# Note, you don't want this function in effect on the remote host side of the scp transfer,
# so make sure to only define it for interactive shells, e.g.: wrap with: if [ ! -z "$PS1" ]
function scp() {
if echo "$@" | grep -q ':'
then
/usr/bin/scp "$@"
else
@clifferson
clifferson / gist:4570717
Created January 19, 2013 04:17
If your chef-server checksum dir gets out of whack with couchdb
/usr/bin/find /var/cache/chef/checksums/ -maxdepth 1 -type f -ctime +1 -delete
Then delete all the checksums in CouchDB using Shef:
require 'chef/checksum'
r = Chef::REST.new('http://localhost:5984/chef/_design/checksums/_view/', false, false)
r.get_rest("all")["rows"].each do |c| c["value"].cdb_destroy end
@clifferson
clifferson / gist:4576573
Created January 20, 2013 03:50
Compact couchdb with curl
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact
@clifferson
clifferson / Vagrantfile
Last active December 12, 2015 01:08
Vagrantfile for celery using rabbitmq and worker recipe.
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'berkshelf/vagrant'
Vagrant::Config.run do |config|
config.vm.host_name = "celery-berkshelf"
#config.vm.box = "Berkshelf-CentOS-6.3-x86_64-minimal"
#config.vm.box_url = "https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box"
@clifferson
clifferson / gist:5440326
Created April 23, 2013 02:20
Find out what repo an rpm was installed from
yum-utils provides repoquery
For a single package, you can find this with
repoquery -i package
PACKAGE=ruby-enterprise
repoquery --qf "%{repoid}" $PACKAGE
Replace $PACKAGE with the name of the package you care about.
@clifferson
clifferson / gist:5834687
Created June 21, 2013 22:03
install pcre on a virtual box OSX.
brew install -vd pcre