Skip to content

Instantly share code, notes, and snippets.

View souzagab's full-sized avatar
:shipit:

Gabriel S. souzagab

:shipit:
View GitHub Profile
@souzagab
souzagab / config.ru
Created August 19, 2022 15:17
Health Endpoint using only Rack in Rails apps
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('config/environment', __dir__)
map "/health" do
run Rack::HealthCheck.new
end
run Rails.application
@souzagab
souzagab / steam.md
Last active January 15, 2022 15:48
Steam on linux
@souzagab
souzagab / github.sh
Created August 22, 2021 19:25
Generate and add key to Github (via Github CLI)
#!/bin/bash
echo -e "This script will generate a new ssh-key without an passphrase.\n"
echo -e "\nEnter the desired e-mail:"
read -p "E-mail: " EMAIL
echo -e "\n Enter a key name (will be saved on $HOME/.ssh/):"
read -p "Key: " KEY
#!/usr/bin/env ruby
require 'csv'
require 'json'
if ARGV.size != 2
puts 'Usage: csv_to_json input_file.csv output_file.json'
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects'
exit(1)
end
@souzagab
souzagab / validates_timeliness.pt-BR.yml
Created May 30, 2021 15:36
validates_timeliness.pt-BR.yml
pt-BR:
errors:
messages:
invalid_date: 'não é uma data válida'
invalid_time: 'não é um horário válido'
invalid_datetime: 'não é um horário com data válido'
is_at: 'deve ser em %{restriction}'
before: 'deve ser antes de %{restriction}'
on_or_before: 'deve ser antes ou em %{restriction}'
after: 'deve ser após %{restriction}'
@souzagab
souzagab / pre-commit
Created March 15, 2021 11:55 — forked from ppdeassis/pre-commit
Git pre-commit hook for a rails project. Add it to your `repo/.git/hooks/pre-commit` file and make sure it has +x permission.
#!/bin/bash
#
# install into git dir:
# curl \
# -fSL https://gist.githubusercontent.com/ppdeassis/48387d9f49b41af23e7d/raw/e1b6a2d4c9257ed6eecefedebeafa3655c98bb7a/pre-commit \
# -o .git/hooks/pre-commit \
# && chmod +x .git/hooks/pre-commit
#
#!/bin/bash
@souzagab
souzagab / Workaround TNS:Listener - Restricted mode Error
Created August 26, 2020 11:47
Workaround to fix "ORA-12526, TNS:listener: all appropriate instances are in restricted mode."
`ORA-12526, TNS:listener: all appropriate instances are in restricted mode.`
As a workaround, connect on the docker container
docker exec -it --user=oracle ${oracle_image_name} bash
and disable the restricted sessions setting
sqlplus /nolog
conn sys as sysdba
password: oracle
@souzagab
souzagab / stroke_grid.rb
Created June 25, 2020 13:47
The grid code I use to help measure and position elements, using prawn
require "prawn"
module Prawn
module Graphics
def stroke_grid(options = {})
options = {
:at => [0, 0],
:height => bounds.height.to_i - (options[:at] || [0, 0])[1],
:width => bounds.width.to_i - (options[:at] || [0, 0])[0],
:step_length => 50,
@souzagab
souzagab / liv8_osx.md
Created June 22, 2020 19:14
Fix liv8 macOS

brew install v8-315

gem install libv8 -v '3.16.14.13' -- --with-system-v8 gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8@3.15

bundle install

@souzagab
souzagab / OpenSSL-Fix.md
Last active December 24, 2023 06:26
Install OpenSSL 1.0.2 via Homebrew ( Fix for older Ruby Versions )

How to fix openSSL incompatibility issues in older Ruby Versions. (<=2.3)

Homebrew

Install openssl 1.0.2 via homebrew :

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb -f

This should install openssl in /usr/local/opt/openssl

If you already have 1.1 installed, you should have 2 versions of opensll in: /user/local/opt/