Skip to content

Instantly share code, notes, and snippets.

View pauloantonelli's full-sized avatar

Paulo Antonelli pauloantonelli

View GitHub Profile
@pauloantonelli
pauloantonelli / audio-zorin-os.text
Last active March 27, 2023 12:08
Audio Zorin OS
procedure
open: startup application
search audios: pactl list short sinks
monitor audio: pactl set-default-sink alsa_output.pci-0000_03_00.1.hdmi-stereo-extra5
source: https://forum.zorin.com/t/changing-default-sound-output-on-boot/13786
@pauloantonelli
pauloantonelli / colocar vscode como editor de git.txt
Created March 16, 2023 18:42
Colocar vsCode como Editor de Git
Vscode como editor padrão do git :
git config --global core.editor "code -w"
comando para verficar se a instalação foi feita correto :
git config --global -e
Se der algum erro como:
"hint: Waiting for your editor to close the file... code -w: code: command not found error: There was a problem with the editor 'code -w'".
Vá no VS Code > command(control) + shift + p > procure por code > escolha Shell Command: Install ‘code' command in PATH
@pauloantonelli
pauloantonelli / sourceTree_device_not_configured.txt
Last active February 23, 2023 13:24 — forked from RockinPaul/sourceTree_device_not_configured.txt
SourceTree: Device not configured (on MacOS)
In console:
git config credential.helper
You will see: osxkeychain
git config --global credential.helper sourcetree
Then if you perform git config credential.helper again
You will see: sourcetree
@pauloantonelli
pauloantonelli / utpl_download.sh
Last active October 7, 2022 15:43 — forked from jkpl/utpl_download.sh
Script that downloads Youtube playlist and extracts the audio from the downloaded clips.
#!/bin/bash
youtube-dl --rm-cache-dir --cookies ./youtube.com_cookies.txt --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist 'https://youtube.com/playlist?list=PL14877460D389BBFA'
@pauloantonelli
pauloantonelli / jwt-expiration.md
Created September 13, 2022 13:04 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@pauloantonelli
pauloantonelli / pre-build.sh
Created March 8, 2022 12:58 — forked from evelyne24/pre-build.sh
Bash script to extract the build name and number from `pubspec.yaml` before building your Flutter app
#!/bin/bash
set -e
file=$(cat pubspec.yaml)
BUILD_NAME=$(echo $file | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p')
BUILD_NUMBER=$(git rev-list HEAD --count)
@pauloantonelli
pauloantonelli / dart-clean-arch-vscode-snippets.json
Created February 23, 2022 14:46
dart clean arch layers vscode snippets
{
// Domain
// Repository
"Dart Clean Arch - Repository Interface Type: Set": {
"prefix": ["repository-interface-set"],
"body": [
"abstract class I${1:RuleName}Repository {\t$0",
" Future<Either<${1:RuleName}RepositoryError, ${2:T}>> call(${3:T} param);",
"}\t$0"
],
@pauloantonelli
pauloantonelli / usefull-tool-for-macOs.md
Last active December 13, 2023 12:46
usefull tool for macOs
@pauloantonelli
pauloantonelli / validators
Created February 12, 2022 12:21
Usefull validators for dart
class Validators {
static bool validateEmail(String value) {
if (value.isEmpty) return false;
final String pattern =
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
final regex = RegExp(pattern);
final result = regex.hasMatch(value);
return result;
}
@pauloantonelli
pauloantonelli / either.dart
Last active February 26, 2023 03:59
dart Either
abstract class IGlobalFailure implements Exception {
final String? message;
IGlobalFailure({this.message});
}
abstract class EitherFailure implements Exception {
final String? message;
EitherFailure({this.message});
}