Skip to content

Instantly share code, notes, and snippets.

View rclayton-the-terrible's full-sized avatar

Richard Clayton rclayton-the-terrible

View GitHub Profile
@jjb
jjb / gist:7389552
Last active December 22, 2024 15:58
Ruby 2.1 memory configuration

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/master/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@ikenna
ikenna / stopwatch.rb
Last active April 21, 2021 15:01
Simple Ruby stopwatch
class Stopwatch
def initialize()
@start = Time.now
end
def elapsed_time
now = Time.now
elapsed = now - @start
puts 'Started: ' + @start.to_s
@rclayton-the-terrible
rclayton-the-terrible / build_and_install_rmq_web_stomp_ssl.sh
Last active August 31, 2018 17:16
Build and Install RabbitMQ Web Stomp with SSL (from @jshiell's repo).
# Make sure you have Mercurial and Git installed
git clone https://github.com/rabbitmq/rabbitmq-public-umbrella.git
cd rabbitmq-public-umbrella
make co
cd rabbitmq-web-stomp
git clone https://github.com/jshiell/rabbitmq-web-stomp.git
make
cd dist
@tokudu
tokudu / ec2ssh.sh
Created October 27, 2012 23:55
A helper script for SSH'ing into EC2 instances by name
#!/bin/bash
# SSH into an EC2 instance by name
# Author: [email protected] (SoThree.com).
set -e
if [ $# -lt 1 ]
then
echo "Usage: `basename $0` instance_name"
exit 1
fi
@jordansissel
jordansissel / foo.md
Last active February 6, 2021 22:08
logstash message format

logstash json format

{
  "message"    => "hello world",
  "@version"   => "1",
  "@timestamp" => "2014-04-22T23:03:14.111Z",
  "type"       => "stdin",
  "host"       => "hello.local"
}