Skip to content

Instantly share code, notes, and snippets.

View jskarpe's full-sized avatar

Jon Skarpeteig jskarpe

  • Signicat AS
  • Norway
View GitHub Profile
#!/usr/bin/ruby
require 'socket'
hostname = ARGV[0]
port = ARGV[1]
filename = ARGV[2]
begin
socket = TCPSocket.new( hostname, port )
socket.send( "zINSTREAM\0", 0)
@ollyg
ollyg / logstash.conf
Created June 20, 2012 13:29
logstash config and filter to fully parse a syslog message (PRI, timestamp, host)
filter {
# strip the syslog PRI part and create facility and severity fields.
# the original syslog message is saved in field %{syslog_raw_message}.
# the extracted PRI is available in the %{syslog_pri} field.
#
# You get %{syslog_facility_code} and %{syslog_severity_code} fields.
# You also get %{syslog_facility} and %{syslog_severity} fields if the
# use_labels option is set True (the default) on syslog_pri filter.
grok {
type => "syslog-relay"
@gnutix
gnutix / DoctrineDbalStatementInterface.php
Created December 2, 2013 09:07
Mock Builder for Doctrine EntityManager / Connection mock objects.
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
@jskarpe
jskarpe / build.xml
Last active June 22, 2016 06:12
Puppet module testing with acceptance tests in parallel using Apache Ant. Simplifies integration with Jenkins
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="build">
<target name="build" depends="clean,bundle-install,syntax,lint">
<antcall target="spec" />
<antcall target="acceptance" />
</target>
<target name="clean">
<delete includeemptydirs="true" removeNotFollowedSymlinks="true" failonerror="false">