Skip to content

Instantly share code, notes, and snippets.

View matiasmasca's full-sized avatar
🏠
Moving to Gitlab.com

Matías Mascazzini matiasmasca

🏠
Moving to Gitlab.com
View GitHub Profile
@jjb
jjb / file.md
Last active April 30, 2024 11:26
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.

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

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@etozzato
etozzato / puma.rb
Last active January 28, 2024 20:12
A section of config/puma.rb that will automatically generate a self-signed X509 certificate and provide https in development
if Rails.env.development?
FileUtils.mkdir_p(Rails.root.join('config', 'certs'))
key_path = Rails.root.join('config', 'certs', 'development.key')
crt_path = Rails.root.join('config', 'certs', 'development.crt')
unless File.exist?(key_path) && File.exist?(crt_path)
def cert_domain
'localhost' # Setting[:cookie_domain] || 'localhost'
end
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@nicolasdao
nicolasdao / elasticbeanstalk_guide.md
Last active December 11, 2023 14:40
Elastic Beanstalk guide. Keywords: elastic bean beanstalk elasticbeanstalk cli eb eb
server {
listen 80;
server_name kartoffel.example.org;
keepalive_timeout 5;
root /var/www/kartoffel/current/public;
access_log /var/log/nginx/kartoffel.access.log;
server {
client_max_body_size 30M;
server_name sistema.example.com.ar;
# ~2 seconds is often enough for most folks to parse HTML/CSS and
# retrieve needed images/icons/frames, connections are cheap in
# nginx so increasing this is generally safe...
keepalive_timeout 5;
@khalilgharbaoui
khalilgharbaoui / db.rake
Created February 3, 2019 21:29 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
# Benefits of: https://gist.github.com/e12e/e0c7d2cc1d30d18c8050b309a43450ac
# And fixes of: https://gist.github.com/joelvh/f50b8462611573cf9015e17d491a8a92
namespace :db do
desc 'Dumps the database to backups'
task dump: :environment do
dump_fmt = ensure_format(ENV['format'])
dump_sfx = suffix_for_format(dump_fmt)
backup_dir = backup_directory(Rails.env, create: true)
@satendra02
satendra02 / app.DockerFile
Last active March 3, 2024 10:13
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@datawookie
datawookie / install-chrome.sh
Created February 9, 2018 14:38
Install Chrome and ChromeDriver
#!/bin/bash
# For headless Chrome (although not necessary with --headless option).
#
sudo apt-get install xvfb
sudo apt-get install unzip
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@rajeevkannav
rajeevkannav / deploy.rb
Created December 1, 2017 05:23
Mina Deploy Ubuntu 17.10-From Scratch-Rails-Ruby-Mysql-Nginx-Puma and all possible option
require 'mina/rails'
require 'mina/git'
require 'mina/puma'
require 'mina/rvm'
require 'yaml'
set :user, 'deploy'
set :port, '22'
set :forward_agent, true
set :term, :system