Skip to content

Instantly share code, notes, and snippets.

View Julyo-Hidalgo's full-sized avatar
🎯
Focusing

Julyo Hidalgo Julyo-Hidalgo

🎯
Focusing
View GitHub Profile
@Julyo-Hidalgo
Julyo-Hidalgo / makeReadable.js
Last active June 14, 2025 17:41
Modifying a site to make it more readable.
navs = document.getElementsByTagName('nav')[0].style="display:none";
divs_float_end = document.getElementsByClassName("float-end")[0].style="display:none";
divs_float_start = document.getElementsByClassName("float-start")[0].style="display:none";
@Julyo-Hidalgo
Julyo-Hidalgo / nightMode.sh
Created April 22, 2025 02:32
Bash script to set night mode with the RandR.
#!/bin/bash
currentHour=$(date +%H)
if (( currentHour >= 20 || currentHour < 5 )); then
echo "It is between 8 PM and 5 AM"
xrandr --output eDP --gamma 1.0:0.7:0.5
else
echo "It is outside of 8 PM and 5 AM"
fi
@Julyo-Hidalgo
Julyo-Hidalgo / aliases_inside_shell_script.sh
Last active August 2, 2024 17:41
Bash shell script to access aliases.
#!/bin/bash
echo 'reference: https://www.gnu.org/software/bash/manual/html_node/Aliases#:~:text=Aliases%20are%20not%20expanded%20when%20the%20shell%20is%20not%20interactive%2C%20unless%20the%20expand_aliases%20shell%20option%20is%20set%20using%20shopt%20'
shopt -s expand_aliases
source ~/.bash_aliases # Or ~/.bashrc
alias_name
@Julyo-Hidalgo
Julyo-Hidalgo / for-loop.sh
Created May 24, 2024 18:56
Bash script with for loop.
#!/bin/bash
echo "Count 10 seconds!"
for i in $(seq 1 10); do
echo -n "$i-"
sleep 1
done
echo "Done!"
@Julyo-Hidalgo
Julyo-Hidalgo / sleep.sh
Created May 24, 2024 18:25
Bash script with pause of a few seconds. Bash sleep command.
#!/bin/bash
echo "Hello ..."
sleep 2
echo "... World! Sorry I fell asleep for 2 seconds!"
@Julyo-Hidalgo
Julyo-Hidalgo / current_date_directory_name.sh
Created May 21, 2024 02:19
Bash script to create a directory with the current date in the name. Current Time Stamp in the directory name.
#!/bin/bash
dateNow=$(date "+%F-%H-%M-%S")
mkdir backup$dateNow
@Julyo-Hidalgo
Julyo-Hidalgo / directoryExists.sh
Last active May 24, 2024 18:27
Bash shell script to check if a directory exists or not.
#!/bin/bash
echo "Enter the full directory path: "
read dir
if [ -d "$dir" ]; then
echo "The directory $dir exists."
else
echo "The directory does not exists."
fi
@Julyo-Hidalgo
Julyo-Hidalgo / gitPush.sh
Last active July 11, 2025 16:36
Bash script to push in Git.
#!/bin/bash
#Geting user data
echo 'User name?'
read user
echo 'Email?'
read email
echo 'Message?'
/*testando transações*/
delimiter //
create procedure insere()
begin
declare erro tinyint default false;
declare continue handler for sqlexception set erro = true;/*Handler é quem ira tratar os erros*/
start transaction;
insert into produto(descricao, preco, estoque) values ("cigarro", 20, 4);
insert into venda(cliente, data_venda) values ("Josefino", current_timestamp());
@Julyo-Hidalgo
Julyo-Hidalgo / 1-trigger.sql
Last active September 15, 2022 17:31
aprendendo a usar trigger do sql
/*Meu primeiro "gatilho" :)*/
/*Ocorre quando o inserirmos uma venda, e o estoque precisa diminuir*/
delimiter //
create trigger tgr_venda_item_insert after insert on venda_item
for each row
begin
update produto set estoque = estoque - new.qnt where id = new.id_produto;
end; //
/*Meu segundo trigger*/