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 Hash # :nodoc: | |
undef_method :to_yaml | |
# Replacing the to_yaml function so it'll serialize hashes sorted (by their keys) | |
# | |
# Original function is in /usr/lib/ruby/1.8/yaml/rubytypes.rb | |
def to_yaml( opts = {} ) | |
YAML::quick_emit( object_id, opts ) do |out| | |
out.map( taguri, to_yaml_style ) do |map| | |
keys.sort_by do |k| |
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
##### Our Migration class db/iw_migration.rb ###### | |
# IW_Migration adds possibility to run PHP migrations in classic | |
# rails ActiveRecord stack. It will receive PHP class name which will be | |
# executed instead of regular AR migration. | |
class IW_Migration < ActiveRecord::Migration | |
# This will hold for us PHP class name | |
@migration_class = nil | |
# This will hold for us caller stamp from it's filename | |
@migration_stamp = nil |
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
# We will focus only on how to parse the records | |
filter { | |
# Split postfix record to basic parts | |
grok { | |
type => 'postfix' | |
pattern => '%{SYSLOGBASE}' | |
named_captures_only => true | |
} |
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
require 'rubygems' | |
require 'pp' | |
# gem install jsl-grok | |
require 'grok-pure' | |
# Variable just to DRY it | |
BASE_PATH = '/home/michal/iw/puppet/modules/logstash/files' | |
# Set where are your grok patterns stored | |
PATTERN_GLOB = [ | |
"#{BASE_PATH}/grok_patterns/*", |
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
# I want to add tag => 'nagios' to every record where: | |
# @fields.severity == "PHP Fatal" | |
filter { | |
# Does not work | |
grep { | |
match => [ "@fields.severity", "PHP Fatal" ] | |
add_tag => [ "nagios" ] | |
drop => false | |
} |
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/env ruby | |
# | |
# == History | |
# Ever wanted to transfer multiple LVM volumes from one machine to other? | |
# Ever tried it? It's not hard, but it requires a lot of (manual) steps. | |
# Things get especially annoying if you want to test it first and than | |
# transfer everything ASAP. If you like to automate things, you can try | |
# this script. It uses LVM2 snapshot mechanism, so in theory you don't | |
# need to stop any service using the volume. Of course this will ensure | |
# only LVM/filesystem-level consistency, not application-level sonsistency! |
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/env ruby | |
# | |
# == History | |
# Transfers multiple *.img files from one machine to corresponding | |
# LVM volumes on other machine. | |
# | |
# == Requirements | |
# 1) This script | |
# 2) Passwords-less sudo on destination machine | |
# 3) Sudo rights on source machine |
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
///// Problematic code | |
{{#each module in controller}} | |
{{#link-to 'forge-module.show' module}} // <-- here "is" my problem | |
{{module.name}} | |
{{/link-to}} | |
{{/each}} | |
// Created HTML: |
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
// This works: | |
return ic.ajax(url).then(function (response) {}); | |
// This throws following error: | |
return ic.ajax.request({ | |
type: "PUT", | |
url: url | |
}).then(function (response) {}); | |
// TypeError: undefined is not a function |
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
[06/05/14 23:49:20] Filip Rut: 000-default.conf ******<VirtualHost *:80> | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this | |
# value is not decisive as it is used as a last resort host regardless. | |
# However, you must set it for any further virtual host explicitly. | |
#ServerName www.example.com |
OlderNewer