Skip to content

Instantly share code, notes, and snippets.

@kbarber
kbarber / gist:1878618
Created February 21, 2012 20:16
ruby-1.8.5 patches
[root@web1 SOURCES]# ls
irb.1 ruby-1.8.5-net-pop-CVE-2007-1558.patch ruby-1.8.5-webrick-CVE-2008-1145.patch rubyfaq-jp-990927.tar.bz2
ruby-1.8.5-array-CVE-2008-2376.patch ruby-1.8.5-openssl-CVE-2009-0642.patch ruby-1.8.5-webrick-CVE-2008-3656.patch ruby-fix-autoconf-magic-code.patch
ruby-1.8.5-array-CVE-2008-2663.patch ruby-1.8.5-progname-CVE-2008-3655.patch ruby-1.8.6-CVE-2009-4492.patch ruby-fix-rdoc-corruption.patch
ruby-1.8.5-array-CVE-2008-2725.patch ruby-1.8.5-regex-CVE-2008-3443.patch ruby-1.8.7-CVE-2010-0541.patch ruby-man-1.4.6.tar.bz2
ruby-1.8.5-bigdecimal-CVE-2009-1904.patch ruby-1.8.5-resolv-CVE-2008-3905.patch ruby-1.8.7-CVE-2011-0188.patch ruby-mode-init.el
ruby-1.8.5-cgi-CVE-2006-5467.patch ruby-1.8.5-rexml-CVE-2008-3790.patch ruby-1.8.7-CVE-2011-1004.patch ruby-multilib.patch
ruby-1.8.5-cgi-CVE-2006-6303.patch ruby-1.8.5-string-CVE-2008-2662.patch r
@kbarber
kbarber / gist:1991353
Created March 7, 2012 06:03
Puppet/Splunk/Windows
class splunk {
file { "C:\Software":
ensure => directory,
}->
file { 'C:\Software\splunk-4.3.1-119532-x64-release.msi':
source => "puppet:///modules/${module_name}/splunk-4.3.1-119532-x64-release.msi",
}->
package { "splunk-4.3.1-119532-x64-release":
source => 'C:\Software\splunk-4.3.1-119532-x64-release.msi',
@kbarber
kbarber / gist:2032141
Created March 13, 2012 22:18
puppetlabs-firewall ordering
# Always persist firewall rules
exec { "persist-firewall":
command => $operatingsystem ? {
"debian" => "/sbin/iptables-save > /etc/iptables/rules.v4",
/(RedHat|CentOS)/ => "/sbin/iptables-save > /etc/sysconfig/iptables",
},
refreshonly => true,
}
Firewall {
notify => Exec["persist-firewall"],
@kbarber
kbarber / gist:2204167
Created March 26, 2012 09:31
windows colors
require 'Win32API'
SetConsoleTextAttribute = Win32API.new('kernel32', 'SetConsoleTextAttribute', 'LL', 'I')
GetConsoleScreenBufferInfo = Win32API.new('kernel32', 'GetConsoleScreenBufferInfo', 'LP', 'I')
GetStdHandle = Win32API.new('kernel32', 'GetStdHandle', 'L', 'L')
def SetConsoleTextAttribute(attribute)
SetConsoleTextAttribute.call(@handle, attribute) != 0
end
@kbarber
kbarber / gist:2244729
Created March 29, 2012 23:05
ssd disks bonnie++
Crucial 256 GB SSD SATA III disks on my MBP:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
kb.local 16G 814 99 235530 26 117902 13 1796 91 255964 10 16909 272
Latency 17687us 677ms 826ms 148ms 22166us 4127us
Version 1.96 ------Sequential Create------ --------Random Create--------
kb.local -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
@kbarber
kbarber / gist:2245977
Created March 30, 2012 02:39
Shaving time off facter by writing the binary in C
Some facter runs on my dev box using pure ruby bin/facter:
./bin/facter 0.58s user 0.34s system 95% cpu 0.968 total
./bin/facter 0.59s user 0.34s system 96% cpu 0.964 total
./bin/facter 0.60s user 0.35s system 95% cpu 0.991 total
The (somewhat condensed) ruby code of which is here:
require 'facter/application'
Facter::Application.run(ARGV)
@kbarber
kbarber / gist:2408979
Created April 17, 2012 20:52
we allow this?
[ken@kb puppet]# cat /tmp/foo2.rb ruby-1.8.7-p352@puppet
require 'puppet'
module Puppet::Parser::Functions
newfunction(:'bad&function', :type => :statement) do |args|
puts "This should not fucking work"
end
end
puts Puppet::Parser::Functions.function("bad&function".to_sym)
@kbarber
kbarber / gist:2634645
Created May 8, 2012 12:44
Resource defaults
# cat foobar2.pp
Notify {
message => "asdf"
}
class foo {
notify { 'foo': }
Notify {
message => 'inside class foo',
}
signal_handler_init()
Using system-wide paths (NOT RUN_IN_PLACE)
Bundle resource path: /Applications/Minetest c55.app/Contents/Resources
path_data = /Applications/Minetest c55.app/Contents/Resources/data
path_userdata = /Users/ken/Library/Application Support/minetest
Debug streams initialized, disable_stderr=0
21:09:16: ACTION[main]: minetest with SER_FMT_VER_HIGHEST=22, NON-CMAKE RUN_IN_PLACE=0 USE_GETTEXT=0 BUILD_TYPE=Debug
EXCEPT: VoxelManipulator::getNode(): p=(0,0,-1), index=1, flags=2 is inexistent
EXCEPT: VoxelManipulator::getNode(): p=(0,1,1), index=25, flags=2 is inexistent
@kbarber
kbarber / gist:2778107
Created May 23, 2012 22:01
db api with multipart
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="payload"
{"command": "publish module",
"version": 123,
"payload": {"foo":"bar"}}
--AaB03x
Content-Disposition: form-data; name="files"