Skip to content

Instantly share code, notes, and snippets.

View mtgrosser's full-sized avatar

Matthias Grosser mtgrosser

View GitHub Profile
@mtgrosser
mtgrosser / cs2-fix.md
Created February 1, 2023 09:10
Fixing Märklin cs2.app on macOS Sierra

Fixing Märklin cs2.app on macOS Sierra

When starting the Märklin CS2 app on macOS Sierra, it crashes due to some libraries not being loaded in the gfpsim executable. This is due to their load paths not being correct, which can be fixed using otool:

install_name_tool -change /Applications/QT/4.8.5/clang_32/lib/QtGui.framework/Versions/4/QtGui @executable_path/../../../../Frameworks/QtGui.framework/Versions/4/QtGui /Applications/cs2.app/Contents/Resources/gfpsim.app/Contents/MacOS/gfpsim

install_name_tool -change /Applications/QT/4.8.5/clang_32/lib/QtCore.framework/Versions/4/QtCore @executable_path/../../../../Frameworks/QtCore.framework/Versions/4/QtCore /Applications/cs2.app/Contents/Resources/gfpsim.app/Contents/MacOS/gfpsim
@mtgrosser
mtgrosser / passenger@.service
Last active August 2, 2016 18:09
Passenger standalone systemd unit file for hosting multiple apps
[Unit]
Description=Passenger Standalone Application Server
After=network.target
[Service]
Type=forking
PrivateTmp=yes
User=USERNAME
Group=GROUPNAME
WorkingDirectory=/apps/%i
@mtgrosser
mtgrosser / pac
Last active August 29, 2015 14:11
YUM-like commands for pacman
#!/bin/bash
usage()
{
echo "USAGE: pac (search|install|update|upgrade|list|listpkg|remove|foreign|whatprovides) [packagename]"
}
PACMAN=/usr/bin/pacman
CMD=$1
shift
@mtgrosser
mtgrosser / README.md
Last active August 29, 2015 14:05
Turn style reporter for minitest-reporters gem

Turn-style reporter for minitest-reporters

# Gemfile
gem 'minitest-reporters-turn_reporter', git: 'git://gist.github.com/692dde12f4822dc1db95.git', require: 'turn_reporter'
# test_helper.rb
require 'minitest/reporters'
@mtgrosser
mtgrosser / oo_auth.rb
Last active December 27, 2015 07:59
Basic "out of band" implementation of the OAuth 1.0 signature mechanism, inspired by 'net-http-oauth', 'oauth' and 'simple_oauth' gems. o = OoAuth.new r = Net::HTTP::Get.new('/1.1/statuses/user_timeline.json?screen_name=foobar') http = Net::HTTP.new('api.twitter.com', Net::HTTP.https_default_port) http.use_ssl = true o.sign! http, r # will add t…
require 'uri'
require 'net/http'
require 'openssl'
require 'base64'
class OoAuth
# request tokens are passed between the consumer and the provider out of
# band (i.e. callbacks cannot be used), per section 6.1.1
OUT_OF_BAND = "oob"
@mtgrosser
mtgrosser / redis_session_store.rb
Created March 4, 2013 23:50
Fixed RedisSessionStore for Rails 3.2
require 'redis'
# Redis session storage for Rails, and for Rails only. Derived from
# the MemCacheStore code, simply dropping in Redis instead.
#
# Options:
# :key => Same as with the other cookie stores, key name
# :host => Redis host name, default is localhost
# :port => Redis port, default is 6379
# :db => Database number, defaults to 0. Useful to separate your session storage from other data
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <shine/layer3.h>
#define SAMPLES_PER_FRAME 1152
typedef struct {
@mtgrosser
mtgrosser / led
Last active September 8, 2020 19:09
Control the LEDs on your Pogoplug E02 with Arch Linux ARM
#!/bin/bash
GREEN="green:health"
ORANGE="orange:fault"
usage()
{
echo "USAGE: led (all|orange|green) (off|on|blink|heartbeat|fs) [only]"
exit 1
}
@mtgrosser
mtgrosser / nudgeable_association.rb
Created June 6, 2012 10:09
Classic behaviour of belongs_to :touch => true for Rails 3, using save! instead of update_all
# This snippet will provide a :nudge option for belongs_to associations,
# which behaves like the belongs_to :touch => true did in Rails 2.x.
# It will use save! instead of a sneaky update_all call, so all of your
# callbacks and validations will be invoked.
module ActiveRecord::NudgeableAssociation
def self.included(base)
base.extend ClassMethods
(class << base; self; end).instance_eval do
@mtgrosser
mtgrosser / irb_debugger.rb
Created March 29, 2012 15:13
irb_debugger - Debugging with IRB on Ruby 1.9.x, no extra gems required!
# irb_debugger - A very simple debugger based on IRB
#
# As long as ruby-debug19 is broken, you can put this in your lib folder
# and require it in your test.rb or development.rb files.
# This will enable you to start an IRB session within your application,
# wherever you need it! Just write
#
# irb_debugger {}
#
# and it will fire IRB with full access to the current binding, i.e.