This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX_LOG_FILE_SIZE_IN_MB = 1.00 | |
def get_current_log_file() -> str: | |
logs_path = os.path.join(os.getcwd(), "logs") | |
log_files = os.listdir(logs_path) | |
log_files_numbers = [int(i.split(".")[0].split("-")[-1]) | |
for i in log_files] | |
greater_log_file_number = max(log_files_numbers) | |
current_log_file = os.path.join( | |
os.getcwd(), "logs", f"log-{greater_log_file_number}.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
import requests | |
import json | |
from pprint import pprint | |
from csv import reader,DictReader | |
from ast import literal_eval | |
base_url = "http://localhost:9200" | |
data_stream = "women" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fish | |
1.Create ~/.config/fish/config.fish | |
2.Set aliases here | |
3.Restart fish | |
---------- | |
One-line solution for defining and saving an alias (for example): alias cl 'clear' -s. Instantly works across all sessions and is persisted. | |
Navigate to the ~/.config/fish/functions/ and you'll see cl.fish file. | |
------------------ | |
Functions in this dir are auto-loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Requirements: | |
tabulate==0.8.9 | |
""" | |
import os | |
from tabulate import tabulate | |
headers = ["ALIAS",'USER',"IP","PRIVATE KEY FILE","LOCAL FORWARD","ID"] | |
PRIMARY_SSH_KEY = r"C:\Users\costa\.ssh\sample" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
import requests | |
ZONE = "<zone>" | |
API_VERSION = 4 | |
TYPE_TYPES = list(set(["CAA","A","AAAA","CNAME","URI","MX","SRV","URI","TXT","CERT","DS","HTTPS","LOC","NAPTR","NS","PTR","SMIMEA","SPF","SRV","SSHFP","SVCB","TLSA","TXT"])) | |
TYPE_TYPES.sort() | |
defaults = { | |
"email": "<email>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#misc | |
alias c=clear | |
alias l=ls | |
alias start="xdg-open" | |
#docker | |
alias dcu="docker compose up" | |
alias dcd="docker compose down" | |
alias dcud="docker compose up -d" | |
alias di="docker images" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
digitalocean = { | |
source = "digitalocean/digitalocean" | |
version = "2.10.1" | |
} | |
random = { | |
source = "hashicorp/random" | |
version = "3.1.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host * | |
IdentitiesOnly=yes | |
Port 22 | |
Host <custom_name> | |
Hostname <ip> | |
User <user> | |
IdentityFile <private_key> | |
Host <another_custom_name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read -p 'User: ' user | |
group=$user | |
adduser $user | |
usermod -aG sudo $user | |
cd /home/$user | |
rsync --archive --chown=$user:$group ~/.ssh /home/$user | |
su $user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval "$(ssh-agent -s)" | |
number=100 | |
path=$HOME/.ssh/ | |
read -p 'Keyname: ' keyname | |
comment=$keyname | |
ssh-keygen -a $number -t ed25519 -f $path$keyname -C $comment | |
ssh-add $path$keyname |