Skip to content

Instantly share code, notes, and snippets.

View rafapolo's full-sized avatar

Rafael Polo rafapolo

View GitHub Profile
@rafapolo
rafapolo / merge.yml
Last active October 19, 2023 09:20
theoretical merge in between YAMLs to avoid redundant data
require 'yaml'
# Load the base YAML file
base_data = YAML.load(File.read('config.yml'))
# Load the new data from a separate YAML file
version7_data = YAML.load(File.read('new_data.yml'))
# Merge the original data with the new data, overwriting the specified keys
actual_data = base_data.merge(version7_data)
import * as XLSX from 'xlsx';
function generateExcelTemplate() {
// Create a new workbook
const workbook = XLSX.utils.book_new();
// Define your data
const data = [
['Name', 'Email', 'Age'],
['John Doe', 'john@example.com', 30],
@rafapolo
rafapolo / chart.js
Last active September 26, 2023 17:53
var allValues = <%== @summary.data.dig('gender_representation', 'chart_data').values.map(&:values) %>
var maleFemaleColors = ['rgb(142, 1, 53)', 'rgb(0, 137, 140)'];
var data = [
{
values: allValues[0],
type: 'pie',
name: 'Operactional Functions',
marker: {
colors: maleFemaleColors
},
{
"version": "Versão",
"about": "Sobre",
"ok": "OK",
"account": "Conta",
"notes": "Notas",
"history": "Histórico",
"budget": "Orçamento",
"tradingPl": "Negociação",
"contacts": "Contactos",
@rafapolo
rafapolo / pega_filmografia_cinemateca.rb
Last active August 15, 2020 08:42
Lista Filmografia da Cinemateca Nacional (Hey, Bolsonaro, vai tomar no cu!)
#!/usr/bin/ruby
# extrapolo.com
require 'selenium-webdriver'
require "nokogiri"
def driver
Selenium::WebDriver.for :firefox, options: Selenium::WebDriver::Firefox::Options.new(
args: ['-headless']
)
#! /bin/ruby
# author: extrapolo.com
# scraps all min,max temperature from Nova Friburgo, Rj, Brazil from accuweather.com since 1992
require "selenium-webdriver"
require "byebug"
profile['browser.frames.enabled'] = false
profile['plugin.state.flash'] = 0
profile['network.http.prompt-temp-redirect'] = false
This file has been truncated, but you can view the full file.
{"artists":[{"name":"Gerônimo","albums":[{"title":"Eu Sou Negão","year":1987,"genre":"MPB","tracks":[{"title":"Jubiabá","num":1,"path":"unzips/UQT1987_Geronimo_-_Eu_sou_Negao/01 Jubiabá.mp3"},{"title":"Vida que Passamos","num":2,"path":"unzips/UQT1987_Geronimo_-_Eu_sou_Negao/02 Vida que Passamos.mp3"},{"title":"Macuxi Muita Onda (Eu Sou Negão)","num":3,"path":"unzips/UQT1987_Geronimo_-_Eu_sou_Negao/03 Macuxi Muita Onda (Eu Sou Negão).mp3"}]},{"title":"Página Musical","year":1982,"genre":"MPB","tracks":[{"title":"Arzinho da Ribeira","num":1,"path":"unzips/UQT1982_Geronimo-PaginaMusical/01 Arzinho da Ribeira.mp3"},{"title":"Dança das Águas","num":2,"path":"unzips/UQT1982_Geronimo-PaginaMusical/02 Dança das Águas.mp3"},{"title":"Cigarro Colomy","num":3,"path":"unzips/UQT1982_Geronimo-PaginaMusical/03 Cigarro Colomy.mp3"},{"title":"Cabeça D'água","num":4,"path":"unzips/UQT1982_Geronimo-PaginaMusical/04 Cabeça D'água.mp3"},{"title":"Nena, Jacira e Dodô","num":5,"path":"unzips/UQT1982_Geronimo-PaginaMusical/05 Nena
@rafapolo
rafapolo / pega.rb
Last active April 15, 2017 22:22
pega geral em json
#!/usr/bin/ruby
#require 'mysql2'
require 'mechanize'
require 'parallel'
require 'byebug'
require 'awesome_print'
require 'colorize'
require 'csv'
require 'json'
@rafapolo
rafapolo / gera.sh
Created March 15, 2017 16:46
convert, trim and jon pdf pages as single jpg image
convert -density 220 in.pdf to_img_.jpg
mogrify -trim to_img_*.jpg
convert -append to_img_*.jpg out.jpg
rm to_img_*
@rafapolo
rafapolo / scrap.rb
Last active February 23, 2017 13:11
pega um pega geral
#!/usr/bin/ruby
require 'mysql2'
require 'mechanize'
require 'parallel'
require 'byebug'
require 'awesome_print'
require 'colorize'
require 'csv'