Skip to content

Instantly share code, notes, and snippets.

View luispimenta's full-sized avatar
🎯
Focusing

Luis Fernando Pimenta luispimenta

🎯
Focusing
View GitHub Profile
@luispimenta
luispimenta / setup.sh
Created May 20, 2024 12:28 — forked from betogrun/setup.sh
Setup ubuntu
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Logging function
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a /var/log/setup_script.log
}
@luispimenta
luispimenta / Lista de Órgãos Emissores
Created November 9, 2023 15:45 — forked from eduardo-mior/Lista de Órgãos Emissores
Lista completa de órgãos emissores de documentos de identificação.
ABNC - Academia Brasileira de Neurocirurgia
AGU - Advocacia-Geral da União
ANAC - Agência Nacional de Aviação Civil
CAER - Clube de Aeronáutica
CAU - Conselho de Arquitetura e Urbanismo
CBM - Corpo de Bombeiro Militar
CFA - Conselho Federal Administração
CFB - Conselho Federal de Biblioteconomia
CFBIO - Conselho Federal de Biologia
CFBM - Conselho Federal de Biomedicina
@luispimenta
luispimenta / modal-video-full.html
Created January 25, 2023 21:09 — forked from anam-hossain/modal-video-full.html
Full example - autoplay youtube video in a Modal (Bootstrap + Jquery)
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
$(function() {
$(".video").click(function () {
var theModal = $(this).data("target"),
videoSRC = $(this).attr("data-video"),
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
@luispimenta
luispimenta / app.js
Created May 18, 2022 19:44 — forked from VMBindraban/app.js
Resize/crop/center in javascript through canvas to base64
var $uplImageBtn = $('.pui--ev-upload'),
$uplContainer = $('#uplProfileImg'),
$previewImg = $('.macc--s-pimg img');
$uplImageBtn.click(function() {
$uplContainer.trigger('click');
});
$uplContainer.on('change', function() {
if (!this.files && !this.files[0]) {
@luispimenta
luispimenta / cpf_cnpj_validators.rb
Created September 30, 2021 17:39 — forked from lucascaton/cpf_cnpj_validators.rb
validação de CPF e CNPJ em Ruby
#------------------------------------------------------------------------------
# Rotinas para verificação de CPF e CNPJ
# Linguagem: Ruby
# Escrito por: André Camargo < [email protected] > http://blog.boaideia.inf.br
# Use, copie, melhore a vontade! Patches são bem-vindos...
#------------------------------------------------------------------------------
def check_cpf(cpf=nil)
return false if cpf.nil?
nulos = %w{12345678909 11111111111 22222222222 33333333333 44444444444 55555555555 66666666666 77777777777 88888888888 99999999999 00000000000}

Javascript

function cpfMask(cleanValue) {
  return cleanValue.replace(/^(\d{3})(\d{3})(\d{3})(\d{2}).*/, '$1.$2.$3-$4');
}

function cnpjMask(cleanValue) {
  return cleanValue.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2}).*/, '$1.$2.$3/$4-$5');
}
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=changeme
@luispimenta
luispimenta / 99-login-fon
Created January 21, 2021 14:38 — forked from cusspvz/99-login-fon
FON ZON / NOS auto-login bash script wget portugal non-wispr client openwrt
#!/bin/sh
# place this file at: /etc/hotplug.d/iface/99-login-fon
# Configurations
FON_USERNAME=email%40domain.com
FON_PASSWORD=123456
FON_DELAY_UP=3
COOKIE_JAR_PATH=/tmp/nos-fon-cookie-jar.$INTERFACE
. /lib/functions.sh
@luispimenta
luispimenta / zip_s3_files.rb
Created December 8, 2020 15:55 — forked from abelorian/zip_s3_files.rb
Zip files from remote server (S3)
protect_from_forgery :except => :get_job_resumes #Optional
require 'zip'
def get_job_resumes
@job = Job.find(params[:job_id])
@file = "#{Rails.root}/files/cvs.zip"
@applications = Application.get_applicants_all(@job.id) # app context method
Zip::ZipOutputStream.open(@file) do |zos|
@applications.each do |application|
user = application.user