Skip to content

Instantly share code, notes, and snippets.

View frimik's full-sized avatar

Mikael Fridh frimik

  • Electronic Arts / DICE
  • Uppsala, Sweden
View GitHub Profile
@frimik
frimik / mediatomb-samsung.xml
Created January 17, 2012 15:07
Mediatomb configuration for Samsung TV
<custom-http-headers>
<!-- Samsung needs it -->
<add header="transferMode.dlna.org: Streaming"/>
<add header="contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"/>
</custom-http-headers>
@frimik
frimik / post-receive.irc
Created February 13, 2012 23:13
git post-receive IRC notification
#!/bin/bash
#
# IRC notification post-receive hook.
# Based on https://wiki.icinga.org/display/community/GIT+Commit+Bot
#
# Author: Mikael Fridh <frimik@gmail.com>
#
# This script pulls out the commit information and sends it to
# the Notify plugin in supybot via localhost 5050.
#
@frimik
frimik / vimrc.example
Created February 14, 2012 09:37
example vimrc
" http://vim.wikia.com/wiki/Example_vimrc:
set nocompatible
" load the pathogen bundle loader plugin
call pathogen#infect()
syntax on
filetype indent plugin on
" This is to standardize style across all our projects:
set shiftwidth=2
@frimik
frimik / breakage.pp
Created February 15, 2012 21:49
replacement define for the package type on yum systems
define breakage ($ensure="present") {
if $ensure == "absent" {
exec { "yum_remove_${name}":
command => "yum -y remove ${name}",
user => "root",
onlyif => "rpm -q ${name}",
}
} else {
package { "$name":
ensure => $ensure,
@frimik
frimik / warranty.rb
Created February 15, 2012 22:33
Dell warranty fact
# Dell Facter module
#
# Author: Mikael Fridh <mfridh@marinsoftware.com>
# Date: 2011-11-24
#
# this is a rather substantial rewrite of the camptocamp puppet module
# https://github.com/camptocamp/puppet-dell
#
# The regex matching has been ripped out completely and replaced with
# some xpath expressions from Nokogiri. Unfortunately this means another
@frimik
frimik / privmsg
Created February 28, 2012 09:24
IRC notification script (Uses supybot-notify, or a similar IRC bot)
#! /usr/bin/env ruby
# Send privmsg (IRC notifications).
# Contacts a supybot-notify service, on a currently hardcoded host and port,
# and sends either the message sent as a parameter, or pipes everything from
# standard input
#
# Author: Mikael Fridh <mfridh@marinsoftware.com>
# Copyright (c) 2012 Marin Software
#
@frimik
frimik / drac.rb
Created March 12, 2012 12:52
Dell iDRAC facter plugin
# Fact: racadm
#
# Purpose: Return the racadm information from Dell hardware
#
# Resolution:
# On Linux, queries racadm getconfig -g for each group in the query hash
#
# Author: Mikael Fridh <mfridh@marinsoftware.com>
#
# TODO Instead of sweeping output once per key, sweep once and
@frimik
frimik / ssh-clean.sh
Created March 30, 2012 13:47
ssh-clean: convenience function for cleaning up changed host keys.
# clean known host key of a certain host.
# attempts reverse dns lookup.
# requires dig
if [ -z "$1" ]; then
echo "Usage: ssh-clean hostname"
return
fi
arg=${1#*@}
echo "Cleaning for $arg..."
@frimik
frimik / subnet.pp
Created April 21, 2012 22:25
dhcp::subnet support snippet
class my_dhcp::example {
$subnets = {
'the main subnet' => {
network => '10.0.0.0',
netmask => '255.255.255.0',
gateway => '10.0.0.1',
domain => 'example.com',
parameters => [ ],
pools => {
@frimik
frimik / gist:2489220
Created April 25, 2012 11:59
Foreman - Update hosts that moved between two subnets
/* copy ipaddress facts onto the hosts where the old IPs were 10.100.* and the new IPs are now 10.6* */
update hosts h
join
fact_values fv ON (h.id = fv.host_id)
join fact_names fn ON (fv.fact_name_id = fn.id)
set h.ip=fv.value
where
h.ip LIKE '10.100.%' fn.name='ipaddress'
AND fv.value LIKE '10.6%';