Skip to content

Instantly share code, notes, and snippets.

Christoph Olszowka colszowka

Block or report user

Report or block colszowka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
colszowka / .rubocop
Created Sep 21, 2017
Rubocop Inline Disable Lint/RescueWithoutErrorClass Issue
View .rubocop
colszowka / dns_check.rb
Last active May 17, 2019
Ruby DNS Check
View dns_check.rb
require 'resolv'
class DnsCheck
attr_reader :host
def initialize(host)
@host = host
def a
@a ||=, Resolv::DNS::Resource::IN::A)
colszowka / heroku-shell
Created Feb 17, 2014
A very simple shell for the heroku CLI that allows you to avoid typing `heroku` and `--app app_name` all the time
View heroku-shell
#!/usr/bin/env ruby
require "readline"
unless APP_NAME
STDERR.puts "Usage: #{$0} HEROKU_APP_NAME"
exit 1
colszowka / cov.rb
Last active Dec 18, 2015
Quick demo of the problem of resetting Ruby STDLIB's Coverage mid-way
View cov.rb
# On "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]", but should be the same on all 1.9+
require 'coverage'
require './foo'
puts Coverage.result
# {"foo.rb"=>[1, 1, 0, nil, nil, 1, 0, nil, nil]}
puts Coverage.result
View 1-ruby_socket.rb
# Blocks while a client is connected, and does not time out automatically
require 'socket'
require 'etc'
Socket.unix_server_loop("/tmp/sock") do |socket|
login = Etc.getpwuid(socket.getpeereid.first).name
puts "#{login} connected"
input = socket.gets.strip
puts "#{login} sent #{input}"
View gist:777923
# Works as expected
$ rvm use 1.9.2
Using /Users/colszowka/.rvm/gems/ruby-1.9.2-p136
~ 1.9.2-p136 $ irb
>> "1.9".respond_to?(:encoding)
=> true
>> 7.123.round
=> 7
>> 7.123.round(2)
=> 7.12
View redmine_svn_to_git_migrator.rb
# Migration Tool for Redmine issue and time entry comments from SVN revisions to Git (i.e. r1234 => commit:abcdef789)
# ==============================
# (c) 2009 Christoph Olszowka & Sebastian Georgi, Capita Unternehmensberatung
# We used this when we migrated two of our main repositories from svn to git (see
# and wanted to have our revision links in Redmine reflect that change, too.
# Migration tool from SVN to git
# ==============================
# (c) 2009 Christoph Olszowka, Capita Unternehmensberatung
# This is not meant for usage in an actual shell script - you're better off running
# each individual block (marked by the comments) separately and check the output to see if everything
# went right - this is more a writeup of the required steps so I can remember them rather than a
# shoot-and-forget-solution.
View gist:63948
# Will find the rdoc paths of your local gems and generate a html index frameset which will let you select
# the desired gem's rdoc from a dropdown navigation...
# Specify your local gems installation's doc directory and the desired html output path, open the generated index.html
# in the output path in your favorite browser and add a boomark.
# You might want to add the script into your path for easy access or put it in a cron job.
# Tested on Ubuntu 8.10, but really should work anywhere with proper gem install path set
You can’t perform that action at this time.