Skip to content

Instantly share code, notes, and snippets.

View kjetilho's full-sized avatar

Kjetil Torgrim Homme kjetilho

  • Redpill Linpro AS
  • Oslo, Norway
View GitHub Profile
@kjetilho
kjetilho / keybase.md
Created April 16, 2014 10:00
My keybase.io proof

Keybase proof

I hereby claim:

  • I am kjetilho on github.
  • I am kjetilho (https://keybase.io/kjetilho) on keybase.
  • I have a public key whose fingerprint is 74F8 22A9 A8D0 8445 BAFC A38B A594 E797 D89D 7131

To claim this, I am signing this object:

require 'spec_helper'
describe 'bareos::client::fileset' do
context "basic fileset" do
let(:title) { 'basic' }
let(:params) { { :include_paths => ['/custom'] } }
let(:facts) { RSpec.configuration.default_facts }
let(:pre_condition) { <<-eot
class bareos::client {
$client_name = $::fqdn
@kjetilho
kjetilho / phys_interfaces.rb
Created September 1, 2016 11:48
phys_interfaces fact
# phys_interfaces returns network interfaces associated with a physical device
# as a comma separated list.
#
# Written by kjetil.homme@redpill-linpro.com 2016
# Released into the public domain
require 'facter'
Facter.add("phys_interfaces") do
confine :kernel => :linux
@kjetilho
kjetilho / rspec output
Created June 22, 2017 13:01
spec/unit/facter/server_type_spec.rb
Failures:
1) server_type hostname => pro-dev-db01 should return development
Failure/Error: expect(Facter.fact(:server_type).value).to eq(result)
expected: "development"
got: "testing za-testing-bar-db02"
(compared using ==)
# ./spec/unit/facter/server_type_spec.rb:23:in `block (5 levels) in <top (required)>'
1) baseconfig::filebeat on ubuntu-14.04-x86_64 should compile into a catalogue without dependency cycles
Failure/Error: it { should compile.with_all_deps }
RuntimeError:
Could not find the daemon directory (tested [/etc/sv,/var/lib/service])
# /var/lib/gems/2.3.0/gems/puppet-4.10.10/lib/puppet/provider/service/runit.rb:50:in `defpath'
# /var/lib/gems/2.3.0/gems/puppet-4.10.10/lib/puppet/type/service.rb:180:in `block (3 levels) in <module:Puppet>'
# /var/lib/gems/2.3.0/gems/puppet-4.10.10/lib/puppet/type.rb:834:in `set_default'
# /var/lib/gems/2.3.0/gems/rspec-puppet-2.6.11/lib/rspec-puppet/monkey_patches.rb:86:in `call'
# /var/lib/gems/2.3.0/gems/rspec-puppet-2.6.11/lib/rspec-puppet/monkey_patches.rb:86:in `block in <class:Type>'
#! /bin/bash
declare -A pvalue
parse_plist() {
declare -a pl=$1
pvalue=()
local i=0
while [[ i -lt ${#pl[@]} ]]
do
ARG BASE_IMAGE=buster
FROM debian:$BASE_IMAGE
ENV DEBIAN_FRONTEND noninteractive
RUN mkdir -p /run/systemd && \
echo 'docker' > /run/systemd/container
CMD ["/bin/bash"]
#! /usr/bin/perl
#
# puppetdb 1.0 - a wrapper to simplify lookups in PuppetDB.
# Written 2018 by kjetil.homme@redpill-linpro.com
use Getopt::Long;
use LWP::UserAgent;
use URI::Escape;
use JSON;
use strict;
#! /bin/bash
#
# i3-disp-size
# Displays the focused container's dimensions in that container's corner.
#
# Written by GermainZ and kjetilho from #i3@freenode
#
# Dependencies:
#
# - i3 <https://i3wm.org/>
@kjetilho
kjetilho / my_i3status
Created June 5, 2020 08:53
wrapper for i3status which adjusts output and warns when battery is low
#! /usr/bin/perl -CSDL
use warnings;
use strict;
use utf8;
use JSON;
# Don't die when instant update is requested with a sloppy
# pkill -USR1 i3status
$SIG{USR1} = undef;