Skip to content

Instantly share code, notes, and snippets.

@adrienthebo
adrienthebo / gist:1215610
Created September 14, 2011 01:02
This is the screaming of a dying AIX hard drive
16F35C72 0820183711 P H hdisk0 DISK OPERATION ERROR
16F35C72 0820224111 P H hdisk0 DISK OPERATION ERROR
16F35C72 0821024411 P H hdisk0 DISK OPERATION ERROR
16F35C72 0821064911 P H hdisk0 DISK OPERATION ERROR
0BA49C99 0821064911 T H scsi0 SCSI BUS ERROR
16F35C72 0821064911 P H hdisk0 DISK OPERATION ERROR
49A83216 0821064911 T H hdisk0 DISK OPERATION ERROR
16F35C72 0821105411 P H hdisk0 DISK OPERATION ERROR
@adrienthebo
adrienthebo / nTerm
Created September 20, 2011 16:51
Applescript shortcut for creating a new terminal window
tell application "iTerm"
set _term to (make new terminal)
tell _term
launch session "Default"
activate
end tell
end tell
@adrienthebo
adrienthebo / puppet_interp.sh
Created January 24, 2012 00:49
Attempts to add braces around quoted interpolated strings in puppet.
#!/bin/sh
#
# Attempts to add braces around quoted interpolated strings in puppet.
#
# Caveats
#
# This is a lot of sed and duct tape. It is not very smart. It's probably the
# most horrible regex I've ever written.
# I'm sorry.
@adrienthebo
adrienthebo / apod.rb
Created February 6, 2012 22:23
Download today's apod image
#!/usr/bin/env ruby
require 'fileutils'
require 'open-uri'
def get_links
image_urls = []
# Download latest page
puts "Downloading #{$apod_url}"
open($apod_url) do |stream|
sed -e '1i\
user literarybot foo foo literarybot' -e 'i2\
nick literarybot' -e '3i\
join #example' -ne '/^[[:space:]]*$/d' -ne 's/^/PRIVMSG #example :/p' < input.txt| while read line; do sleep 1; echo $line; done | nc irc.freenode.net 6667
sed -i.bak -e \
":BEGIN
/\"[^\"']*[^\\]*\$[[:alnum:]_:].*\"/ \
s/\(\"[^\"]*\)\$\([[:alnum:]_:][[:alnum:]_:]*\)\([^\"]*\"\)/\1$\{\2\}\3/
t BEGIN" $manifest
describe 'a big laser' do
it 'can cut through steel'
it 'can shoot your eye out'
describe 'when being used for evil' do
it 'glows in an ominous fashion'
it 'crackles loudly when firing'
end
end
@adrienthebo
adrienthebo / benchmark.rb
Created January 22, 2014 06:42
ruby command execution
#!/usr/bin/env ruby
require 'benchmark'
require 'childprocess'
require 'systemu'
argv = %w[git rev-parse HEAD^{commit}]
args = argv.join(" ")
COUNT = 100
[root@default ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:0f:d2:76 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
inet6 fe80::a00:27ff:fe0f:d276/64 scope link
root@master:/etc/puppetlabs/facter/facts.d # cat foo.sh
#! /bin/sh
FACT=$(facter hostname)
echo "foo=${FACT}"
root@master:/etc/puppetlabs/facter/facts.d # chmod +x foo.sh
root@master:/etc/puppetlabs/facter/facts.d # facter ipaddress
<hangs and explodes>