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
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
# Run with `python app_zabbix.py` to execute doctests | |
import sys | |
from ansible.plugins.lookup import LookupBase | |
try: | |
from __main__ import display | |
except ImportError: |
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/ruby | |
require 'rubygems' | |
require 'rake' | |
KNOWN_FILE_TYPES = %w(rb txt py yaml erb pp feature j2) | |
# Based on work by Mike Clark. | |
# | |
# From http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc | |
# Modified (with permission) by Geoffrey Grosenbach to call growlnotify for |
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/ruby | |
require 'rubygems' | |
require 'rake' | |
KNOWN_FILE_TYPES = %w(rb txt py yaml erb pp) | |
# Based on work by Mike Clark. | |
# | |
# From http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc | |
# Modified (with permission) by Geoffrey Grosenbach to call growlnotify for |
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 -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 3001, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start" |
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 | |
#Script to test puppet files have valid syntax. | |
#Intended for use with hudson/jenkins. | |
set -e | |
set -u | |
fail=0 | |
#TODO: Run these in parallel - we have 4 cores. | |
#TODO: Control the environment (through the config dir?). |
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
# Modifies a pragprog's epub archive to use more suitable fonts on Sony | |
# PRS-505 eBook Reader. | |
task :default => :help | |
def in_filename | |
ENV['input'] | |
end | |
def out_filename |
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
# Demonstrates a secure usage of sessions in Sinatra | |
# for authentication and notices. | |
require 'rubygems' | |
require 'sinatra' | |
configure :production, :test do | |
use Rack::Session::Cookie, | |
:key => 'rack.session', | |
:domain => '.example.com', # use a wildcard with leading | |
# dot and at least two dots in total |
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
# Check the impact of Nokogiri builder / HAML engine caching | |
require 'benchmark' | |
require 'sinatra-nokogiri-menu.rb' | |
require 'haml' | |
def render_with_haml(current = nil) | |
@engine ||= Haml::Engine.new <<here | |
%ul | |
- MENU_ITEMS.each do |item| | |
- opts = {} |
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
# Helps to organize and structure your tests with | |
# * human readable test names | |
# * flagging tests as pending | |
# * structuring the test implementation with blocks | |
# Please see the documentation of single methods below. | |
# Written by Vladimir Dobriakov | |
# See http://blog.geekq.net/2009/11/25/minimalist-testing-ruby/ for explanation | |
require 'minitest/unit' | |
class String |