Skip to content

Instantly share code, notes, and snippets.

View GGontijo's full-sized avatar
💭
Escovando bits..

Dercilio GGontijo

💭
Escovando bits..
View GitHub Profile
@jacksonfdam
jacksonfdam / gist:3000275
Created June 26, 2012 23:56
Regular Expressions List
//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
@tong
tong / beep-starwars
Created August 8, 2013 14:23
PC speaker star wars vader theme
#!/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
@jkpr
jkpr / combine_tables.sh
Created July 3, 2017 15:58
SQLite merge table of one database into table of another
$ 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;
@cryptolok
cryptolok / dbm2m.py
Last active August 19, 2023 12:29
convert WiFi signal strength (dBm) to distance (meters)
#!/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, ...) : ')
@adamsbytes
adamsbytes / python-discord-events.md
Created December 28, 2021 22:44
Retrieving and creating Discord events with Python

Interacting with the Discord Events API using Python

As of writing this, documentation for the Discord events API is a little lacking and the feature is not yet integrated into Discord.py.

The Basics

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.

@GGontijo
GGontijo / DictToGeoJson.py
Created July 7, 2022 12:37
Simple geojson builder from a python dictionary, it works.
import json
class Core:
def json_gen(self, items_list: list):
self.geojson = {}
self.geojson['type'] = 'FeatureCollection'
self.features = []
for item in items_list:
@Rankarusu
Rankarusu / manual.md
Last active June 12, 2024 07:12
Setting up fail2ban with nginx proxy manager running via docker

Setting up fail2ban with nginx proxy manager running via docker

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.

1. install fail2ban

sudo apt install fail2ban
@GGontijo
GGontijo / minecraft_server_autobackup_world.sh
Last active September 28, 2023 12:03
Autobackup Minecraft Server Linux
#!/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