Skip to content

Instantly share code, notes, and snippets.

View kronn's full-sized avatar

Matthias Viehweger kronn

View GitHub Profile
@kronn
kronn / monitors
Created November 9, 2018 09:22
thin wrapper around xrandr to determine the primary output (among others)
#!/usr/bin/env ruby
# frozen_string_literal: true
# Detect the monitor setup
#
# rubocop:disable Metrics/LineLength,Lint/MissingCopEnableDirective
command = ARGV[0]
# subcommand = ARGV[1]
# value-object with high-end regex string-parsing power
@kronn
kronn / workrave-info
Created August 29, 2018 08:43
A small tool to query workrave via DBus and implement a text-based widget for status-bars
#!/usr/bin/env /home/mviehweger/.rvm/wrappers/ruby-2.4.2/ruby
# frozen_string_literal: true
# http://trac.luon.net/data/ruby-dbus/tutorial/basic_client.html
# for ubuntu, there is d-feet
begin
require 'dbus'
rescue LoadError => e
require 'rbconfig'
@kronn
kronn / .overcommit.yml
Created September 5, 2017 11:30
Overcommit plugin for checking the license header (simpler than upstream)
PreCommit:
UpdatedLicenseHeader:
enabled: true
description: 'Checking if license is present and updated'

Keybase proof

I hereby claim:

  • I am kronn on github.
  • I am kronn (https://keybase.io/kronn) on keybase.
  • I have a public key ASAibO_1tMYCUH7PN-MxnSXnXqU8EnXmBCFc-48kHAvXmAo

To claim this, I am signing this object:

@kronn
kronn / git-review
Last active July 20, 2018 09:17
a little script to review feature-branches
#!/usr/bin/env ruby
# rubocop:disable Style/SpecialGlobalVars
begin
require 'ruby-progressbar'
rescue LoadError
system 'gem', 'install', 'ruby-progressbar'
exec "#{$0} #{ARGV.join(' ')}"
end
#!/usr/bin/env bash
# An own database for every branch
#
# 1) put this script somewhere, make it executable (chmod +x)
# 2) modify your database.yml:
# development:
# adapter: postgresql
# database: "<%= `path/to/stored_script` %>"
# 3) If you want a separate db for your branch, follow the instructions on STDERR on environment startup
@kronn
kronn / fetch_facts.sh
Last active December 15, 2015 20:40 — forked from niklas/fetch_facts.sh
#!/bin/bash
ssh_host=$1
host_name=${2:-$ssh_host}
puppet_version="2.7.1"
if [ -z "$ssh_host" ]; then
echo "please provide hostname for node to fetch facts from"
exit
fi
current_scheduler = scheduler(:availabilities)
def current_scheduler.handle_exception(job, exception)
Airbrake.do_the_right_thing(exception, other_params)
puts "job #{job.job_id} caught exception '#{exception}' - the Airbrake has been triggered"
end
@kronn
kronn / test_helper_extract.rb
Created June 16, 2011 20:00
In case you need to change Database config mid-flight
ActiveRecord::Base.connection_pool.disconnect!
ActiveRecord::Base.connection_handler.remove_connection(ActiveRecord::Base)
Rails.application.config.database = new_database_config # not strictly necessary
ActiveRecord::Base.configurations = new_database_config
ActiveRecord::Base.establish_connection
@kronn
kronn / my-gh-issues.rb
Created May 9, 2011 06:28 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'