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 json | |
class Core: | |
def json_gen(self, items_list: list): | |
self.geojson = {} | |
self.geojson['type'] = 'FeatureCollection' | |
self.features = [] | |
for item in items_list: |
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 json | |
class Config: | |
'''Singleton approach''' | |
_instance = None | |
def __init__(self) -> None: | |
CONFIG_FILE = 'conf.json' | |
with open(CONFIG_FILE, 'r') as config: |
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 os | |
for file in os.listdir('.'): | |
if file == 'rename.py': | |
continue | |
name = str(file).split(".")[0] | |
new_name = name + ".jpg" | |
os.rename(file, new_name) | |
print(name + " alterado para " + new_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
from datetime import datetime | |
class Logger(): | |
def log_time() -> str: | |
return datetime.now().strftime("%d/%m/%Y %H:%M:%S") | |
def log_date() -> str: | |
return datetime.now().strftime("%d_%m_%Y") | |
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
#!/bin/bash | |
# Função para enviar uma mensagem ao chat do Minecraft usando rcon-cli | |
send_message() { | |
echo "Sending message to Minecraft chat: $1" | |
docker exec minecraft_server_minecraft-server_1 rcon-cli tellraw @a "{\"text\":\"$1\",\"color\":\"green\"}" | |
} | |
# Função para verificar se o servidor está em autopause |
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
#!/bin/bash | |
#/etc/fail2ban/scripts/fail2ban-telegram.sh | |
# Sends text messages using Telegram | |
# to alert webmaster of banning. | |
# Require one argument, one of the following | |
# start | |
# stop |
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
#/etc/fail2ban/filter.d/npm-auth.conf | |
[INCLUDES] | |
[Definition] | |
failregex = ^ \[error\] \d+#\d+: \*\d+ user "(?:[^"]+|.*?)":? (?:password mismatch|was not found in "[^\"]*"), client: <HOST>, server: \S*, request: "\S+ \S+ HTTP/\d+\.\d+", host: "\S+"(?:, referrer: "\S+")?\s*$ |
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
last_execution = datetime.now(tz=pytz.timezone('America/Cuiaba')) | |
def cooldown(): | |
global last_execution | |
now = datetime.now(tz=pytz.timezone('America/Cuiaba')) | |
if last_execution is not None: | |
difference_time = (now - last_execution).seconds | |
remaining_time = 120 - difference_time | |
if difference_time < 120: | |
raise Exception(f'Please wait {remaining_time} seconds before another try!') |
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
palavra="teste"; texto_adicional="deu certo"; for arquivo in teste*; do grep -q "$palavra" "$arquivo" && sed -i "/$palavra/ s/$/ $texto_adicional/" "$arquivo" && echo "Texto adicionado em $arquivo"; done |
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
sed -i -e 's@Exec=/usr/bin/microsoft-edge-dev %U@Exec=/usr/bin/microsoft-edge-dev %U --no-sandbox@g' /usr/share/applications/microsoft-edge-dev.desktop | |
sed -i -e 's@Exec=/usr/bin/google-chrome-stable %U@Exec=/usr/bin/google-chrome-stable %U --no-sandbox@g' /usr/share/applications/google-chrome.desktop |
OlderNewer