Skip to content

Instantly share code, notes, and snippets.

View jonathangaldino's full-sized avatar
🏠
Working from home

Jonathan jonathangaldino

🏠
Working from home
View GitHub Profile
@jonathangaldino
jonathangaldino / schema_dumper.rb
Created May 3, 2023 17:56 — forked from drnic/schema_dumper.rb
Our rails db includes our own tables/schema and the Salesforce/Heroku Connect schema (under "salesforce.*"). We place this file in config/initializers/schema_dumper.rb and now our rails db:schema:dump includes both our own tables and the salesforce. tables.
# This solution was based on https://gist.github.com/GlenCrawford/16163abab7852c1bd550547f29971c18
Rails.configuration.to_prepare do
ActiveRecord::SchemaDumper.ignore_tables = %w[
salesforce._hcmeta
salesforce._sf_event_log
salesforce._trigger_log
salesforce._trigger_log_archive
]
end
@jonathangaldino
jonathangaldino / private-pension-api-insomnia-requests.json
Created September 20, 2023 01:57
Private Pension API - Insomnia
{"_type":"export","__export_format":4,"__export_date":"2023-09-20T01:55:46.976Z","__export_source":"insomnia.desktop.app:v2023.5.8","resources":[{"_id":"req_4157bf9d4f644c5788b108f5b93f9c79","parentId":"wrk_4ba7024e90064faaa8c8de293311e71b","modified":1695009408996,"created":1694867799799,"url":"http://localhost:3000/customers","name":"Create customer","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"cpf\": \"45645644600\",\n\t\"nome\": \"José da Silva\",\n\t\"email\": \"[email protected]\",\n\t\"dataDeNascimento\": \"2010-08-24T12:00:00.000Z\",\n\t\"genero\": \"Masculino\",\n\t\"rendaMensal\": 2899.5\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/2023.5.8"}],"authentication":{},"metaSortKey":-1694867799799,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","
@jonathangaldino
jonathangaldino / main.js
Created February 26, 2024 12:48
Chunk by chunk, from a web address to s3
const axios = require('axios');
const { MongoClient } = require('mongodb');
const { S3 } = require('aws-sdk');
const { PassThrough } = require('stream');
// Function to download image and upload to S3
async function downloadAndUploadImage(imageURL, s3, s3BucketName) {
try {
const response = await axios.get(imageURL, { responseType: 'stream' });
const s3Params = {
@jonathangaldino
jonathangaldino / file.txt
Created February 28, 2024 16:11
Install Puppetteer deps on Amazon Linux 2023
Source: https://www.youtube.com/watch?v=pdpzrv1H2RM
$ sudo yum install libXcomposite libXdamage libXrandr libgbm libxkbcommon pango alsa-lib atk at-spi2-atk cups-libs libdrm