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 / 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
@rafael-neri
rafael-neri / a2dp.py
Created August 20, 2019 12:39 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
@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 / 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 / validar_cpf.php
Last active April 27, 2024 21:49
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 / teste.py
Last active May 30, 2017 18:11
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 / install_ionic_yarn.sh
Last active April 10, 2021 09:32
Install Ionic Using Yarn on Ubuntu
# Install Node
sudo apt-get install nodejs
# Link command node
sudo ln -s /usr/bin/nodejs /usr/bin/node
# Install CURL
sudo apt-get install curl
@rafael-neri
rafael-neri / pac_aliases
Created March 9, 2017 16:24 — forked from rroblak/pac_aliases
Package manager-independent bash aliases
# paci - install one or more packages
# pacu - upgrade all packages to their newest version
# pacr - uninstall one or more packages
# pacs - search for a package using one or more keywords
# pacinfo - show information about a package
# pacinstalled - show if a package is installed
# paca - list all installed packages
# paclo - list all packages which are orphaned
# pacdnc - delete all not currently installed package files
# pacfiles - list all files installed by a given package
@rafael-neri
rafael-neri / reinstall_packages.sh
Last active December 11, 2023 18:03
Reinstall All packages in Linux Arch Based
#!/bin/bash
pacman -Q | awk '{ print $1 }' | sort > /tmp/pacman-installed.tmp
pacman -Qm | awk '{ print $1 }' | sort | comm -3 /tmp/pacman-installed.tmp - > /tmp/pacman-to-reinstall.tmp
pacman -S --noconfirm $(cat /tmp/pacman-to-reinstall.tmp)
rm /tmp/pacman-{to-reinstall,installed}.tmp
@rafael-neri
rafael-neri / makedeb.sh
Last active September 14, 2016 14:24
Simple script to create debian package
#!/bin/bash
# Distributed under the GNU GPL
# Check if user is root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Get path