Skip to content

Instantly share code, notes, and snippets.

View brunolaranjeira's full-sized avatar

Bruno Laranjeira brunolaranjeira

View GitHub Profile
@RobinDeBaets
RobinDeBaets / pdfdownload.js
Created February 28, 2023 22:13
This script allows you to download view-only PDF's on Google Drive. Simply open the document, scroll through it until all pages are loaded and then execute this script in your browser console. This script has some improvements compared to other scripts and avoids blur on high-resolution images.
let pdfScript = document.createElement("script");
function rescale(width, height, fitWidth, fitHeight) {
let ratio = width / height;
let fitRatio = fitWidth / fitHeight;
if (ratio <= fitRatio) {
// Dimensions to fit are wider, fix the width
return [width, width / fitRatio];
} else {
// Dimensions to fit are taller, fix the height
return [height * fitRatio, height];
@joulgs
joulgs / terminal.txt
Last active November 14, 2024 11:19
How install libssl1.1 on ubuntu 22.04
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
@azu
azu / electron.yml
Created September 17, 2019 12:02
Electron Release workflow for GitHub Actions
name: Electron CD
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
@yackermann
yackermann / verify.safetynet.webauthn.js
Last active November 30, 2021 10:47
WebAuthn Android SafetyNet attestation verification sample in NodeJS
const crypto = require('crypto');
const base64url = require('base64url');
const cbor = require('cbor');
const jsrsasign = require('jsrsasign');
let gsr2 = 'MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9iYWxzaWduLm5ldC9yb290LXI
@soulmachine
soulmachine / jwt-expiration.md
Last active September 21, 2024 03:49
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:

@cpicanco
cpicanco / Monokai.xml
Last active May 13, 2024 07:31
Dark theme for Lazarus IDE. Copy to "userschemes" inside primary config path
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Lazarus>
<ColorSchemes Version="11">
<Names Count="1">
<Item1 Value="Monokai"/>
</Names>
<Globals Version="11">
<SchemeMonokai>
<ahaGutter Background="2238503"/>
@msuchodolski
msuchodolski / electron_drag_disable.css
Last active September 23, 2024 09:39
Disable dragging and selecting html elements (like links, images etc...) in Electron
/**
* MAKE ELECTRON APP FEEL MORE NATIVE
*
* * Prevent dragging all HTML elements, specially:
* - images
* - links (anchors)
*
* * Prevent text selection
*/
@suhas-karanth
suhas-karanth / node_pm2_update.md
Last active March 28, 2024 00:42
Upgrading node and pm2 using nvm

Update node using nvm

nvm install 6.3
nvm alias default 6.3
nvm use 6.3

Install and Update pm2

npm install pm2@latest -g ; pm2 update
@guivan
guivan / tabela-cfop
Last active June 14, 2024 12:24
Lista de CFOP - Código Fiscal de Operação e Prestação CSV
1000;"ENTRADAS OU AQUISIÇÕES DE SERVIÇOS DO ESTADO"
1100;"COMPRAS PARA INDUSTRIALIZAÇÃO, COMERCIALIZAÇÃO OU PRESTAÇÃO DE SERVIÇOS"
1101;"Compra para industrialização ou produção rural"
1102;"Compra para comercialização"
1111;"Compra para industrialização de mercadoria recebida anteriormente em consignação industrial"
1113;"Compra para comercialização, de mercadoria recebida anteriormente em consignação mercantil"
1116;"Compra para industrialização ou produção rural originada de encomenda para recebimento futuro"
1117;"Compra para comercialização originada de encomenda para recebimento futuro"
1118;"Compra de mercadoria para comercialização pelo adquirente originário, entregue pelo vendedor remetente ao destinatário, em venda à ordem"
1120;"Compra para industrialização, em venda à ordem, já recebida do vendedor remetente"
@dun4n
dun4n / vcard.html
Last active November 4, 2024 15:26
#JavaScript vcard generator example
<!doctype html>
<html>
<head>
<script type="text/javascript" src="vcard2.js"></script>
</head>
<body>
<script type="text/javascript">
// With helper methods
var fooBar = vCard.create(vCard.Version.FOUR)
fooBar.addFormattedname("Mr Foo Bar")