Skip to content

Instantly share code, notes, and snippets.

Thorsten Ball mrnugget

Block or report user

Report or block mrnugget

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
maxim /
Last active Dec 2, 2019
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog:

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

tobstarr / Dockerfile
Last active Nov 2, 2018
Jenkins for go projects with docker
View Dockerfile
FROM ubuntu:12.04
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-6-jdk curl git-core build-essential bzr
RUN mkdir -p /tmp/downloads
# install go
RUN curl -sf -o /tmp/downloads/go1.1.1.linux-amd64.tar.gz -L
RUN mkdir -p /opt && cd /opt && tar xfz /tmp/downloads/go1.1.1.linux-amd64.tar.gz
# install jenkins
RUN curl -sf -o /opt/jenkins-1.523.war -L
pmarreck / teststack.rb
Last active Dec 19, 2015
TestStack, a cheap zeus-like bit of code to preload your stack for your iterative test running. Based on ideas from Jesse Storimer.
View teststack.rb
#!/usr/bin/env ruby
# Teststack: A way to preload your Rails app stack for your iterative test running
# Based on ideas from Jesse Storimer here:
# Usage: Run this file without args to run the server; run it with test file args to connect to the server and run tests
require 'socket'
mislav /
Last active Nov 27, 2019
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

mislav / OpenSSL
Last active May 9, 2019
Fix OpenSSL certificate errors on Ruby 2.0
View OpenSSL

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

mislav /
Last active Dec 22, 2018
Find "*.log" files in your home dir, sort them by fattest-first, and calculate the size of them all together.
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt
mislav /
Last active Apr 24, 2019
Jim Weirich on the differences between procs and lambdas in Ruby

Jim Weirich:

This is how I explain it… Ruby has Procs and Lambdas. Procs are created with { }, lambdas are created with lambda {} and ->() {}.

In Ruby 1.8, proc {} creates lambda, and Ruby 1.9 it creates procs (don't ask).

Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.

This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.

mike-zhang / udpProxy.go
Created Oct 8, 2012
Implementation of a UDP proxy in Golang
View udpProxy.go
// Implementation of a UDP proxy
package main
import (
jedy / go_scp.go
Last active Nov 14, 2019
an example of scp in golang
View go_scp.go
package main
import (
const privateKey = `content of id_rsa`
janl / gist:3110170
Created Jul 14, 2012
CoUp Coffee Chemex Guide
View gist:3110170

Chemex Quick Guide

Not this is rocket sience :)


Fill the water heater with a finger more than 1 liter of water. Set it on its power-base, hit the button that’s all the way out on the handle. This starts the heating process. Now hit the “minus” (“-”) button so you see a red light on the 90° marker. Let it heat up. In the meantime:


You can’t perform that action at this time.