This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COLUMNS=`stty size | cut -d' ' -f2` | |
exec git diff --stat=$COLUMNS,$(($COLUMNS - 20)) "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby; coding: utf-8 -*- | |
# Requires fog gem. | |
# Configure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in config/rake.rb | |
desc <<EOF | |
Delete nodes and clients for nonexistent EC2 instances from chef server | |
YES=1 variable makes task skip confirmation questions. | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- ruby -*- | |
# Needs following parameters configured in rake.rb: | |
# DNS_DOMAIN: domain for which to set entries, including trailing dot | |
# (e.g. "example.com.") | |
# DNS_ATTRIBUTE: attribute containing hostname to CNAME to, defaults | |
# to 'fqdn'; for EC2, use "ec2.public_hostname" | |
# DNS_ENTRIES: hash mapping hostname to node search query, | |
# e.g. {'buildbot' => 'recipes:buildbot', 'monitoring' => | |
# 'roles:monitoring'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.chef/shef.rb | |
begin | |
# Load configuration from knife.rb | |
require 'chef/knife' | |
Chef::Knife.new.configure_chef | |
rescue | |
puts <<-EOF | |
Can't load knife config: #{$!} | |
This is probably nothing serious. | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backports_apt_package.rb | |
# | |
# Resource and provider to correctly install packages from Debian's | |
# backports, which are a non-default apt source. Creates | |
# backports_apt_package resource which does the Right Thing. | |
# | |
# Drop this file into cookbook's libraries/ dir. | |
require 'chef/provider/package/apt' | |
require 'chef/resource/package' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chef | |
class Util | |
class FileEdit | |
public | |
# Run block for matching lines, passing it matching line. | |
# Replaces matching lines with value returned by the block. | |
def g(regex) | |
exp = Regexp.new(regex) | |
new_contents = [] | |
contents.each do |line| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Author:: Maciej Pasternacki (<maciej@pasternacki.net>) | |
# Copyright:: Copyright (c) 2010 Maciej Pasternacki | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data bag items in 'projects' can declare 'include_recipes' property | |
# (list or string); these recipes will be included in the | |
# projects::default recipe, but - if they're not already loaded - need | |
# to be declared in 'depends'. This code loads the data bag JSON from | |
# files, and declares all needed dependencies. | |
require 'json' | |
soft_deps = [] | |
Dir[File.join( File.dirname(__FILE__), | |
'../../data_bags/projects/*.json' )].each do |p| | |
soft_deps |= File::open(p) { |f| JSON::load(f) }["include_recipes"].to_a. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# knife.rb config snippet to make knife ssh command use your own login | |
# instead of hard-coded `root', `ubuntu' or other name. Tries to get | |
# login for your domain from ~/.ssh/config and if it's not found | |
# there, uses your local login. | |
require 'net/ssh' | |
require 'etc' | |
knife[:ssh_user] = | |
Net::SSH::Config.for('some.host.inside.your.domain')[:user] || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# | |
# check_with_hysteresis.pl - hysteresis for nagios service checks' limits | |
# | |
# Usage: check_with_hysteresis.pl $LASTSERVICESTATE$ default check --- STATE1 check for state1 --- STATE2 check for state2 ... | |
# | |
# If $LASTSERVICESTATE$ is STATE1, "check for state1" will be | |
# executed, if it's STATE2, "check for state2" will be executed, and | |
# so on; if state is undefined, "default check" wil be executed. | |
# |