Skip to content

Instantly share code, notes, and snippets.

View lucassmacedo's full-sized avatar
🎯
Focusing

Lucas Macedo lucassmacedo

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Atualiza os repositórios e pacotes
sudo apt-get update
sudo apt-get upgrade -y
# Instalação de pacotes básicos
sudo apt-get install -y curl git vim
# Configuração do Git
@lucassmacedo
lucassmacedo / gist:a1101a0d094d640cadff85a88a8a49a7
Last active July 10, 2023 12:06
Liga o cron do magento caso esteja offline.
#!/bin/bash
cd /home/ubuntu/evolusom/
status=$(./bin/cron status)
if echo "$status" | grep -q "FAIL"; then
echo "O serviço cron está inativo. Iniciando o cron..."
./bin/cron start
else
echo "O serviço cron já está em execução."
@lucassmacedo
lucassmacedo / gist:75b448f8d56c9f5bc6efbb9bffeaf1ce
Last active June 28, 2023 10:16
Colocar todas as fotos da pasta em pastas por data.
#!/bin/bash
# Pasta contendo as fotos
pasta_fotos="100CANON"
# Lista todas as fotos na pasta (formatos JPG e CR2)
fotos_jpg=("$pasta_fotos"/*.jpg)
fotos_cr2=("$pasta_fotos"/*.cr2)
videos=("$pasta_fotos"/*.mp4)
fotos=("${fotos_jpg[@]}" "${fotos_cr2[@]}" "${videos[@]}")
@lucassmacedo
lucassmacedo / gist:ab901bd589df499f805fe1fe447cacb7
Created June 27, 2023 16:29
Renovação do SSL Automático.
#!/bin/bash
# Executa a renovação do certificado usando o Certbot
certbot renew --quiet
# Verifica o status do certificado renovado
if [ $? -eq 0 ]; then
# Reinicia o Nginx se a renovação for bem-sucedida
service nginx restart
else
ffmpeg -i completo.mp3 -vn -acodec copy -ss 00:06:20 -to 00:21:13 'pedacao.mp3'
@lucassmacedo
lucassmacedo / gist:e0836a6770e6bf6633609bb323b89129
Last active October 26, 2022 12:47
Generate Let's Encrypt SSL to All Hosts
#!/bin/bash
RED="\e[31m"
ENDCOLOR="\e[0m"
for file in ./nginx/sites-available/*.conf; do
domain=$(basename "$file" .conf | cut -d'-' -f2)
if [ ! -d "/etc/letsencrypt/live/$domain" ]; then
certbot certonly --standalone -d "$domain" --agree-tos --non-interactive --register-unsafely-without-email
@lucassmacedo
lucassmacedo / gist:7e393dded5d6e38a126f928885b82a20
Last active December 15, 2021 12:28
Delete Exited Containers on Docker
# docker ps -a = Get all containers
# grep Exited = Filter the Exited Containers
# awk awk '{print $1}' = Filter the first column (ID)
docker rm $(docker ps -a | grep Exited | awk '{print $1}')
@lucassmacedo
lucassmacedo / wpa_supplicant.conf
Last active June 16, 2021 00:36
Configuração Raspberry Wifi
country=BR
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="networkName"
psk="password"
key_mgmt=WPA-PSK
}
@lucassmacedo
lucassmacedo / git.md
Created August 13, 2020 12:46 — forked from linuxster/git.md
[Git Commands] Common git commands. #git

0 Getting & Creating Projects

Command Description
git init Initialize a local Git repository
git clone ssh://git@github.com/[username]/[repository-name].git Create a local copy of a remote repository

1 Create a task branch

With a clean master branch checked out, you can create a task branch by typing: