Skip to content

Instantly share code, notes, and snippets.

View jacobat's full-sized avatar

Jacob Atzen jacobat

  • Copenhagen, Denmark
View GitHub Profile
@jacobat
jacobat / Gemfile
Created December 3, 2013 18:46
Bundler performance
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'pg'
gem 'retryable-rb'
gem 'mime-types', :require => 'mime/types'
gem 'nokogiri'
gem "newrelic_rpm"
gem "addressable"
vagrant@precise64:~/openresty$ sudo docker rm purple_chicken
Error: Cannot destroy container purple_chicken: stat /var/lib/docker/containers/5509334f5b65bb61aba0a03109942137a76973078ed04e66fef4d80467a66fa1/rootfs: stale NFS file handle
vagrant@precise64:~/openresty$ sudo ls -l /var/lib/docker/containers/5509334f5b65bb61aba0a03109942137a76973078ed04e66fef4d80467a66fa1/
ls: cannot access /var/lib/docker/containers/5509334f5b65bb61aba0a03109942137a76973078ed04e66fef4d80467a66fa1/rootfs: Stale NFS file handle
total 32
-rw------- 1 root root 2661 Nov 1 21:39 5509334f5b65bb61aba0a03109942137a76973078ed04e66fef4d80467a66fa1-json.log
-rw-r--r-- 1 root root 1627 Nov 1 21:39 config.json
-rw-r--r-- 1 root root 4197 Nov 1 21:39 config.lxc
-rw-r--r-- 1 root root 83 Nov 1 21:39 hostconfig.json
vagrant@precise64:~/docker-registry$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
vagrant@precise64:~/docker-registry$ docker run -d -p :5000 samalba/docker-registry
1e7136e663a6
vagrant@precise64:~/docker-registry$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
1e7136e663a6 samalba/docker-registry:latest /bin/sh -c cd /docke 2 seconds ago Up 1 seconds 49156->5000
vagrant@precise64:~/docker-registry$
vagrant@precise64:~$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
274ebe0573de sinatrademo:latest /bin/bash 3 minutes ago Up 3 minutes 49158->4567
vagrant@precise64:~$ wget localhost:49158
--2013-06-23 12:36:41-- http://localhost:49158/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:49158... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.
def print_memory_usage
memory_usage = `ps -p #{Process.pid} -o rss=`.chomp
puts "Memory usage: #{memory_usage}"
end
print_memory_usage
a = ['a'] * 10000000
print_memory_usage
a = nil
GC.start
print_memory_usage
<!--
- Unfortunately, Microsoft has added a clever new
- "feature" to Internet Explorer. If the text of
- an error's message is "too small", specifically
- less than 512 bytes, Internet Explorer returns
- its own error message. You can turn that off,
- but it's pretty tricky to find switch called
- "smart error messages". That means, of course,
- that short error messages are censored by default.
- IIS always returns error messages that are long
@jacobat
jacobat / random_time.rb
Created August 28, 2012 11:05 — forked from ekampp/random_time.rb
Random time extention
class Date
# Samples a random time
#
# Parameters
# This takes up to three parameters, that is a range of `years`, `months` and
# `days`. Each defining the boundries of the sample date.
#
# Examples
# `Time.random({ years: 1..2 })` will produce a date between one and two
@jacobat
jacobat / gist:3225143
Created August 1, 2012 08:51
Ruby build tools
https://github.com/fesplugas/rbenv-installer/
https://github.com/sstephenson/ruby-build/
@jacobat
jacobat / build-deb-ruby-1.9.2-p290.sh
Created April 9, 2012 10:02 — forked from jtimberman/gist:881058
i can has ruby-1.9.2 package with fpm
#!/bin/sh
rubyversion=1.9.2-p290
rubysrc=ruby-$rubyversion.tar.bz2
checksum=096758c3e853b839dc980b183227b182
destdir=/tmp/install-$rubyversion
sudo apt-get -y install libssl-dev
gem list -i fpm || sudo gem install fpm
@jacobat
jacobat / _rake
Created March 29, 2012 09:39
Fast rake completion with zsh
#compdef rake
if [[ -f Rakefile ]]; then
sum=`md5 -q Rakefile **/*.rake | md5`
if [[ ! -f .rake_tasks.$sum~ ]]; then
rake -s --tasks | cut -d ' ' -f 2 > .rake_tasks.$sum~
fi
compadd $(cat .rake_tasks.$sum~)
fi