Skip to content

Instantly share code, notes, and snippets.

View lucaslgr's full-sized avatar
🎯
Focusing

Lucas Guimarães lucaslgr

🎯
Focusing
View GitHub Profile
@lucaslgr
lucaslgr / exercicio-manipulacao-lib-json-simple.java
Created November 3, 2021 11:02
Exercício manipulação de JSON usando lib json simple entrega 03/11/2021
package com.exercicio.aula17exerciciojsonobject;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.io.FileNotFoundException;
@lucaslgr
lucaslgr / exercicio-loop-json.java
Created October 31, 2021 19:53
Dentro do método leMultiplosObjetosDoJSON é implementado a lógica para iterar pelos atributos de um objeto JSON
package com.exercicio.aula17exerciciojsonobject;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.io.FileNotFoundException;
@lucaslgr
lucaslgr / script.js
Created July 18, 2021 18:33
Pega elemento na tela async
//Funcao que pega um elemento na tela de forma assincrona
function getElementAsync(selector) {
return new Promise((resolve, reject) => {
const element = null;
const idInterval = setInterval(() => {
try {
const element = document.querySelector(selector);
if (element) {
clearInterval(idInterval);
@lucaslgr
lucaslgr / Script SQL to return FK from database
Created January 14, 2021 13:55
Script SQL para retornar todas foreign keys da respectiva database em uso
SELECT
`TABLE_SCHEMA`, -- Foreign key schema
`TABLE_NAME`, -- Foreign key table
`COLUMN_NAME`, -- Foreign key column
`REFERENCED_TABLE_SCHEMA`, -- Origin key schema
`REFERENCED_TABLE_NAME`, -- Origin key table
`REFERENCED_COLUMN_NAME` -- Origin key column
FROM
`INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` -- Will fail if user don't have privilege
WHERE
@lucaslgr
lucaslgr / Linux programs backup
Created January 6, 2021 20:31
An attempt for backup a list of easy way to recover my programs after a linux reinstall
#!bin/bash
# ----------------------------- VARIÁVEIS ----------------------------- #
#PPA
#[NENHUMA AINDA]
#URL
URL_GOOGLE_CHROME="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
#DIRETORIO
DIRETORIO_DOWNLOADS="$HOME/Downloads/programas"
@lucaslgr
lucaslgr / .zshrc
Created January 6, 2021 20:07
Configuration file of setings ZSH terminal for backup
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/lgrwolf/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@lucaslgr
lucaslgr / linkedin.js
Created December 21, 2020 20:47
Only a linkedin simple script to expand your network
function conectOneMore() {
var nToConnect = document.querySelectorAll('button[aria-label^="Conecte-se"]').length;
console.log('Número para se conectar: ' + nToConnect);
var nToFollow = document.querySelectorAll('button[aria-label^="Seguir"]').length;
console.log('Número para seguir: ' + nToFollow);
if (nToConnect > 0) {
setTimeout(() => {
if (document.querySelector('button[aria-label^="Conecte-se"]'))
@lucaslgr
lucaslgr / acelerador de video
Last active June 16, 2021 19:08
Acelerador de video para tag <video>e <iframe>
//<IFRAME>
var playbackRate = 3;
var data = {event: 'command', func: 'setPlaybackRate', args: [playbackRate, true]};
var message = JSON.stringify(data);
$('iframe')[0].contentWindow.postMessage(message, '*');
//<ALL IFRAMES WITHOUT JQUERY>
var playbackRate = 3;
var data = {event: 'command', func: 'setPlaybackRate', args: [playbackRate, true]};
var message = JSON.stringify(data);
@lucaslgr
lucaslgr / delete-all-tables.sql
Created December 17, 2020 12:15
SQL script to delete all tables in a Database dynamically
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = 'database_name'; -- specify DB name here.
SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
@lucaslgr
lucaslgr / gist:583e91eadcfe9664c9915c63cc8ad75a
Created September 14, 2020 12:48
Settings do VsCode para JS e ES6
{
//!Settings of Oh My Zsh
"terminal.integrated.shell.linux": "/bin/zsh",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback', 'PowerlineSymbols'",
// "workbench.colorTheme": "Monokai",
"editor.fontSize": 15,
"editor.lineHeight": 26,
"editor.tabSize": 2,