Skip to content

Instantly share code, notes, and snippets.

View svenfuchs's full-sized avatar

Sven Fuchs svenfuchs

View GitHub Profile
@svenfuchs
svenfuchs / optparse-template.rb
Created May 24, 2019 21:53 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"

Keybase proof

I hereby claim:

  • I am svenfuchs on github.
  • I am svenfuchs (https://keybase.io/svenfuchs) on keybase.
  • I have a public key whose fingerprint is FEB0 A93F B199 EB4C CE1C B79B 60B8 9DF8 875A 4114

To claim this, I am signing this object:

@svenfuchs
svenfuchs / csv2md
Last active August 29, 2015 14:14
convert csv to markdown
#!/usr/bin/env ruby
require 'csv'
filename = ARGV.shift
def format(questions, answers)
answers.map.with_index do |answer, ix|
"##### #{questions[ix]}\n\n#{answer}\n\n"
end
Some notes on remote debugging mac builds on Travisci. It's hard to tell when something hangs what the cause it. Trial and error via commits is tedious. And on Mac , sometimes it's the gui asking for input. So I worked my around to get the access I needed for faster debugging a build.
#################################################
# Enable remote ssh access to travisci build for debugging
#################################################
# Add a key so we can login to travisci vm
- cat ssh/travisci.pub >> ~/.ssh/authorized_keys
- chmod 600 ssh/travisci
# Install netcat
@svenfuchs
svenfuchs / _readme.md
Last active May 21, 2021 19:19
tmux-vim integration to transparently switch between tmux panes and vim split windows tmux based version that does not require a vim plugin

Based on Mislav's gist and vim-tmux-navigator.

Since tmux hosts vim I disliked that I had to install a vim plugin for this. Instead I think it's cleaner to control vim from tmux.

My actual goal was to achive the following behaviour though (I have a default setup similar to the one Mislav shows in the gist. Two vertically split tmux panes, where the left one hosts vim, which has two vertically split windows):

  • On the leftmost window in vim: when I hit C-h (do not wrap to the rightmost tmux pane, but) zoom the left tmux pane.
  • On the rightmost tmux pane: when I hit C-l (do not wrap to the leftmost tmux pane, but) zoom the right tmux pane.
  • All other navigation: work as given in Mislav's gist
@svenfuchs
svenfuchs / gist:5364262
Last active December 16, 2015 02:39
Travis CI Office

The Travis CI office

How to get to the Travis CI office: http://goo.gl/maps/vmidH

The address is Prinzessinnenstrasse 20, on the left driveway:

@svenfuchs
svenfuchs / README.md
Created March 19, 2012 00:45
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => 'git@gist.github.com:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"

@svenfuchs
svenfuchs / gist:2063855
Created March 17, 2012 18:27
Developing with dependent local gem repositories

When developing an application where you have split out shared functionality to multiple dependent gem repositories can get cumbersome when you

  • need to edit the Gemfile in order to swap local :path sources with :git or just plain Rubygems sources,
  • then forget to bundle update,
  • wonder why your git repository is dirty and it's just the modified Gemfile and Gemfile.lock,
  • accidentally commit the Gemfile.lock with local :path sources bundled etc. etc.

So what about this strategy:

A. Create a file .Gemfile.local containing:

Travis CI consists of two main parts right now:

  • the web app which is a regular rails app
  • workers which execute the tests

As we are moving to AMQP for communication between app and workers we want to split up the web app into

  • a rather "dumb" asset-delivery and api service and
  • a message hub that schedules jobs for the workers and consumes all the messages that come back from them (currently misleadingly called "consumer", as it consumes but also publishes)