Skip to content

Instantly share code, notes, and snippets.

@andreimaxim
andreimaxim / linux-setup.sh
Last active June 5, 2024 05:22 — forked from dhh/linux-setup.sh
linux-setup.sh
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@andreimaxim
andreimaxim / Rakefile
Created February 15, 2024 07:39
Rakefile to check project structure for Zeitwerk compatibility
require File.expand_path("config/environment", __dir__)
require "zeitwerk"
namespace :zeitwerk do
desc "Check project structure for Zeitwerk compatibility"
task :check do
base_directory = Pathname.new "lib"
loader = Zeitwerk::Loader.new
@andreimaxim
andreimaxim / override_cache_key.rb
Created February 13, 2022 08:50 — forked from tispratik/override_cache_key.rb
Override cache key and touch methods in active record when we cannot update the last modified / updated at column in database. We keep track of the changes in memcache.
module CacheKeyMonkeyPatch
module ActiveRecord
module Integration
# Returns a cache key that can be used to identify this record.
#
# ==== Examples
#
# Product.new.cache_key # => "products/new"
# Product.find(5).cache_key # => "products/5" (updated_at / last_modified_time not available)
FROM ubuntu
RUN apt-get update
RUN apt-get install -y build-essential curl
# NodeJS >= 6.0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
# ttfautohint
@andreimaxim
andreimaxim / keybase.md
Created October 8, 2018 16:43
keybase.md

Keybase proof

I hereby claim:

  • I am andreimaxim on github.
  • I am andreimaxim (https://keybase.io/andreimaxim) on keybase.
  • I have a public key ASDalNRYks3i50fbQfm0F2ubAeWlyzp--vUQfIALWm69GQo

To claim this, I am signing this object:

@andreimaxim
andreimaxim / keybase.md
Last active September 8, 2016 11:51
keybase.md

Keybase proof

I hereby claim:

  • I am andreimaxim on github.
  • I am andreimaxim (https://keybase.io/andreimaxim) on keybase.
  • I have a public key ASCty5268_70lSW2XCIanVXixKf2SbPxSBNIuzEMw9BIRQo

To claim this, I am signing this object:

require_relative './clojure-1.8.0.jar'
def clojure; Java::ClojureLang; end
i = clojure.PersistentHashMap.create(a: 'b')
puts i[:a] #=> 'b'

Using Unicorn with Upstart

This configuration works with Upstart on Ubuntu 12.04 LTS

The reason why it needs to be done this way (i.e. with the pre-start and post-stop stanzas), is because Upstart is unable to track whever Unicorn master process re-execs itself on hot deploys. One can use it without hot-deploys and run Unicorn in foreground also, it then only needs one exec stanza.

This presumes you are not using RVM, so no voodoo dances.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

ruby-1.9.3-p484 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p484 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.