trying to follow this tutorial, i was not able to get fail2ban to work in my setup, so here is a gist in case I forget.
sudo apt install fail2ban| #https://www.geeksforgeeks.org/diagnosing-and-fixing-memory-leaks-in-python/ | |
| from contextlib import asynccontextmanager | |
| import logging | |
| import tracemalloc | |
| from fastapi import FastAPI, Request | |
| # Start Tracemalloc | |
| @asynccontextmanager | |
| async def lifespan(app: FastAPI): |
| #!/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 |
trying to follow this tutorial, i was not able to get fail2ban to work in my setup, so here is a gist in case I forget.
sudo apt install fail2ban| import json | |
| class Core: | |
| def json_gen(self, items_list: list): | |
| self.geojson = {} | |
| self.geojson['type'] = 'FeatureCollection' | |
| self.features = [] | |
| for item in items_list: |
As of writing this, documentation for the Discord events API is a little lacking and the feature is not yet integrated into Discord.py.
This gist presents a basic class that performs a couple event actions against the Discord API.
To interact with the Discord API you need an async http client, for this gist it'll be aiohttp. You'll need a Discord bot created, and to have a token generated for that bot. Your bot will also need event permissions in the guilds/servers you are trying to create events in.
| #!/usr/bin/env python2 | |
| # a simple script for one of my articles - https://cryptolok.blogspot.com/2017/08/practical-wifi-hosts-triangulation-with.html | |
| from math import log10 | |
| MHz=raw_input('MHz FREQUENCY (2417, 5200, ...) : ') | |
| MHz=int(MHz) | |
| dBm=raw_input('dBm TRANSMITTER POWER (23, 63, ...) : ') |
| $ sqlite3 db1.sqlite | |
| > ATTACH '/path/to/db2.sqlite' AS mergeme; | |
| > BEGIN; | |
| > INSERT INTO photos SELECT * FROM mergeme.photos WHERE mergeme.photos.orig_md5 NOT IN (SELECT orig_md5 FROM photos); | |
| > COMMIT; | |
| > DETACH mergeme; |
| #!/bin/bash | |
| beep -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 250 -f 622.26 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 369.99 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 739.98 -D 100 --new -l 25 -f 698.46 -D 100 --new -l 25 -f 659.26 -D 100 --new -l 25 -f 622.26 -D 100 --new -l 50 -f 659.26 -D 400 --new -l 25 -f 415.3 -D 200 --new -l 350 -f 554.36 -D 100 --new -l 250 -f 523.25 -D 100 --new -l 25 -f 493.88 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 25 -f 440 -D 100 --new -l 50 -f 466.16 -D 400 --new -l 25 -f 311.13 -D 200 --new -l 350 -f 369 |
| //Regular Expressions List | |
| //Short Tutorial | |
| \ // the escape character - used to find an instance of a metacharacter like a period, brackets, etc. | |
| . // match any character except newline | |
| x // match any instance of x | |
| ^x // match any character except x | |
| [x] // match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z | |
| | // an OR operator - [x|y] will match an instance of x or y |