Skip to content

Instantly share code, notes, and snippets.

View thenriquedb's full-sized avatar
⚛️

Thiago Henrique Domingues thenriquedb

⚛️
View GitHub Profile
@thenriquedb
thenriquedb / unsubscribe-all-channels.js
Created December 24, 2021 03:41
Unsubscribe all channels youtube
var i = 0;
var count = document.querySelectorAll("ytd-channel-renderer:not(.ytd-item-section-renderer)").length;
myTimer();
function myTimer () {
if (count == 0) return;
el = document.querySelector('.ytd-subscribe-button-renderer');
el.click();
/*eslint-disable */
'use strict';
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
# https://unix.stackexchange.com/questions/62818/how-can-i-switch-between-different-audio-output-hardware-using-the-shell
CURRENT_PROFILE=$(pacmd list-cards | grep "active profile" | cut -d ' ' -f 3-)
if [ "$CURRENT_PROFILE" = "<output:hdmi-stereo>" ]; then
pacmd set-card-profile 0 "output:analog-stereo+input:analog-stereo"
else
pacmd set-card-profile 0 "output:hdmi-stereo"
@thenriquedb
thenriquedb / SimpleChat.java
Created July 3, 2021 20:28
Simple text-based chat application (SimpleChat), with the following features:
package com.simpleChat;
import org.jgroups.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
// Reference: http://www.jgroups.org/tutorial/#_configuration
public class SimpleChat extends ReceiverAdapter{
/*
* JGroups uses a JChannel as the main API to connect to a cluster, send and receive messages, and to register
@thenriquedb
thenriquedb / forceComponentMount.js
Last active March 29, 2021 12:24
Garante o unmount e mount do componente
useEffect(() => {
let isUnmonted = false;
const runAsync = async () => {
try {
if (!isUnmonted) { } // Performa o update
} catch (e) {
if (!isUnmonted) { } // Gerencia o erro
}
};
@thenriquedb
thenriquedb / Validate input float in javascript
Created June 27, 2020 20:25
validate input float in javascript
const validate = (value) => {
if (!parseFloat(value)) {
setQuantity('');
setSubTotal(0);
return;
}
const valueStr = value.toString().replace(',', '.');
if ((valueStr.match(/\./gi) || []).length > 1) return;
@thenriquedb
thenriquedb / database.js
Created March 3, 2020 13:14
Sequelize database configs
module.exports = {
dialect: 'postgres',
host: 'localhost',
username: 'user',
password: 'password',
database: 'database',
define: {
timestamps: true,
underscored: true,
const { resolve } = require('path');
module.exports = {
'config': resolve(__dirname, 'src', 'config', 'database.js'),
'models-path': resolve(__dirname, 'src', 'app', 'models'),
'seeders-path': resolve(__dirname, 'src', 'database', 'seeders'),
'migrations-path': resolve(__dirname, 'src', 'database', 'migrations'),
};
module.exports = {
env: {
es6: true,
node: true
},
extends: ["airbnb-base"],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
},