Skip to content

Instantly share code, notes, and snippets.

View aristidesneto's full-sized avatar

Aristides Neto aristidesneto

View GitHub Profile
@aristidesneto
aristidesneto / docker-history.py
Last active May 15, 2024 12:20
Get Dockerfile from Docker Image
# pip install docker
import docker
from sys import argv
cli = docker.APIClient(base_url='unix://var/run/docker.sock')
images = cli.images()
image_id = argv[-1]
@aristidesneto
aristidesneto / gist:6cac19d4e223afd83ff07c2b8633d6a1
Created September 22, 2023 16:08
Change commit message by branch name. Ex: feature/1234 => [ DSO-1234] - My commit message
#!/bin/bash
BRANCH_NAME=$(git symbolic-ref --short HEAD)
TICKET="${BRANCH_NAME##*/}"
EXP='^[0-9]+$'
if [ -n "$BRANCH_NAME" ] && [[ $TICKET =~ $EXP ]]; then
sed -i.bak -e "1s/^/[ DSO-$TICKET ] - /" $1
fi
@aristidesneto
aristidesneto / replace.sh
Created April 29, 2023 01:53
Replace email and name message commit
#!/bin/bash
git filter-branch --env-filter '
WRONG_EMAIL="[email protected]"
NEW_NAME="Your Name"
NEW_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
export GIT_COMMITTER_NAME="$NEW_NAME"
@aristidesneto
aristidesneto / backup-mysql-to-s3.sh
Created March 14, 2023 23:09
Backup mysql and sync with aws s3
#!/bin/bash
#
# Autor: Aristides Neto
# Email: [email protected]
#
# Data: 11/03/2023
#
# Realiza o backup de bancos de dados MySQL
# Sincroniza com o S3 da AWS
#
@aristidesneto
aristidesneto / nm_l2tp_ipsec_vpn.md
Created November 26, 2020 16:50 — forked from pastleo/nm_l2tp_ipsec_vpn.md
setup L2TP IPSEC VPN in archlinux using NetworkManager
// Gera o arquivo XML do sitemap
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>'.HOME.'</loc>
<lastmod>'.$date.'</lastmod>

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
@aristidesneto
aristidesneto / jail.local
Created September 18, 2019 10:56
Regras do Fail2ban
[DEFAULT]
# Adicione IPs internos e o DNS do Google na lista de redes confiaveis
ignoreip = 127.0.0.0/8 10.0.0.0/8 8.8.8.8 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 104.16.0.0/12 108.162.192.0/18 131.0.72.0/22 141.101.64.0/18 162.158.0.0/15 172.64.0.0/13 173.245.48.0/20 188.114.96.0/20 190.93.240.0/20 197.234.240.0/22 198.41.128.0/17 199.27.128.0/21
# Caso utilize o ManageWP terá que adicionar os IPs deles na WhiteList também (após o último IP na lista acima acrescente um espaço em branco e cole estes endereços):
# 35.162.254.253 52.11.12.231 52.11.29.70 52.11.54.161 52.24.142.159 52.25.191.255 52.27.181.126 52.34.126.117 52.34.254.47 52.35.82.99 52.36.28.80 52.38.106.97 52.39.177.152 52.41.230.148 52.41.237.12 52.42.126.166 52.43.13.71 52.43.76.224 52.88.96.110 52.89.155.51 54.148.73.118 54.186.37.105 54.187.92.57 54.191.32.65 54.191.67.23 54.191.80.119 54.191.135.209 54.191.136.176 54.191.137.17 54.191.148.85 54.191.149.8 52.26.122.21 52.24.187.29 52.89.85.107 54.186.128.167 54.191.40.136 52.24.62.11 5
@aristidesneto
aristidesneto / backup_database.sh
Last active December 16, 2020 20:33
Backup de banco de dados Mysql
#!/bin/bash
#
# Autor: Aristides Neto
# Email: [email protected]
#
# Data: 09/06/2019
#
# Realiza o backup de bancos de dados MySQL
#
@aristidesneto
aristidesneto / grafana.json
Created May 29, 2019 15:20
Dashboard para Grafana - Monitorando recursos do servidor
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",