Skip to content

Instantly share code, notes, and snippets.

View turicas's full-sized avatar

Álvaro Justen turicas

View GitHub Profile
@turicas
turicas / free-software-licenses.csv
Created August 10, 2016 01:31
Download list of free software licenses from GNU page
name short_name url
GNU General Public License (GPL) version 3 GNUGPLv3 https://www.gnu.org/licenses/gpl.html
GNU General Public License (GPL) version 2 GPLv2 https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
GNU Lesser General Public License (LGPL) version 3 LGPLv3 https://www.gnu.org/licenses/lgpl.html
GNU Lesser General Public License (LGPL) version 2.1 LGPLv2.1 https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
GNU Affero General Public License (AGPL) version 3 AGPLv3.0 https://www.gnu.org/licenses/agpl.html
GNU All-Permissive License GNUAllPermissive https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html
Apache License, Version 2.0 apache2 http://directory.fsf.org/wiki/License:Apache2.0
Artistic License 2.0 ArtisticLicense2 http://directory.fsf.org/wiki/License:ArtisticLicense2.0
Clarified Artistic License ClarifiedArtisticLicense http://gianluca.dellavedova.org/2011/01/03/clarified-artistic-license/
@turicas
turicas / programming-languages.csv
Created August 10, 2016 02:16
Download list of programming languages from Wikipedia
name wikipedia_url
A# .NET https://en.wikipedia.org/wiki/A_Sharp_(.NET)
A# (Axiom) https://en.wikipedia.org/wiki/A_Sharp_(Axiom)
A-0 System https://en.wikipedia.org/wiki/A-0_System
A+ https://en.wikipedia.org/wiki/A%2B_(programming_language)
A++ https://en.wikipedia.org/wiki/A%2B%2B
ABAP https://en.wikipedia.org/wiki/ABAP
ABC https://en.wikipedia.org/wiki/ABC_(programming_language)
ABC ALGOL https://en.wikipedia.org/wiki/ABC_ALGOL
ABSET https://en.wikipedia.org/wiki/ABSET
@turicas
turicas / secure_delete.py
Created April 9, 2026 11:59
Securely delete a list of files/directories
#!/usr/bin/env python3
"""
Securely delete directories, making file recovery via software tools (testdisk, photorec, extundelete etc.)
impractical.
Per-file strategy:
1. Overwrite contents 3x (zeros, ones, random), writing at least MIN_OVERWRITE_BYTES even for small files
2. Truncate to 0 bytes
3. Rename to a random name (destroys original directory entry)
4. Unlink
@turicas
turicas / README.md
Last active March 17, 2026 13:27
View to get postgres table sizes (table, toast, index and total size for each one)

postgres table sizes

The result will be like this:

 schema |                table                | row_estimate  | total_size | index_size | toast_size | table_size | table_size_ratio | avg_row_size | total_bytes | index_bytes | toast_bytes | table_bytes 
--------+-------------------------------------+---------------+------------+------------+------------+------------+------------------+--------------+-------------+-------------+-------------+-------------
 public | estabelecimento                     | 5.4933384e+07 | 17 GB      | 4901 MB    | 8192 bytes | 12 GB      |             0.72 |       332.22 | 18249842688 |  5139447808 |        8192 | 13110386688
 public | empresa                             |  5.211064e+07 | 9883 MB    | 3985 MB    | 8192 bytes | 5898 MB    |             0.60 |       198.87 | 10363297792 |  4178649088 |        8192 |  6184640512
@turicas
turicas / xls2csv.py
Created March 11, 2026 15:30
Converte XLS para CSV, eliminando linhas e colunas totalmente em branco
# pip install xlrd
import argparse
import csv
from functools import lru_cache
from pathlib import Path
import xlrd
@lru_cache(maxsize=64 * 1024)
@turicas
turicas / attrdict.py
Created December 22, 2011 16:21
Python class with dict-like get/set item
#!/usr/bin/env python
# coding: utf-8
class AttrDict(object):
def __init__(self, init=None):
if init is not None:
self.__dict__.update(init)
def __getitem__(self, key):
return self.__dict__[key]
@turicas
turicas / README.md
Last active March 5, 2026 14:24
Python versions in Debian and Ubuntu official Docker images
@turicas
turicas / Transcrição de textos em Português com whisper (OpenAI).ipynb
Last active February 12, 2026 13:14
Transcrição de textos em Português com whisper (OpenAI)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@turicas
turicas / keycloak_local_setup.py
Created March 7, 2025 06:38
Script to create keycloak realm, backend and frontend clients and user accounts
# pip install python-keycloak
import os
from keycloak import KeycloakAdmin
from keycloak.exceptions import KeycloakGetError
server_url = "http://keycloak:8080/auth/"
admin_username = "admin"
admin_password = "admin"
@turicas
turicas / telegram.py
Created December 2, 2025 19:28
CLI to send messages via Telegram API Bot (using only Python stdlib)
import argparse
import os
import sys
from http.client import HTTPResponse
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
def send_telegram_message(token: str, chat_id: int, message: str, parse_mode: str, timeout: float) -> HTTPResponse: