Skip to content

Instantly share code, notes, and snippets.

View rafael-neri's full-sized avatar
💻
Working from home

Rafael Neri rafael-neri

💻
Working from home
View GitHub Profile
@rafael-neri
rafael-neri / teste.py
Last active December 22, 2025 13:08
Example Python3 + QT5 + Web
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QUrl
from PyQt5.QtCore import QSize
@rafael-neri
rafael-neri / validar_cpf.php
Last active April 28, 2026 14:02
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;
@rafael-neri
rafael-neri / script.sh
Created February 13, 2018 04:53
Convert MP3 Audio To MP4 Video With Image Thumb Background.
#!/bin/bash
# INSTALL FFMPEG BEFORE EXECUTE THIS SCRIPT
in=/path/directory/audios/
out=/path/directory/videos/
image=/path/image.png
for file in `ls $in`
do
@rafael-neri
rafael-neri / git-tag-delete-local-and-remote.sh
Created August 30, 2018 18:20 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@rafael-neri
rafael-neri / strong-passwords.php
Created November 6, 2019 02:54 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by

A Regra 80/20 e a Arte de Priorizar

Lembra da Regra de Pareto? O foco tem que estar naqueles 20% de esforço que geram 80% do resultado. No fim das contas, ter tempo é uma mistura de priorização com organização.

Primeiro de tudo, você precisa definir o que é realmente importante. Prioridade é a palavra-chave. Muita gente se perde em mil técnicas de organização, mas não sai do lugar porque não tem foco. Só de ajustar isso, você já ganha tempo, porque naturalmente vai cortar o que não te traz benefício nenhum.

Para priorizar de verdade, seus valores precisam estar bem definidos. Você tem que saber para onde quer ir e como pretende chegar lá.

O Exercício do "Dia Perfeito"

@rafael-neri
rafael-neri / script.sh
Created May 26, 2020 13:28
Git Rename Tag Local and Remote
# Create new from old
git tag new old
# Remove old tag
git tag -d old
# Sync changes from old tag to remote
git push origin :refs/tags/old
@rafael-neri
rafael-neri / snap-clean.sh
Created September 21, 2021 20:12
Sanp Clean: Remove disabled (unused) snap packages
#!/bin/sh
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
@rafael-neri
rafael-neri / 01-ServeCommand.php
Last active September 27, 2021 22:45
Add Support to "php artisan serve" in Lumen
<?php
// File: app/Console/Commands/ServeCommand.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class ServeCommand extends Command {
@rafael-neri
rafael-neri / .github_workflows_schedule.yaml
Created January 10, 2022 00:53
Schedule 15 minutes from GitHub - Cron
name: 15-minute-schedule
on:
schedule:
- cron: '*/15 * * * *'
jobs:
cron:
runs-on: ubuntu-latest
steps:
- name: Call your API route
run: |