Skip to content

Instantly share code, notes, and snippets.

@jumanjiman
jumanjiman / manifests_slash_samba.pp
Created March 6, 2012 01:47
verify if host is properly joined to AD domain
class authconfig::samba {
require authconfig::params
require authconfig::packages
require authconfig::kerberos
require authconfig::ldap
require expect
File {
mode => 0644,
@jumanjiman
jumanjiman / tmpcooker.sh
Created March 15, 2012 17:36
get list of all xorg drivers in puppet package format
#!/bin/bash
filename=$(mktemp --tmpdir=/dev/shm/ cooker.XXXXX)
echo -n "finding drivers..." >&2
yum list all \
| awk -F. '/xorg-x11-drv/{print $1}' \
| grep -v debuginfo \
| sort -u \
> $filename
@jumanjiman
jumanjiman / rpmsack.patch
Created April 2, 2012 13:43
make yum error more useful than 'unknown header tag'
--- rpmsack.py.orig 2012-02-06 13:12:54.000000000 -0500
+++ rpmsack.py 2012-02-06 13:29:20.000000000 -0500
@@ -67,9 +67,13 @@
if varname.startswith('__') and varname.endswith('__'):
raise AttributeError, "%s has no attribute %s" % (self, varname)
- if varname != 'hdr': # This is unusual, for anything that happens
- val = val[varname] # a lot we should preload at __init__.
- # Also note that pkg.no_value raises KeyError.
+ if varname != 'hdr':
@jumanjiman
jumanjiman / valgrind.spec
Created April 12, 2012 18:57
valgrind spec file
Summary: Tool for finding memory management bugs in programs
Name: valgrind
Version: 3.6.0
Release: 4%{?dist}
Epoch: 1
Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2
Patch1: valgrind-3.6.0-cachegrind-improvements.patch
Patch2: valgrind-3.6.0-openat.patch
Patch3: valgrind-3.6.0-glibc-2.10.1.patch
Patch4: valgrind-3.6.0-helgrind-race-supp.patch
require 'irb/completion'
require 'puppet'
require 'pp'
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'application' %>
@jumanjiman
jumanjiman / user_steps.rb
Created June 28, 2012 20:09 — forked from danielmorrison/user_steps.rb
put in features/step_definitions/user_steps.rb
Given "I am signed in" do
user = User.create!(:email => 'alice@example.com' :password => 'password', :password_confirmation => 'password'
step 'I go to the homepage'
step 'I follow "Sign In"'
step %Q|I fill in "user_email" with "#{user.email}"|
step 'I fill in "user_password" with "password"'
step 'I press "Sign in"'
end
@jumanjiman
jumanjiman / pre-commit
Created August 6, 2012 15:00
cross-platform git pre-commit hook for puppet repos
#!/usr/bin/env ruby
# An example cross-platform (Linux, Windows, Mac, etc.)
# pre-commit hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
# To enable this hook:
# - save this file as <path-to-git-clone>/.git/hooks/pre-commit
@jumanjiman
jumanjiman / puppet-compilation-time.rb
Created August 15, 2012 18:32
read /var/log/messages in ruby 3 different ways for performance profiling
#!/usr/bin/env ruby
require 'fileutils'
require 'net/smtp'
today = %x!date +'%Y-%m-%d'!.chomp
counter = 0
sum = 0.0
@jumanjiman
jumanjiman / audit-rpm.rb
Created September 5, 2012 14:42
demo of storing rpm name:version data in yaml, then simulate creating puppet package resources based on that
#!/usr/bin/env ruby
require 'yaml'
require './helpfulfunctions'
include HelpfulFunctions
rc = 1
begin
in_file = ARGV[0]