Skip to content

Instantly share code, notes, and snippets.

@loe
loe / p4merge.sh
Created March 11, 2013 20:53
p4merge script
#!/bin/bash
for arg; do [[ $arg = /* ]] || arg=$PWD/$arg; absargs+=("$arg"); done;
/Applications/p4merge.app/Contents/Resources/launchp4merge "${absargs[@]}"
$ sudo mdadm --grow /dev/md0
mdadm: metadata format 01.01 unknown, ignored.
mdadm: no changes to --grow
Personalities : [raid0]
md0 : active raid0 sdh[0] sdi[3] sdg[2] sdf[1]
419429376 blocks super 1.1 256k chunks
unused devices: <none>
sudo xfs_growfs -d /dev/md0
meta-data=/dev/md0 isize=256 agcount=17, agsize=6553536 blks
= sectsz=512 attr=0
data = bsize=4096 blocks=104857344, imaxpct=25
= sunit=64 swidth=256 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal bsize=4096 blocks=32768, version=1
= sectsz=512 sunit=0 blks, lazy-count=0
realtime =none extsz=1048576 blocks=0, rtextents=0
data size unchanged, skipping
@loe
loe / reset_session_fix.rb
Created April 23, 2012 21:06
Monkey Patch Rails 2.3 reset_session to work correctly (especially if you use something like Intercession)
class ActionController::Request
def reset_session
by = session.instance_variable_get(:@by)
session.destroy if session and session.respond_to?(:destroy)
self.session = ActionController::Session::AbstractStore::SessionHash.new(by, @env)
end
end
# rabbitmq-collectd-plugin - rabbitmq_info.py
#
# Author: Daniel Maher (http://www.dark.ca/)
# Description: This plugin uses collectd's Python plugin to obtain Rabbitmq metrics.
#
# Loosely based on Garret Heaton's "redis-collectd-plugin"
# https://github.com/powdahound/redis-collectd-plugin
import collectd
require 'puppet'
require 'net/http'
require 'net/https'
FOREMAN_HOST = 'your.domain.com'
FOREMAN_PORT = 443
Puppet::Reports.register_report(:foreman) do
Puppet.settings.use(:reporting)
desc "Sends reports directly to Foreman"
# Query Foreman
# example usage:
#
# query for hosts
# ~~~~~~~~~~~~~~~
# $myhosts = foreman("hosts","facts.domain ~ lab")
# returns all hosts which have lab as part of their domain.
#
# or a more complex search term
# $myhosts = foreman("hosts", "hostgroup ~ web and environment = production and status.failed = 0 and facts.timezone = EST and last_report < \"1 hour ago\""
# Have the Source use the main_search database if it exists.
module ThinkingSphinx
class Source
def set_source_database_settings(source)
config = @database_configuration
source.sql_host = config[:main_search] || config[:host] || "localhost"
source.sql_user = config[:username] || config[:user] || 'root'
source.sql_pass = (config[:password].to_s || "").gsub('#', '\#')
source.sql_db = config[:database]
@loe
loe / my.cf
Created November 1, 2011 17:17
[client]
loose-default-character-set = utf8
[server]
max_allowed_packet = 128M
default-character-set = utf8
default-collation = utf8_general_ci
innodb_buffer_pool_size = 256M
innodb_file_per_table