Skip to content

Instantly share code, notes, and snippets.

View ilosamart's full-sized avatar
Ludita ou cético, tu decides.

Fábio Tramasoli ilosamart

Ludita ou cético, tu decides.
View GitHub Profile
@ilosamart
ilosamart / sajpermissoes.py
Last active April 24, 2026 20:14
SAJ get locações
import asyncio
import httpx
from config import settings
async def get_saj_token(
keycloak_token_url: str = settings.saj.KEYCLOAK_TOKEN_URL, # type: ignore
keycloak_user: str = settings.saj.KEYCLOAK_USER, # type: ignore
import os
import requests
OLLAMA_ENDPOINT = "https://mpgpt.lab.mp.rs.gov.br/ollama"
API_KEY = os.getenv("API_KEY")
headers = {
"Authorization": f"Bearer {API_KEY}",
@ilosamart
ilosamart / readme.md
Created April 2, 2025 15:35 — forked from estysdesu/readme.md
[Kindle 4: Jailbreak and SSH] #kindle #ssh #jailbreak

Following this guide: https://wiki.mobileread.com/wiki/Kindle4NTHacking#SSH.
Using Kindle 4.1 and macOS 10.14.

  1. Connect the Kindle. It should be recognized as a USB Mass Storage Device.
  2. Download the jailbreak archive
  3. Copy data.tar.gz, ENABLE_DIAGS, and diagnostic_logs to the Kindle folder.
  4. Restart the Kindle into Diagnostics Mode.
  5. Reboot the Kindle from the Diagnostics Mode. Reboot screen should show jailbroken screensaver.
@ilosamart
ilosamart / eternal.py
Last active March 7, 2024 20:17
eternal.py
import subprocess
from threading import Timer
# main, but I'm lazy
with subprocess.Popen(['bash', 'eternal.sh'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8') as proc:
try:
timer = Timer(5, proc.kill)
timer.start()
for line in proc.stdout:
print(f'>> {line.strip()}')
@ilosamart
ilosamart / pdfoptim.sh
Created April 27, 2023 22:15 — forked from slowkow/pdfoptim.sh
Optimize PDF files with Ghostscript.
#!/usr/bin/env bash
# pdfoptim.sh
#
# Optimize a PDF with Ghostscript
#
# Usage
# -----
#
# bash pdfoptim.sh input.pdf output.pdf
#
@ilosamart
ilosamart / simple_oracle.py
Last active July 23, 2021 22:50
simple_oracle.py
class MinhaClasseBonita:
#...
@classmethod
async def get_one(cls, oracle_pool, **kargs ):
retval = {}
async with oracle_pool.acquire() as connection:
async with connection.cursor() as cursor:
# retorna dicts
sql_stmt = cls.get_sql()
@ilosamart
ilosamart / cooldecode.sh
Created June 16, 2021 14:58
Encode / Decode text - ideia ctrl-chupada descaradamente do linkedin do João
# ref.: https://unix.stackexchange.com/questions/98948/ascii-to-binary-and-binary-to-ascii-conversion-tools
#decode
echo "$@" | base64 -d | zcat | perl -lape '$_=pack"(B8)*",@F'
@ilosamart
ilosamart / docker-registry-cleanup.sh
Created April 25, 2019 13:26
clean a docker registry
#!/bin/bash
############################################################
# Limpa 'docker registry' (últimas 2 imagens ficam)
############################################################
# esse carinha depende do https://github.com/dominictarr/JSON.sh
REGISTRY_URL=${1:-http://localhost:8082}
REGISTRY_DATA_VOLUME=${2:-/var/www/docker-registry-data}
@ilosamart
ilosamart / docker_debugging.md
Created March 15, 2019 14:40 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Install ptvsd:
pip install ptvsd
  1. To your launch.json, add this: