Skip to content

Instantly share code, notes, and snippets.

jjb /
Last active March 13, 2023 12:00
Using Jemalloc 5 with

This is a very quick gist I'm throwing together to get this info and discussion onto google in one place.

For years, people have been using jemalloc with ruby. There are various benchmarks and discussions. Some people say Jemalloc 5 doesn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. Someone offered a config for Jemalloc 5.

The recipe would be something like this (shown with official docker ruby image). I didn't try this yet, don't know if it will build!

jjb / 1
Last active March 7, 2023 05:15
wrapper script for starting ruby with configured jemalloc
View 1
jjb /
Created September 25, 2022 02:44
markdown indentation demo
  1. hello
  2. hello
    1. nested
    2. nested
      1. more
      2. more
        1. and again
          puts "hello"
View Notes on rails reloader and
  • runner does not use executor in <7, does use it in >=7
  • console does not use executor in <7, not sure about >=7
jjb /
Last active January 22, 2022 01:26
single-line process restarter without systemd

example program being monitored -

while [ 1 ]
  sleep 1
  echo hello
jjb / code.rb
Last active November 12, 2021 14:10
Use ruby to test if a port is available on a host, similar to telnet foo 123
View code.rb
require 'socket'
Socket.tcp("", 443, connect_timeout: 1).close
jjb / code.rb
Created November 2, 2021 00:36
How to work with raw compressed cache data in Rails
View code.rb
raw = Rails.cache.redis.get( Rails.cache.redis.keys.first)
Marshal.load raw
Marshal.load(raw).instance_variable_get :@value
Zlib::Inflate.inflate Marshal.load(raw).instance_variable_get :@value
Marshal.load Zlib::Inflate.inflate Marshal.load(raw).instance_variable_get :@value
jjb /
Last active October 15, 2021 18:25
How to start, stop, or restart postgres installed with macports
sudo port unload postgresql12-server
sudo port load postgresql12-server
jjb /
Created September 29, 2021 10:33
How to stop and start Postgres installed from Macports on MacOS
sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql12/defaultdb stop
sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql12/defaultdb start
jjb /
Created September 11, 2021 01:04
Exploring the default behavior for signals in ruby

Ruby doesn't let you inherit default behavior when writing a signal trap

Here's a beginning of an exploration of what default behavior is for each signal:

reserved = %w[SEGV BUS ILL FPE VTALRM]
reserved += %w[KILL STOP] # not listed in code but reserved via some other mechanism i was too lazy to find

Signal.list.keys.each do |signal|