Skip to content

Instantly share code, notes, and snippets.

@jordansissel
jordansissel / Better Usage.md
Created December 20, 2010 12:07
Strip package scripts from .deb packages (postinst, postrm, preinst, prerm)

The best way to use this tool is to hook apt's use of dpkg to run it before doing any package installs.

In your apt.conf, put this:

DPkg::Pre-Install-Pkgs {"xargs -rL1 bash /path/to/stripdeb.sh 2>&1 | logger -t stripdeb"}

Then, a demo:

% sudo apt-get install mysql-server-5.1

@tobert
tobert / cluster_netstat.pl
Created January 10, 2011 22:39
Cluster Netstat
#!/usr/bin/perl
###########################################################################
# #
# Cluster Tools: cluster_netstat.pl #
# Copyright 2007-2010, Albert P. Tobey <tobert@gmail.com> #
# #
###########################################################################
=head1 NAME
@bwmcadams
bwmcadams / tail_profile.py
Created February 26, 2011 14:32
Tail the Slow Query Log on MongoDB
#!/usr/bin/python
# Connects to localhost, 27017 by default
import sys
import pymongo
import time
if len(sys.argv) < 2:
print >> sys.stderr, "Usage: ./tail_profile.py <dbName> [hostname] [port]"
sys.exit(-1)
@vvuksan
vvuksan / gist:992206
Created May 25, 2011 23:03
URL Metrics
# Based on https://github.com/ripienaar/mcollective-plugins/blob/master/agent/urltest/urltest.rb
require 'net/http'
require 'socket'
req_url = "http://www.google.com"
url = URI.parse(req_url)
@vvuksan
vvuksan / README
Created August 16, 2011 22:01
LXC (Linux Containers Installation)
This works under Ubuntu 10.10. I tried under 10.04 LTS but the Ubuntu templates are not there. Investigating.
[ Leaving this link here for reference in case I need to do apt-get upgrade. @ohloh recommends it
http://sourceforge.net/mailarchive/message.php?msg_id=26885493 ]
To make things easy have libvirt installed ie.
sudo apt-get install libvirt-bin
Otherwise you will need to set up bridges, iptables, dnsmasq.
define iterator {
if $name =~ /test/ {
notice "found"
}
}
$a = ['abc', 'deftestghi', 'xyz']
iterator { $a: }
@rcrowley
rcrowley / graphite-deb.sh
Created April 5, 2012 14:34
Graphite Debian packaging
VERSION="0.9.9"
BUILD="betable1"
set -e -x
# Keep track of the original working directory.
OLDESTPWD="$PWD"
# Work in a temporary directory.
cd "$(mktemp -d)"
@kwilczynski
kwilczynski / block_device_type.rb
Created April 16, 2012 13:27
Check if given block device is SSD or not ...
#!/usr/bin/env ruby
rotating = []
solid_state = []
unknown = []
block_devices = '/sys/block'
exclude = %w(loop.* ram.* sr.*)
exclude = Regexp.union(*exclude.collect { |i| Regexp.new(i) })
@sroegner
sroegner / gist:4198268
Created December 3, 2012 21:31
reproducing rspec-hiera-puppet example
>>> ./modules/example/spec/classes/example_spec.rb
describe "example" do
let(:hiera_data) { { :foo_message => "bar" } }
it { should contain_notify("foo").with_message("bar") }
end
>>> ./modules/example/spec/manifests/site.pp #this just exists because rspec-puppet appears to insist on it?)
diff -urN '--exclude=CVS' '--exclude=.svn' '--exclude=.git*' '--exclude=*.swp' znc-1.0/src/Client.cpp znc-1.0-query-buffer/src/Client.cpp
--- znc-1.0/src/Client.cpp 2012-11-06 08:02:20.000000000 -0800
+++ znc-1.0-query-buffer/src/Client.cpp 2013-02-04 14:30:49.240504205 -0800
@@ -306,17 +306,29 @@
}
// Relay to the rest of the clients that may be connected to this user
- if (m_pNetwork->IsChan(sTarget)) {
+ //if (m_pNetwork->IsChan(sTarget)) {
vector<CClient*>& vClients = GetClients();