Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🐧
Have you built a Linux kernel recently?

Krzysztof Wilczyński kwilczynski

🐧
Have you built a Linux kernel recently?
  • Yokohama, Japan
  • 06:47 (UTC +09:00)
View GitHub Profile
@kwilczynski
kwilczynski / gist:1043592
Created June 23, 2011 20:48
uptime.graph
graph "Java Virtual Machine Uptime" do
title "#{instance.title} - Uptime"
vlabel "Days"
category "Tomcat"
args "--base 1000 --lower-limit 0 --no-gridfit --slope-mode"
scale "no"
source "uptime"
source['uptime']['draw'] = 'LINE1' # Override default AREA ...
end
@kwilczynski
kwilczynski / gist:1043594
Created June 23, 2011 20:49
uptime.source
source "uptime" do
label "Uptime"
info "Uptime in days"
type "GAUGE"
draw "AREA"
min "0"
mbean "java.lang:type=Runtime", "Uptime"
uptime = (data['value'].to_f / 1000) / 86400
@kwilczynski
kwilczynski / gist:1055987
Created June 30, 2011 10:36
Example of graph using Munin DSL ...
Graph definition file:
graph "Uptime" do
title "Uptime - #{instance.title}"
vlabel "Days"
category "Tomcat"
args "--base 1000 --lower-limit 0 --slope-mode"
scale "no"
source "uptime"
@kwilczynski
kwilczynski / gist:1069386
Created July 7, 2011 12:13
Random crontab minutes ...
#
# random_crontab_minutes.rb
#
module Puppet::Parser::Functions
newfunction(:random_crontab_minutes, :type => :rvalue, :doc => <<-EOS
EOS
) do |arguments|
raise(Puppet::ParseError, "Wrong number of arguments " +
@kwilczynski
kwilczynski / gist:1069387
Created July 7, 2011 12:13
Persistent crontab minutes ...
#
# persistent_crontab_minutes.rb
#
module Puppet::Parser::Functions
newfunction(:persistent_crontab_minutes, :type => :rvalue, :doc => <<-EOS
EOS
) do |arguments|
raise(Puppet::ParseError, "Wrong number of arguments " +
module Puppet::Parser::Functions
newfunction(:testfunction, :type => :rvalue) do |*a|
p a
p a.class
end
end
$a = inline_template("<%= scope.function_testfunction('a', 'b', 'c') %>")
$b = inline_template("<%= scope.function_testfunction('a') %>")
$c = inline_template("<%= scope.function_testfunction(['a', 'b', 'c']) %>")
@kwilczynski
kwilczynski / rubygems-fpm.control
Created August 18, 2011 14:38
Debian control file for fpm ...
Package: rubygems-fpm
Version: 0.3.7
Date: Thu, 18 Aug 2011 15:22:56 +0100
Architecture: all
Maintainer: Jordan Sissel <[email protected]>
Uploaders: Krzysztof Wilczynski <[email protected]>
Standards-Version: 3.9.1
Section: interpreters, languages, development
Priority: optional
Essential: no
@kwilczynski
kwilczynski / conntrack.c
Created August 20, 2011 21:06
I had to do it ...
diff --git a/src/conntrack.c b/src/conntrack.c
index 5364eaa..2e3d654 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -548,7 +548,7 @@ extension_help(struct ctproto_handler *h, int protonum)
static void __attribute__((noreturn))
exit_tryhelp(int status)
{
- fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
+ fprintf(stderr, "Try `%s -h' or `%s --help' for more information.\n",
@kwilczynski
kwilczynski / exists.rb
Created August 21, 2011 11:06
Puppet "exists" function ...
#
# exists.rb
#
# Copyright 2011 Puppet Labs Inc.
# Copyright 2011 Krzysztof Wilczynski
#
# 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
#
@kwilczynski
kwilczynski / gist:1160508
Created August 21, 2011 11:49
Notice wrapper ...
define file_exists_notice {
$exists = exists($name)
notice "File ${name} exists: ${exists}"
}
file_exists_notice { '/etc/hosts': }
file_exists_notice { '/abc': }
notice: Scope(File_exists_notice[/etc/hosts]): File /etc/hosts exists: true
notice: Scope(File_exists_notice[/abc]): File /abc exists: false