Skip to content

Instantly share code, notes, and snippets.

@dcarley
dcarley / play.spec
Created December 2, 2011 12:12
RPM SPEC for Play Framework
Name: play
Version: 1.2.3
Release: 1%{?dist}
Summary: Play Framework
Group: System Environment/Daemons
License: Apache License, Version 2
URL: http://www.playframework.org/
Source0: http://download.playframework.org/releases/%{name}-%{version}.zip
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@dcarley
dcarley / file_default.pp
Created December 13, 2011 12:32
Facter file{} default owners
File {
owner => "root",
group => $::kernel ? {
"openbsd" => "wheel",
"linux => "root",
},
}
@dcarley
dcarley / README.md
Created December 28, 2011 15:08
EL5 backport of httpd_tmp_exec SELinux boolean from EL6.

Python code or modules that require ctypes can raise the following cryptic exception when run under mod_wsgi.

mod_wsgi (pid=4203): Exception occurred processing WSGI script 'xxx.wsgi'.
Traceback (most recent call last):
  File "xxx.wsgi", line 8, in simple_app
    import ctypes
  File "/usr/lib64/python2.6/ctypes/__init__.py", line 546, in <module>
    CFUNCTYPE(c_int)(lambda: None)
MemoryError
@dcarley
dcarley / snow_manifests_config.pp
Created January 19, 2012 10:42
Example Puppet module for Snow License Manager
class snow::config {
$snow_siteid = extlookup("snow_siteid")
$snow_server = extlookup("snow_server")
$snow_crontime = extlookup("snow_crontime", "30 07 * * *")
require ::snow::package
file { "/etc/snowclient.conf":
mode => 600,
content => template("snow/etc/snowclient.conf.erb"),
@dcarley
dcarley / always_array.erb
Created January 19, 2012 11:07
Comparison of foo.is_a?(Array) and [foo].flatten in ERB templates.
<% if not nocache.empty? -%>
# Disable caching for certain locations.
if (req.url ~ "<%= [nocache].flatten.join('" ||
req.url ~ "') -%>") {
return(pass);
}
<% end -%>
@dcarley
dcarley / magic_nil_variable.rb
Created January 27, 2012 10:29
Ruby magically assigns nil to untouched variable.
irb(main):001:0> foo
NameError: undefined local variable or method `foo' for main:Object
from (irb):1
from :0
irb(main):002:0> if false
irb(main):003:1> foo = "bar"
irb(main):004:1> end
=> nil
irb(main):005:0> foo
=> nil
@dcarley
dcarley / README.md
Created February 1, 2012 10:49
VirtualBox NAT interface stops responding under load

VirtualBox NAT bug

Pushing a certain quantity/mixture of data through a VB guest's NAT interface causes all TCP/UDP connections to fail for a period of time thereafter.

The only way I've been able to reliably reproduce this is to use pip(1) to download a large list of Python packages. After a number of packages have been downloaded (14~20) pip will exit with an HTTP or DNS timeout. Inbound port-forwarded SSH connections will drop with:

Connection to 127.0.0.1 closed by remote host.

This appears most likely to occur with the Intel PRO/1000 MT Desktop (82540EM) NIC. It is harder to reproduce with PCnet-FAST III (Am79C973) NICs. It is not reproducible with host-only or bridged adapters.

@dcarley
dcarley / operatingsystemmajrelease.rb
Created February 9, 2012 09:03
Puppet fact for Operating System Major Release
Facter.add("operatingsystemmajrelease") do
setcode do
begin
Facter.operatingsystemrelease
rescue
Facter.loadfacts()
end
Facter.value('operatingsystemrelease').split('.')[0,1]
end
@dcarley
dcarley / .rpmmacros
Created February 14, 2012 10:51
RPM build environment
# All packages need to be built from the root of a given VCS checkout.
%_topdir %(echo $PWD)
# Use separate directories for each package to prevent clutter.
%_sourcedir %{_topdir}/SOURCES/%{name}-%{version}
%_specdir %{_sourcedir}
# Common build/install paths.
%_tmppath %{_topdir}/INSTALL
%_builddir %{_topdir}/BUILD
@dcarley
dcarley / gist:2558180
Created April 30, 2012 13:08
Tomcat dependencies on EL6
[root@ip-10-226-102-227 ~]# yum install tomcat6
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.heanet.ie
* epel: ftp.heanet.ie
* extras: ftp.heanet.ie
* updates: ftp.heanet.ie
Setting up Install Process
Resolving Dependencies
--> Running transaction check