Skip to content

Instantly share code, notes, and snippets.

View gustavonovaes's full-sized avatar

Gustavo Novaes gustavonovaes

View GitHub Profile
@gustavonovaes
gustavonovaes / epson-inkjet-printer-202101w_1.0.1-1lsb3.2_amd64.deb
Last active January 27, 2024 14:50
Install Epson L121 driver in Ubuntu 23.10
This file has been truncated, but you can view the full file.
@gustavonovaes
gustavonovaes / stringsCompareBench.js
Created May 1, 2023 15:37
Levenshtein Distance vs Cosine Similarity
const data = [
["The quick brown fox jumps", ""],
["", "The quick brown box jumps"],
["The quick brown fox jumps", " "],
[" ", "The quick brown box jumps"],
["The quick brown fox jumps", " "],
[" ", "The quick brown box jumps"],
["The quick brown fox jumps", "The quick brown box jumps"],
["The quick brown fox jumps", "The fast brown dog jumps"],
["The red car drives fast", "The blue car drives slow"],
@gustavonovaes
gustavonovaes / linux-disable-mouse-middle-click.sh
Created January 13, 2023 23:54
Disabling middle mouse button in linux
# https://askubuntu.com/a/597071
xinput set-button-map 9 1 0 3
xinput set-button-map 10 1 0 3
@gustavonovaes
gustavonovaes / adblock-plus-filter-youtube-shorts.css
Last active July 8, 2023 12:09
Cut off Shorts from youtube
/*
* Useful links:
*
* https://help.adblockplus.org/hc/en-us/articles/360062859913-Add-a-custom-filter
* https://help.adblockplus.org/hc/en-us/articles/360062733293-How-to-write-filters#elemhide-emulation
*/
/* Grid view */
youtube.com#?#ytd-rich-item-renderer:-abp-has(a#thumbnail[href^="/shorts/"])
@gustavonovaes
gustavonovaes / Either.ts
Last active January 14, 2023 13:35
Example of Either implementation in Typescript
export class Left<T> {
constructor(public value: T) {}
public isLeft(): this is Left<T> {
return true;
}
public isRight(): this is Right<never> {
return false;
}
@gustavonovaes
gustavonovaes / disable_emulator_apps.sh
Created January 31, 2022 12:58
Desativar aplicativos inuteis do emulator
#!/bin/bash
#adb shell pm list packages | awk -F":" '{print $2}'
apps="com.android.chrome
com.google.android.apps.docs
com.google.android.apps.maps
com.google.android.apps.photos
com.google.android.calendar
com.google.android.feedback
javascript: (function() { var elements = document.body.getElementsByTagName('*'); var items = []; for (var i = 0; i < elements.length; i++) { if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { items.push(elements[i]); } } if (items.length > 0) { for (var i = 0; i < items.length; i++) { items[i].innerHTML = ''; } } else { document.body.innerHTML += '<style>* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\ * * { background-color: rgba(0,255,0,.2) !important; }\ * * * { background-color: rgba(0,0,255,.2) !important; }\ * * * * { background-color: rgba(255,0,255,.2) !important; }\ * * * * * { background-color: rgba(0,255,255,.2) !important; }\ * * * * * * { background-color: rgba(255,255,0,.2) !important; }\ * * * * * * * { backgrou
@gustavonovaes
gustavonovaes / uploadBigFiles.php
Created February 20, 2021 19:27
Sending large binary data with XMLHTTPRequest to PHP as stream
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$filePath = __DIR__ . '/out.tmp';
$input = fopen('php://input', 'r');
$output = fopen($filePath, 'w+');
stream_copy_to_stream($input, $output);
; hello_world.asm
;
; Author: Gustavo Novaes
; Date: 2019-10-14
; nasm -f elf32 -o hello.o hello_world.asm
; ld -m elf_i386 -o hello hello.o
global _start
@gustavonovaes
gustavonovaes / links.md
Created November 8, 2019 01:27 — forked from akitaonrails/links.md
Links de referência pro Episódio 66 do Canal Akitando