Skip to content

Instantly share code, notes, and snippets.

View mrpatrick's full-sized avatar

Patrick Tully mrpatrick

View GitHub Profile
@mrpatrick
mrpatrick / httpd.rb
Created February 13, 2012 19:17
facter plugin to show apache version
#
# httpd.rb - facter to show apache version
#
output=`/usr/sbin/httpd -v | sed 's/[://]/ /g' |awk '/version/ {print $4}'`
if output
Facter.add("apache") do
setcode do
output
end
@mrpatrick
mrpatrick / puppetvar_list.sh
Created April 20, 2012 20:20
List all puppetVar stored in ldif files - used for documenting puppetVars used
cat [LDIF_DIR]* | grep puppetVar | egrep -o ' .*=' |sort -u | sed 's/[= ]//g'
@mrpatrick
mrpatrick / emacs_cheet_sheet
Last active April 9, 2017 10:18
emacs cheat sheet
C-x r t - insert char on entire selection
M-$ - flyspell the word the cursor is on (or near)
M-v - page up
X-m - smerge-mode (syntax highlight git merge conflicts)
(set-face-attribute 'default nil :height 100) - increase font size
prepend string - entire region
`M-x string-insert-rectangle RET`
@mrpatrick
mrpatrick / puppet.conf_config_version
Created April 25, 2012 16:43
Set the config_version to git version in puppetmaster puppet.conf file
config_version = /usr/bin/git --git-dir /etc/puppet_[name]/.git describe --long
@mrpatrick
mrpatrick / puppet_apply_locally.sh
Created April 27, 2012 00:28
puppet apply locally
$ cd ~/projects/puppet/modules/mymodule/manifests
$ sudo puppet apply --modulepath=~/projects/puppet/modules/ -e "include client"
@mrpatrick
mrpatrick / ga_js_demo_fixed.html
Created May 10, 2012 21:04
Google Analytics Easy Dashboard Javascript Library demo
<!DOCTYPE>
<html>
<head><title>GA Dash Demo</title></head>
<body onload="chart1.render();" >
<!-- Add Google Analytics authorization button -->
<button id="authorize-button" style="visibility: hidden">
Authorize Analytics</button>
<!-- Div element where the Line Chart will be placed -->
@mrpatrick
mrpatrick / rspec_test
Created September 3, 2012 14:31
rspec test
rspec --color --format documentation spec/classes/rule_spec.rb
@mrpatrick
mrpatrick / rackspace_backup.pp
Created September 6, 2012 21:46
Example usage of puppet-cloudbackup
# puppet-cloudbackup Example usage
class rackspace_backup {
class {'cloudbackup':
username => 'myusername',
api_key => 'xxxxxxxxxxxxxxxxxxxx',
}
}
@mrpatrick
mrpatrick / puppet.repo
Created September 23, 2012 19:58
Puppet Repo file
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/$releasever/products/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
@mrpatrick
mrpatrick / get_ssl_expire_date
Created December 18, 2012 19:02
Get expiration date date of SSL Cert from website
# Get expiration date date of SSL Cert from website
echo '' | openssl s_client -connect www.avatarnewyork.com:443 2>>/dev/null | openssl x509 -dates | grep "notAfter" | cut -d= -f 2