Skip to content

Instantly share code, notes, and snippets.

View FelipeGrijo's full-sized avatar

Felipe Grijó FelipeGrijo

View GitHub Profile

Como Usar

  • Instale o Tampermonkey no Chrome ou Firefox
  • Clique no botão "Raw" ou clique aqui pra instalar o userscript de forma automática

Você também pode clicar no ícone do Tampermonkey, "Adicionar novo script...", colar o conteúdo e depois salvar (CTRL+S)

@FelipeGrijo
FelipeGrijo / readline.js
Last active February 13, 2025 17:29
readline nodejs
// https://gist.github.com/FelipeGrijo
import readline from 'node:readline/promises';
import { stdin, stdout } from 'node:process';
const rl = readline.createInterface({ input: stdin, output: stdout });
const ask = rl.question.bind(rl);
// const waitForEnter = async (msg = 'Pressione Enter para continuar...') => await ask(msg);
const prompt = async (questions) => {
@FelipeGrijo
FelipeGrijo / holdKey.ahk
Created September 25, 2020 14:11
Pressiona tecla por x segundos. AutoHotkey
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
^r::Suspend ; Control + R = pausa
^+r::ExitApp ; Control + Shift + R = fecha
r:: ; R = pressiona letra E pora 1 seg
Send, {e Down}
Sleep, 1000
Send, {e Up}
const SSE = new EventSource('http://localhost:3000');
SSE.onmessage = (event) => {
const obj = JSON.parse(event.data);
console.log(obj);
};
@FelipeGrijo
FelipeGrijo / ytdl.js
Last active September 20, 2020 08:51
youtube-dl promisify nodejs
// https://gist.github.com/FelipeGrijo
// https://www.npmjs.com/package/youtube-dl
const util = require('util');
const youtubedl = require('youtube-dl'); // 3.0.2 -- 2020.09.20
const ytdl = util.promisify(youtubedl);
const videoUrl = 'http://www.youtube.com/watch?v=AQ4MQ_uhBSs'; // url ou id
const getMusic = async (url, formatId = 140) => {
try {
@FelipeGrijo
FelipeGrijo / ssl.md
Created March 12, 2018 21:43
SSL Xampp Windows

Xampp

Crie um arquivo v3.ext dentro da pasta apache (C:\xampp\apache) e cole:

authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
@FelipeGrijo
FelipeGrijo / qnt-id.php
Last active June 26, 2017 06:27
Contar quantidade de ids de um banco de dados usando mysqli
<?php
//https://gist.github.com/FelipeGrijo
$host = 'localhost';//Endereco
$user = 'root';//Usuario
$pass = '';//Senha
$db = 'contas2';//Nome do banco de dados
$mysqli = new mysqli($host,$user,$pass,$db);
$sql="SELECT count(id) AS total FROM usuarios";//usuarios = nome da tabela
//$sql="SELECT count(id) AS total FROM usuarios where ativo='0'";
@FelipeGrijo
FelipeGrijo / VerificarAlteracao.sh
Created June 22, 2017 14:16
Verifica constantemente um arquivo, e envia um alerta via Pushbullet caso tenho sido alterado.
#!/bin/bash
#sudo apt install inotify-tools
#Envia um alerta no PushBullet quando o arquivo for alterado
#https://gist.github.com/FelipeGrijo
while inotifywait -q -e modify LOCAL-DO-ARQUIVO >/dev/null;
do
API="SUA-API"
MSG="$1"
Title="Arquivo-Sincronizado"
curl -u $API: https://api.pushbullet.com/v2/pushes -d type=note -d title="$Title" -d body="$MSG"
@FelipeGrijo
FelipeGrijo / Backup.bat
Last active April 14, 2017 01:12
Salvar PDFs
::https://gist.github.com/FelipeGrijo
xcopy /Y /S /C /G /H "C:\Users\*.pdf" "D:\"
::Mudar diretório
@FelipeGrijo
FelipeGrijo / resource.rc
Last active March 7, 2017 16:47
Ícone
#ifndef _resource_rc
#define _resource_rc
MAINICON ICON "icone.ico"
#endif