Skip to content

Instantly share code, notes, and snippets.

View sandrocarval's full-sized avatar

Sandro Ribeiro sandrocarval

  • Brazil
  • 16:50 (UTC -03:00)
View GitHub Profile
# CPF and CNPJ validators Rails 3+ style
# By Arthur Corenzan <[email protected]>
# Based on the work of André Camargo <[email protected]>
#
# Copy this file to your initializers or lib directory, then apply like this:
#
# class Person
# ...
#
# validates :cpf, :cpf => true
@sandrocarval
sandrocarval / brazilian_states.rb
Created March 11, 2015 16:25
Brazilian states / Estados brasileiros
BRAZILIAN_STATES = {
'AC' => 'Acre',
'AL' => 'Alagoas',
'AP' => 'Amapá',
'AM' => 'Amazonas',
'BA' => 'Bahia',
'CE' => 'Ceará',
'DF' => 'Distrito Federal',
'ES' => 'Espírito Santo',
'GO' => 'Goiás',
@sandrocarval
sandrocarval / commits_for_release_notes.sh
Last active September 6, 2016 16:26
Script that lists the commit messages that were commited in a new branch, and also displays the Phabricator revision number from each commit
#!/bin/bash
while [[ $# > 1 ]]
do
key="$1"
case $key in
-f|--from)
FROM="$2"
shift
@sandrocarval
sandrocarval / gco.sh
Last active December 19, 2016 19:56
Script para facilitar a mudança de tags/commits nos diretórios das gems quando se dá checkout no branch do projeto principal (Jericó, JIS, JPS)
#!/bin/bash
# Salve este arquivo no $HOME/bin e adicione o caminho no $PATH
REPO_BASE="$HOME/repos"
CURRENT_REPO=$(pwd)
git checkout $1
for REPO in $(egrep "adtsys-cloud|diegoaltheman" $CURRENT_REPO/Gemfile | awk -F'"' '{print $2}')
@sandrocarval
sandrocarval / gua.sh
Last active May 17, 2017 20:31
Atualiza todos os repos do cloudficacao
#!/bin/bash
# Salve este arquivo no $HOME/bin e adicione o caminho no $PATH
REPO_BASE="$HOME/repos/totvs"
for REPO in $(ls $REPO_BASE/)
do
echo "-----------------------------------------"
echo "$REPO: updating"
@sandrocarval
sandrocarval / goadt
Created December 21, 2016 16:27 — forked from dforocha/goadt
script to do the ssh on adtsys machines
#!/bin/bash
export PEM_KEY="~/.ssh/aws-totvs.pem"
function list() {
echo "ADTsys server list:
jerico01
jerico02
jis01
jis02
@sandrocarval
sandrocarval / gtk.css
Created May 30, 2017 13:52
Reduce window title bar height in Gnome 3.22
/* Copy this CSS to ~/.config/gtk-3.0/gtk.css, and restart or logout+login */
window.ssd headerbar.titlebar {
min-height: 0;
}
window.ssd headerbar.titlebar button.titlebutton {
padding-top: 0px;
padding-bottom: 0px;
min-height: 0;
@sandrocarval
sandrocarval / op7_cleanup.sh
Last active April 8, 2020 19:20
OnePlus 7 cleanup
sudo adb shell pm disable-user com.android.traceur
sudo adb shell pm disable-user com.oneplus.opbugreportlite
sudo adb shell pm disable-user com.oneplus.brickmode
sudo adb shell pm disable-user net.oneplus.odm
sudo adb shell pm disable-user net.oneplus.odm.provider
sudo adb shell pm disable-user com.google.android.apps.wellbeing
# The command below needs to be executed after every reboot
sudo adb shell settings put global device_idle_constants inactive_to=2592000000,motion_inactive_to=2592000000,light_after_inactive_to=3000000,light_max_idle_to=21600000,light_idle_to=3600000,light_idle_maintenance_max_budget=600000,light_idle_maintenance_max_budget=600000,min_light_maintenance_time=30000
@sandrocarval
sandrocarval / windows10-2004-wsl2-setup.md
Last active August 14, 2020 18:40
Windows 10 2004 + WSL2 setup
@sandrocarval
sandrocarval / fedora-kde-setup.sh
Last active December 30, 2023 20:28
Fedora KDE setup
# Repos
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf copr enable kwizart/fedy -y
sudo dnf copr enable zawertun/hack-fonts -y
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo dnf update -y
# REBOOT