Skip to content

Instantly share code, notes, and snippets.

View mrjcleaver's full-sized avatar

Martin Cleaver mrjcleaver

View GitHub Profile
@charlesjohnson
charlesjohnson / gemrc.erb
Last active August 29, 2015 14:05
Use a .gemrc file with Omnibus chef-client
:sources:
- http://<%= node['gem_file']['host'] %>:<%= node['gem_file']['port'] %>/
@davidgiesberg
davidgiesberg / README.md
Created September 30, 2014 02:30
Shellshock Chef Updates for Ubuntu

We added these bits to one of our base cookbooks that gets applied to every node.

Because apt doesn't allow you to specify a minimum version for a package to be installed, I had to build an approximation of that logic in this recipe. Basically, what we do is check for a bash package version that is less than what is specified in the node attributes for that platform. If and only if the installed version is less than the min_pkg_ver attribute, we notify apt_package[bash] to run the :upgrade action. That ought to prevent us from updating bash unnecessarily, but also ensuring that we are never running an unpatched bash.

(Also, handy thing to note is the execute[apt-get update] - that's using the apt cookbook to force an apt-get update to run immediately. If you don't do that, bash won't update until apt has updated AND this chef recipe runs again.

@sczizzo
sczizzo / report_log.rb
Created February 7, 2015 23:49
Log Handler
require 'chef/handler'
require 'chef/log'
require 'json'
# Based on https://docs.chef.io/handlers.html#cookbook-versions
# and http://dev.nuclearrooster.com/2011/05/10/chef-notifying-and-logging-updated-resources
module Handlers
function MyObject () {
// do stuff
}
// now to export this as a nodejs module do
module.exports = MyObject;
// =====
// in another file (in the same folder) you can now do
@bashcoder
bashcoder / logstash_apache_json_macro.conf
Created August 4, 2013 18:15
Logstash JSON logging in Apache, using mod_macro. Debugged and enhanced from the original version found at: http://cookbook.logstash.net/recipes/apache-json-logs/
# logstash_apache_json_macro.conf
#
# Create a Macro named logstash_log that is used in the VirtualHost
# It defines, on the fly, a macro for the specific vhost $servername
# and anchors its @source, $source_host and @source_path.
#
# In addition, it prevents any non-page resources from getting logged.
#
# It also adds three tags: web, apache, and the servername
#
@jakeasmith
jakeasmith / .bash_aliases
Last active December 24, 2015 17:09
I used to have a bash profile somewhere with a lot of goodies in it, but it got lost in the shuffle between jobs this year. Feel free to copy, fork and do whatever you want with it. All I ask is that if you do something cool let me know so I can use it too!
# Colors
DARK_PURPLE="\[\033[1;34m\]"
GREEN="\[\033[0;32m\]"
GREY="\[\033[1;30m\]"
NORMAL="\[\033[0m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
# Git shortcuts
alias gci='git commit'
@rottenbytes
rottenbytes / check_ls.sh
Created November 12, 2013 19:59
Check if the logstash indexing is right on time
curl -s "a.b.c.d:9200/logstash-2013.11.12/_search?pretty" -d '{
"query": {
"match_all": {}
},
"from": 0,
"size": 1,
"fields": [ ],
"sort": {
"@timestamp" : "desc"
}
@ssbarnea
ssbarnea / jira-disabled-old-users.groovy
Created July 24, 2012 16:21
jira-disable-old-users
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.bc.projectroles.ProjectRoleService
import com.atlassian.jira.security.GlobalPermissionManager
import com.atlassian.jira.security.Permissions
import com.atlassian.jira.security.roles.actor.UserRoleActorFactory
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.util.SimpleErrorCollection
import com.atlassian.crowd.embedded.api.Group
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.user.util.UserManager
@ericgray
ericgray / esxiso2pxe
Created March 17, 2014 18:21
Shell script that automates the process of extracting and modifying contents of ESXi ISO for install via PXE boot. See http://www.vcritical.com/2014/03/automatically-prepare-an-esxi-iso-image-for-pxe-booting/
#!/bin/bash
# esxiso2pxe - quickly extract contents of ESXi ISO image for use on a PXE server
# 17Mar2014 - egray
if [ $# != 3 ]; then
echo "Usage: $0 <tftpboot dir> <new dir name> <ESXi ISO file>" >&2
exit 1
fi
@dodok1
dodok1 / gist:4352500
Last active February 19, 2018 19:02
prototype for confluence content parsing # Get Confluence XML Schema # Put confluence.dtd and xhtml-*.ent to your working directory # Try attached groovy script
import groovy.xml.XmlUtil
def content=new File(args[0]).getText()
def slurper = new XmlSlurper(false,false)
def prefix = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ac:confluence SYSTEM "confluence.dtd">
<ac:confluence xmlns:ac="http://www.atlassian.com/schema/confluence/4/ac/" xmlns:ri="http://www.atlassian.com/schema/confluence/4/ri/" xmlns="http://www.atlassian.com/schema/confluence/4/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.atlassian.com/schema/confluence/4/ac/ confluence.xsd">
"""
def suffix = "</ac:confluence>"
def xml = slurper.parseText(prefix+content+suffix)