Skip to content

Instantly share code, notes, and snippets.

View Partyschaum's full-sized avatar

Hauke Stange Partyschaum

View GitHub Profile
#!/bin/bash¬
set -e¬
¬
RUBY_VERSION="2.1.1"¬
RBENV_USER="/home/vagrant"¬
RBENV_DIR=${RBENV_USER}/.rbenv¬
¬
echo "Setting up rbenv..."¬
if [ ! -d "${RBENV_DIR}" ]; then¬
git clone https://github.com/sstephenson/rbenv.git ${RBENV_USER}/.rbenv¬
@Partyschaum
Partyschaum / .tmux.conf
Created May 9, 2014 09:59
My tmux configuration
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Ensure using my shell
set-option -g default-shell /bin/zsh
@Partyschaum
Partyschaum / hodeldiplom.rb
Created June 23, 2014 15:50
Transform Papertrail logfiles into Oink-readable Hodel 3000 compliant ones
require 'date'
logfile = ARGV.first
if logfile.nil? || !File.exists?(logfile)
puts 'No logfile given!'
exit!
end
IO.foreach(logfile).each do |line|
Your Gemfile lists the gem mime-types (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
!!! Rackspace Cloud Files support is experimental !!!
!!! Deis support is experimental !!!
Requirement already satisfied (use --upgrade to upgrade): deis in /home/vagrant/.pyenv/versions/2.7.8/lib/python2.7/site-packages
@Partyschaum
Partyschaum / ebtest.rb
Created July 9, 2014 08:37
AWS playground
require 'aws-sdk'
require 'awesome_print'
ACCESS_KEY_ID = 'xxx'
SECRET_ACCESS_KEY = 'xxx'
REGION = 'eu-west-1'
ENVIRONMENT_NAME = 'xxx'
# configure access
AWS.config access_key_id: ACCESS_KEY_ID, secret_access_key: SECRET_ACCESS_KEY, region: REGION
@Partyschaum
Partyschaum / gist:25c9913456592b8b337c
Created November 27, 2014 13:44
IIFE vs. plain function
function someFunction() {
// both methods do exactly the same thing. where is the difference then?
var reader = new FileReader();
var img = document.createElement('img');
// method A
reader.onload = (function(aImg) {
@Partyschaum
Partyschaum / fakes3
Created January 23, 2015 16:53
fakes3 init script
#! /bin/sh
# /etc/init.d/fakes3
### BEGIN INIT INFO
# Provides: fakes3
# Required-Start: $local_fs
# Required-Stop:
# Should-Start: fakes3 --port 4567 --root /tmp/fakes3
# Should-Stop: fakes3 --port 4567 --root /tmp/fakes3
# Default-Start: 2 3 4 5
@Partyschaum
Partyschaum / gist:5f2d325e621d404dc360
Created March 27, 2015 17:17
Hilfe mit Rekursion und Structs
package main
import (
"fmt"
"strconv"
)
type Entry struct {
id int
title string

This is a test

This is a sub test

Hallo Boris!

@Partyschaum
Partyschaum / gist:9b5e0a910b97412dbb56
Created June 26, 2015 10:32
Komisch gemarschalltes JSON
{"success":{"url":"http://hauke.jimdo.com/app/web/navigation/fragment/?menus=%5B%7B%22levels%22%3A%221%2C2%2C3%22%2C%22expand%22%3Atrue%2C%22variant%22%3A%22nested%22%7D%2C%7B%22levels%22%3A%221%2C2%2C3%22%2C%22expand%22%3Afalse%2C%22variant%22%3A%22breadcrumb%22%7D%5D\u0026pageId=205007816","body":"\u003cbody class=\"body cc-page cc-page-index cc-indexpage j-m-flash-styles j-m-gallery-styles j-m-video-styles j-m-hr-styles j-m-header-styles j-m-text-styles j-m-emotionheader-styles j-m-htmlCode-styles j-m-rss-styles j-m-newsletterbox-styles-disabled j-m-form-styles-disabled j-m-table-styles j-m-textWithImage-styles j-m-downloadDocument-styles j-m-imageSubtitle-styles j-m-flickr-styles j-m-googlemaps-styles j-m-blogSelection-styles-disabled j-m-comment-styles-disabled j-m-jimdo-styles j-m-profile-styles j-m-guestbook-styles j-m-promotion-styles j-m-twitter-styles j-m-hgrid-styles j-m-shoppingcart-styles j-m-catalog-styles j-m-product-styles-disabled j-m-facebook-styles j-m-sharebuttons-styles j-m-externalSource