Skip to content

Instantly share code, notes, and snippets.

@lennart
lennart / .gemrc
Created January 5, 2010 19:30
My Gemrc, finally found a way to stop gem installing rdoc and ri by default
benchmark: false
verbose: true
update_sources: false
sources:
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com
backtrace: false
bulk_threshold: 1000
gem: --prerelease --no-rdoc --no-ri --env-shebang
@lennart
lennart / external_ip.rb
Created January 8, 2010 19:51
Get your external IP-Adress from ruby, adjust to your hop count
`traceroute -m 2 134.169.9.150 | sed -n "2p" | grep -o "\(.*\)"`.strip.delete "()"

Businessplan

@lennart
lennart / uri.erl
Created February 28, 2010 22:37
a simple uri handling wrapper for erlang
-module(uri).
-compile(export_all).
decode(Uri) when is_binary(Uri) ->
decode(binary_to_list(Uri));
decode(Uri) ->
mochiweb_util:unquote(Uri).
encode(Uri) when is_binary(Uri) ->
encode(binary_to_list(Uri));
@lennart
lennart / io.thor.erb
Created March 8, 2010 18:00
An API-Frontend for io with Thor
#!/usr/local/bin/ruby
require 'tempfile'
require 'rest_client'
require 'thor'
require 'json'
class CouchIO < Thor
map "-s" => :shorten
map "-l" => :shorts
desc "shorten TARGET", "Shortens the passed URL"
{
"name" : "gist",
"version" : "3.2",
"author" : "Yasuhiro Matsumoto <[email protected]>",
"maintainer" : "Lennart Melzer <[email protected]>",
"url" : "http://www.vim.org/scripts/download_script.php?src_id=12283",
"vim_version" : "7.0",
"vim_script_nr" : 2423,
"scipt-type" : "utility",
"archive_name" : "gist.vim"
server {
listen 80;
server_name <%= host_name %>;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
limit_except GET {
server {
listen 80;
server_name <%= host_name %>;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
limit_except GET {
server {
listen 80;
server_name <%= host_name %>;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
limit_except GET {
@lennart
lennart / io-nginx
Created March 14, 2010 15:48
ruby -e "require 'erb'; puts ERB.new(File.read('nginx-io.conf.erb')).result(binding)"
#!/usr/bin/env ruby
require 'erb';
File.open(ARGV[0], "w") do |f|
f.write ERB.new(File.read(ARGV[1] || 'nginx-io.conf.erb')).result(binding)
end
# vim:filetype=ruby