Skip to content

Instantly share code, notes, and snippets.

View lsferreira42's full-sized avatar

Leandro Ferreira lsferreira42

View GitHub Profile
@lsferreira42
lsferreira42 / prompt.md
Created September 29, 2026 17:37
Recuperação assistida do Galaxy S20 FE SM-G780F no macOS

Missão: recuperar com segurança um Galaxy S20 FE e diagnosticar o touchscreen

Você é o Claude Code operando em um Mac conectado fisicamente ao telefone. Trabalhe de forma assistida: execute no Mac tudo que puder, oriente uma intervenção física por vez e aguarde a conclusão do usuário. Não entregue apenas um tutorial.

Responda em português. Não peça nem registre IMEI, número de série, senhas, códigos de autenticação, dados bancários ou conteúdo pessoal. Se o Smart Switch pedir número de série, conta ou credenciais, mande o usuário digitá-los diretamente na interface oficial, sem reproduzi-los na conversa ou nos logs.

Objetivo imediato

Restaurar o firmware Samsung oficial mais recente e compatível no Galaxy S20 FE SM-G780F/ZTO usando preferencialmente o recurso oficial de Recuperação de Software de Emergência do Samsung Smart Switch para macOS. Depois da restauração, verificar o touchscreen primeiro no sistema Samsung e também, se necessário, no recovery stock.

#!/usr/bin/env bash
set -euo pipefail
sudo dnf -y update
sudo dnf -y install dnf-plugins-core
sudo dnf -y install epel-release || true
sudo dnf config-manager --set-enabled crb || true

Visualizar os campos disponíveis para itemtype ITILCategory

curl --request GET \
  --url https://glpi.exemplo.com.br/apirest.php/listSearchOptions/ITILCategory \
  --header 'App-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --header 'Session-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
@lsferreira42
lsferreira42 / timeout.sh
Last active November 22, 2023 23:44
Timeout implementation using only bash + common linux tools
function timeout {
time_limit=$1
exec_process=$2 # can be a function too
# Move the parameters to the 2 position
shift 2
# create a pidfile for later reading
pid_file=$(mktemp)
@lsferreira42
lsferreira42 / imch.py
Created March 22, 2023 02:03
create a python script that rename import modules using AST
import ast
import os
def rename_import_modules(source_file, old_module_name, new_module_name):
# Parse the source code into an Abstract Syntax Tree (AST)
with open(source_file) as f:
source = f.read()
tree = ast.parse(source)
# Traverse the AST to find import statements and update the module name
@lsferreira42
lsferreira42 / stop_builds.groovy
Created May 31, 2022 11:19
Some script that i found online to stop all jenkins builds at once
import jenkins.model.Jenkins
def numCancels = 0;
Jenkins.instance.getAllItems(Job.class).each{
def job = it
for (build in job.builds) {
if (build.isBuilding()) {
build.doStop()
numCancels++
}
@lsferreira42
lsferreira42 / nuker.py
Created December 18, 2021 03:17
Threaded socket testing tool
from collections import deque
from queue import Queue
from threading import Thread
import threading
from time import sleep
from collections import Counter
import os
import socket
import sys
import argparse
import boto3
import sys
import os
session = boto3.session.Session(profile_name='legado')
s3 = session.client('s3')
def upload_to_s3(path, bucket):
for root,dirs,files in os.walk(path):
for file in files:
print(os.path.join(root,file))
@lsferreira42
lsferreira42 / yaml_file.py
Created January 22, 2019 19:29 — forked from psobot/yaml_file.py
Real-time YAML object access in Python
"""
liveyamlfile.py
Live Pythonic attribute access to properties in a yaml file.
by Peter Sobot (hi@psobot.com), August 8, 2012
"""
import os
import time
import yaml
import logging
"""Extract jinja2 tags using regexps"""
import re
def extract_tags(value):
reg_findtag = "\{\{(.*?)\}\}"
p = re.compile(reg_findtag)
return p.findall(value)