Skip to content

Instantly share code, notes, and snippets.

View Esl1h's full-sized avatar
🌎
Quem não tem cUrl, caça com get.

Esli Silva Esl1h

🌎
Quem não tem cUrl, caça com get.
View GitHub Profile
npub150vn9rja0yp8thvzx4mq75g6he58curtpqygxj93xwchu4tqv2xqka39dx
@Esl1h
Esl1h / default.txt
Created June 11, 2024 00:33
Vlang - V Tool help command - vlib/v/help/default.txt
V is a tool for managing V source code.
Usage:
v [options] [command] [arguments]
Examples:
v hello.v Compile the file `hello.v` and output it as
`hello` or `hello.exe`.
v run hello.v Same as above but also run the produced
executable immediately after compilation.
@Esl1h
Esl1h / ServiceRunning.sh
Last active May 15, 2024 22:32
Programming Bash/Shell Classes - Just a little exercise to discover over systemctl and ps commands if a web server are running or not - one in a million of alternatives
#!/bin/bash
function runcheck {
printf "\n" && echo -ne 'Systemctl: ' && systemctl status $SERVICE | grep 'active' | cut -d ' ' -f 7-8
printf "\n" && echo -ne 'Process: ' && ps -ef | grep $SERVICE | grep -v grep | tr -s ' ' | cut -d ' ' -f 2-10 | head -n 1
}
PS3="Select the service: "
select SERVICE in nginx httpd apache2
do
@Esl1h
Esl1h / LBs-TGs.sh
Created April 25, 2023 17:12
Search AWS over load balancers and target groups to find Load balancers without Target groups and find TGs without Registered targets
#!/bin/bash
AWS_REGION="xx-xxxx-1"
AWS_OUTPUT="json"
AWS_PROFILE="xxx"
# 01- ELBs without Target Groups
load_balancers=$(aws elbv2 describe-load-balancers --query "LoadBalancers[*].LoadBalancerArn" --output text --profile $AWS_PROFILE)
for lb in $load_balancers; do
#printf "$lb"'%b\n'
@Esl1h
Esl1h / s3url.py
Created April 11, 2023 21:36
Generate a URL from S3 objects to download (A bucket to storage logs case example)
############################################################################################################
## This script run with python3 and is able to generate pre-signed URLs from files (objects) on a s3. ##
## It is possible with it to generate URLs of several days within the same month and year for several ##
## instances without the need to provide access to the bucket for the user ##
############################################################################################################
import boto3
from colorama import Fore, Style
APP = ''

Keybase proof

I hereby claim:

  • I am esl1h on github.
  • I am esl1h (https://keybase.io/esl1h) on keybase.
  • I have a public key ASACW80CQpL8rhWJiN7fY1Rjy90BWGoH6F7nRnkY0vZ9rQo

To claim this, I am signing this object:

@Esl1h
Esl1h / asciidoc-syntax-quick-reference.adoc
Created September 19, 2022 15:43 — forked from mojavelinux/asciidoc-syntax-quick-reference.adoc
AsciiDoc Syntax Quick Reference (sample document)

AsciiDoc Syntax Quick Reference

@Esl1h
Esl1h / bash_parse_example.sh
Last active September 19, 2023 11:12
How to parse and use yaml file in bash/shell script.
#!/bin/bash
function parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
@Esl1h
Esl1h / xcopy.bat
Created September 6, 2021 14:16
simple batch script to backup folders and files in Windows hosts to another drive or network
@echo
set source=C:\
set destination=\\servername\d$
set command=xcopy /c /d /e /f /g /h /i /r /s /y
set log=D:\backup_log_file.txt
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo # # # Starting files %mydate% at %mytime% >> %log%
@Esl1h
Esl1h / script.sh
Created February 1, 2021 02:13
Solução simples para o desafio: extraia 2 resultados a partir de um arquivo de log - quantidade de logs e quantidade de solicitações
#!/bin/bash
: '
DESAFIO:
Dado um arquivo de log do apache (acess.log) com diversas linhas semelhantes a abaixo:
172.19.0.100 - - [18/Feb/2020:22:35:10 +0000] "GET /index HTTP/1.1" 200 31067 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "172.19.0.2"
172.19.0.103 - - [15/Feb/2020:22:32:02 +0000] "GET /index HTTP/1.1" 200 14034 "-" "Mozilla/5.0 (compatible; SemrushBot/6~bl; +http://www.semrush.com/bot.html)" "172.19.0.4"
172.19.0.104 - - [16/Feb/2020:22:31:32 +0000] "GET /site HTTP/1.1" 200 36565 "https://command-not-found.com/curl" "Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/)" "172.19.0.3"
172.19.0.105 - - [16/Feb/2020:22:30:10 +0000] "GET /credits HTTP/1.1" 200 31067 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "172.19.0.2"