Skip to content

Instantly share code, notes, and snippets.

View timogoebel's full-sized avatar

Timo Goebel timogoebel

View GitHub Profile
server {
listen *:80;
server_name kibana.domain.com;
access_log /var/log/nginx/kibana_access.log;
error_log /var/log/nginx/kibana_error.log;
location / {
root /var/www;
index index.html;
# Says something comforting
function comfort() {
messages[0]="I hear you."
messages[1]="I'm sorry. That's a bummer."
messages[2]="That blows."
messages[3]="Ouch. Okay, let's take a deep breath together."
messages[4]="Damn. Sounds like you're having a rough day."
messages[5]="Hey, we'll get through this together."
messages[6]="Aw man."
ind=$[$RANDOM % ${#messages[@]}]
@timogoebel
timogoebel / Gemfile
Created January 9, 2017 18:53
fog-vsphere debug
source 'https://rubygems.org'
gem 'fog'
gem 'fog-vsphere'
gem 'awesome_print'
require 'puppet'
Facter.add('puppet_ssldir') do
setcode do
Puppet.settings['ssldir']
end
end
@timogoebel
timogoebel / Gemfile
Created May 9, 2017 09:53
vmware vsphere html5 console
source 'https://rubygems.org'
gem 'fog'
gem 'fog-vsphere'
gem 'awesome_print'
gem 'pry'
@timogoebel
timogoebel / physical.json
Created July 4, 2017 17:07
facter big servers
facter --json
{
"uptime_seconds": 14927393,
"architecture": "x86_64",
"virtual": "physical",
"is_virtual": false,
"augeasversion": "1.4.0",
"kernel": "Linux",
"is_rootserver": "true",
"blockdevice_sda_size": 4000787030016,
@timogoebel
timogoebel / random_ip.rb
Created August 3, 2017 11:49
Generate a random IP in ruby
#!/usr/bin/env ruby
require 'ipaddr'
family = Socket::AF_INET
subnet_range = IPAddr.new("8.0.0.0/8", family).to_range
from = subnet_range.first(2).last
to = IPAddr.new(subnet_range.last.to_i - 2, family)
@timogoebel
timogoebel / filelock.py
Created August 18, 2017 09:42
GFS2 filelock test
import time
import fcntl, struct
lockfile = open('/media/test/lockfile', 'w')
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
while 1:
try:
fcntl.fcntl(lockfile.fileno(), fcntl.F_SETLK, lockdata)
print "I have the lock."
time.sleep(1)
@timogoebel
timogoebel / 0001-convert-skip-foreman-tasks-tables.patch
Created November 6, 2017 10:09
Skip Dynflow and Foreman Tasks tables when converting Foreman database from MySQL to Postgres
From 7d31b83218e0abad7fdaf4534c8b0629dbc944a3 Mon Sep 17 00:00:00 2001
From: Timo Goebel <mail@timogoebel.name>
Date: Mon, 6 Nov 2017 11:08:28 +0100
Subject: [PATCH] convert: skip foreman tasks tables
---
lib/tasks/convert.rake | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/tasks/convert.rake b/lib/tasks/convert.rake
# lib/foreman_solarwinds/engine.rb
config.autoload_paths += Dir["#{config.root}/app/services"]
config.autoload_paths += Dir["#{config.root}/app/services/concerns"]
config.to_prepare do
begin
::IPAM.send(:include, ForemanSolarwinds::IpamExtensions)
rescue StandardError => e
Rails.logger.warn "ForemanSolarwinds: skipping engine hook (#{e})"
end