Skip to content

Instantly share code, notes, and snippets.

View MarceloCajueiro's full-sized avatar

Marcelo Cajueiro MarceloCajueiro

View GitHub Profile
@MarceloCajueiro
MarceloCajueiro / Ruby 2.5 on M1-M2 macs.md
Last active February 12, 2025 13:45
Installing Ruby 2.5.X on Mac M1/M2 Without Rosetta

Ruby 2.5.9 is an old version that does not officially support Apple Silicon (ARM architecture). Additionally, it depends on OpenSSL 1.1, which has been disabled in Homebrew since October 2024. This means that installing Ruby 2.5.9 on a Mac M1/M2 requires a manual installation of OpenSSL 1.1, since it’s no longer available via Homebrew.

This guide will walk you through installing Ruby 2.5.9 on an Apple Silicon Mac without using Rosetta, covering OpenSSL 1.1 installation, Ruby installation using asdf, and general compatibility notes.


Why OpenSSL 1.1?

Ruby 2.5.9 requires OpenSSL 1.1, but Homebrew has disabled it due to security concerns. Since newer OpenSSL versions (such as 3.x) are not compatible with Ruby 2.5.9, we must manually download, compile, and install OpenSSL 1.1.


@MarceloCajueiro
MarceloCajueiro / domestic_tasks.md
Created December 26, 2022 14:27
Obsidian + Meta bind + Templater: load options from file when use a template.

Breakfast Dinner Lunch Take out the garbage Wash the dishes

@MarceloCajueiro
MarceloCajueiro / input.md
Created December 24, 2022 15:09
Creating README using chatGPT

Input 1

Do you know the app obsidian?

Input 2

I will give you informations about an obsidian plugin and I want you to return a proper readme for its repository.

Plugin name: QuickAdd; Current readme: Current documentation home:

@MarceloCajueiro
MarceloCajueiro / instructions.md
Last active July 18, 2024 07:07
Migrate Paperclip to Carrierwave in a Rails application.

This tutorial allow you to migrate the Paperclip that uses Hash in the file name to Carrierwave. I will not give all the details but I will give the before and after at the end of this tutorial.

In my case the config of the upload with Paperclip was:

class SomeAttachment < ActiveRecord::Base
  has_attached_file :attachment,
                    validate_media_type: false,
                    url: "/#{Rails.env}/:class/:id/:basename-:hash.:extension",
                    path: "/#{Rails.env}/:class/:id/:basename-:hash.:extension",
@MarceloCajueiro
MarceloCajueiro / script.rb
Created July 17, 2018 11:50
Move sidekiq jobs from one queue to another
queue = Sidekiq::Queue.new("default")
queue.each do |job|
if job.klass == "DailyFrequencyCreatorWorker"
DailyFrequencyCreatorWorker.set(queue: 'daily_frequency_creator').perform_async(*job.args)
job.delete
end
end;nil
@MarceloCajueiro
MarceloCajueiro / install-oracle-java6-ubuntu.sh
Created June 20, 2018 09:08 — forked from bmaupin/install-oracle-java6-ubuntu.md
Install Oracle Java 6 on Ubuntu/Xubuntu
# Downloads and installs Oracle Java 6 from here:
# http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR
wget \
--no-cookies \
--no-check-certificate \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
chmod +x jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
sudo mv -T jdk1.6.0_45 /usr/lib/jvm/java-6-oracle-amd64
@MarceloCajueiro
MarceloCajueiro / gist:425e4cfde552785574279fb7d39089ad
Created May 24, 2018 21:10
Workaround to create a CSV from git log. It replaces ; and " to avoid conflicts with google docs.
git log --no-merges --date=short --pretty=format:'----%h----|||----%an----|||----%ad----|||----%B----' \
| sed 's/"/''/g' \
| sed 's/;/./g' \
| sed 's/----/"/g' \
| sed 's/|||/;/g' \
| sed 's/";"/","/g' > commits.csv
@MarceloCajueiro
MarceloCajueiro / argentina.sql
Created November 17, 2016 17:42
Cities and provinces from Argentina in a postgresql dump.
COPY cities (id, state_id, name, created_at, updated_at) FROM stdin;
1440 9 Ciudad Autónoma de Buenos Aires 2016-11-17 17:18:37.619255 2016-11-17 17:18:37.619255
1441 10 Carhué 2016-11-17 17:18:37.628344 2016-11-17 17:18:37.628344
1442 10 Colonia San Miguel Arcángel 2016-11-17 17:18:37.633553 2016-11-17 17:18:37.633553
1443 10 Delfín Huergo 2016-11-17 17:18:37.639846 2016-11-17 17:18:37.639846
1444 10 Espartillar 2016-11-17 17:18:37.64566 2016-11-17 17:18:37.64566
1445 10 Esteban Agustín Gascón 2016-11-17 17:18:37.653344 2016-11-17 17:18:37.653344
1446 10 La Pala 2016-11-17 17:18:37.660556 2016-11-17 17:18:37.660556
1447 10 Maza 2016-11-17 17:18:37.667124 2016-11-17 17:18:37.667124
1448 10 Rivera 2016-11-17 17:18:37.674722 2016-11-17 17:18:37.674722
@MarceloCajueiro
MarceloCajueiro / read_only_middleware.rb
Created February 21, 2016 12:55
Use database follower with Sidekiq
require 'delegate'
module SidekiqExt
# Use read-only database if :db option is :read_only,
# otherwise use the default connection.
#
# Example:
#
# class MyWorker
# include Sidekiq::Worker