Skip to content

Instantly share code, notes, and snippets.

View pauloantonelli's full-sized avatar

Paulo Antonelli pauloantonelli

View GitHub Profile
@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 / onesingal.service.ts
Created September 29, 2020 01:12 — forked from PsyGik/onesingal.service.ts
OneSignal Angular TypeScript
import {Injectable} from '@angular/core';
import {Cache} from '../utils/storage.provider'; // Decorator to access local storage
let OneSignal;
const url = '';
@Injectable()
export class OneSignalService {
@Cache({pool: 'OneSignal'}) oneSignalInit; // to check if OneSignal is already initialized.
@pauloantonelli
pauloantonelli / infinite-scroll.directive.ts
Created June 19, 2020 00:08 — forked from gangadharjannu/infinite-scroll.directive.ts
This is an Angular 2 infinite scroll directive. It is simple, easy to use and very CPU-efficient.
// USAGE:
//
// When you attach the infiniteScroll directive to an element, it will emit the infiniteScrollAction
// @Output() event every time the user has scrolled to the bottom of the element. Your loadMoreArticles
// function can make an HTTP call and append the results to the articles list, for example. In doing this,
// you effectively increase the height of the element and thus begin the process of the infiniteScroll directive
// again, over and over until the element height stops increasing.
//
// <div class="container" infiniteScroll (infiniteScrollAction)="loadMoreArticles()">
// <div class="article" *ngFor="let article of articles">
@pauloantonelli
pauloantonelli / dddsBrasileiros.json
Created December 17, 2018 20:59 — forked from ThadeuLuz/dddsBrasileiros.json
Objeto JSON com Estados Brasileiros por DDD e lista de DDDs por Estados.
{
"estadoPorDdd": {
"11": "SP",
"12": "SP",
"13": "SP",
"14": "SP",
"15": "SP",
"16": "SP",
"17": "SP",
"18": "SP",