Skip to content

Instantly share code, notes, and snippets.

View croaker's full-sized avatar

Daniel Gruenthal croaker

  • Hamburg, Germany
View GitHub Profile
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
# Transforms the styles to HTML-Tags
styled_span_to_formatting_tags = lambda do |env|
original_node = env[:node]
wrap_with_tags = []
if original_node.name == "span" && original_node.has_attribute?("style")
css_rules = original_node.attribute("style").value.split(";")
wrap_with_tags = css_rules.collect do |css_rule|
case css_rule.strip
when /^text-decoration:\s*underline$/ then "u"
@croaker
croaker / chef_solo_bootstrap.sh
Created April 20, 2012 10:43 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo on Ubuntu or Amazon AMIs
#!/usr/bin/env bash
RUBY_VERSION=1.9.3-p194
if [ -n `which yum` ]
then
# This is necessary for the Amazon Linux AMI
perl -pi -e 's/^(Defaults\s+secure_path.*)$/\1:\/usr\/local\/bin:\/usr\/local\/sbin/g' /etc/sudoers
yum update -y
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel \
@croaker
croaker / postgresql.rb
Created May 15, 2012 12:50
Homebrew - PostgreSQL 9.2 Beta Formula
require 'formula'
class Postgresql < Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp.postgresql.org/pub/source/v9.2.0beta1/postgresql-9.2beta1.tar.bz2'
md5 '7bb0b7a3a6c32a9ae153d4132fe47d01'
depends_on 'readline'
depends_on 'libxml2' if MacOS.leopard? # Leopard libxml is too old
depends_on 'ossp-uuid'
@croaker
croaker / gist:3225628
Created August 1, 2012 10:13
Various build parameters for ruby & gems using rbenv and homebrew
# Installing ruby with homebrew's readline & xml libs
brew install readline
brew install libxml2 --with-xml2-config
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline) \
--with-libxml2-dir=$(brew --prefix libxml2)" rbenv install 1.9.3-p194
# Installing nokogiri with homebrew's xml libs
brew install libxslt
gem install nokogiri -- --with-xml2-include=$(brew --prefix libxml2)/include \
--with-xml2-lib=$(brew --prefix libxml2)/lib --with-xslt-dir=$(brew --prefix libxslt)
@croaker
croaker / Classes
Created December 3, 2012 12:57
Reporta Message System
+---------------+
| Conversation |0..* initiator 1+-------+1
|---------------|+---------------------+| User |+----+
|title | +-------+ |
|body | |
|started_at | |
| |0..* project 1+---------+ |
| |+---------------------+| Project | | participant
| | +---------+ |
| | |
@croaker
croaker / gist:5068854
Last active December 14, 2015 09:59
Download a ruby 1.9.3 version, patch it using the railsexpress patches of skaes/rvm-patchsets, and pack it up..
#!/bin/bash
set -e
echo "Which patchset of ruby 1.9.3 do you want to download and patch? (eg. 392)"
read PATCHSET
RUBY_VERSION="ruby-1.9.3-p${PATCHSET}"
FILENAME="${RUBY_VERSION}.tar.gz"
if [ -d "/tmp/${RUBY_VERSION}" ]; then
@croaker
croaker / backup.sh
Created April 23, 2015 14:13
Simple MySQL Backup
#!/bin/bash
# What is required?
#
# - An installed MySQL Client
# - An installed and configured AWS-CLI
MYSQLDUMP=/usr/bin/mysqldump
DUMP_FILE_SUFFIX=`date +%F`.sql
BACKUP_FOLDER=/tmp/backups
BACKUP_BUCKET=a_bucket_name
@croaker
croaker / OSX Preferences.sh
Created October 3, 2015 10:59
Key Repeat Settings for Mac OSX
# repeat characters on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# faster initial key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 12
# super fast key repeat
defaults write NSGlobalDomain KeyRepeat -int 0

Keybase proof

I hereby claim:

  • I am croaker on github.
  • I am dgruenthal (https://keybase.io/dgruenthal) on keybase.
  • I have a public key ASAwQbv5obh8XfQf_2il3bbj9D0UqMIdLpFH-n_zHacLuQo

To claim this, I am signing this object: