Skip to content

Instantly share code, notes, and snippets.

"""
Script para ler arquivos XML de eventos eSocial e exportar os dados para um arquivo CSV.
"""
import csv
import xml.etree.ElementTree as ET
from dataclasses import dataclass, field
from pathlib import Path
@dataclass
@rnetonet
rnetonet / postgres-cheatsheet.md
Created May 22, 2025 16:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
pyinstaller --clean compile.spec
@rnetonet
rnetonet / path_firefox.py
Created April 15, 2025 12:34
Find Firefox binary Path using windows register
def path_firefox():
registros = [
winreg.HKEY_LOCAL_MACHINE,
winreg.HKEY_CURRENT_USER
]
chave = r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe"
path = None
for registro in registros:
try:
@rnetonet
rnetonet / mvn-clean-recursive
Last active January 8, 2025 10:18 — forked from mkutz/mvn-clean-recursive
Bash script to execute mvn clean for all sub directories containing a pom.xml
Get-ChildItem -Directory | ForEach-Object {
Set-Location $_.FullName
mvn dependency:purge-local-repository
Set-Location ..
}
@rnetonet
rnetonet / traverse_dict.py
Last active September 27, 2024 16:12
Function to traverse a complex object looking for the first occurence of a determined key (search) in a dict
def t(complext_object, search):
"""
Traverse dictionary to find a key and return its first occurrence value.
"""
if isinstance(complext_object, list):
for item in complext_object:
ret = t(item, search)
if ret:
return ret
elif isinstance(complext_object, dict):
@rnetonet
rnetonet / delete-git-recursively.sh
Created June 18, 2024 22:42 — forked from facelordgists/delete-git-recursively.sh
Recursively remove .git folders
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
@rnetonet
rnetonet / RPi3-Auto-WiFi.md
Created April 26, 2024 11:58 — forked from carry0987/RPi3-Auto-WiFi.md
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connection

Before you start, make sure ip command is available on your system. In modern Linux distributions, ip replaces older ifconfig command. If net-tools package (that includes ifconfig) is not installed and you prefer using it, you can install it via sudo apt-get install net-tools.

Create script file

Use touch /home/pi/wifi-reconnect.sh to create a shell script file, with the following content:

#!/bin/bash
@rnetonet
rnetonet / boolparser.py
Created April 22, 2024 16:53 — forked from leehsueh/boolparser.py
Python Boolean Expression Parser/Evaluator
"""
Grammar:
========
Expression --> AndTerm { OR AndTerm}+
AndTerm --> Condition { AND Condition}+
Condition --> Terminal (>,<,>=,<=,==) Terminal | (Expression)
Terminal --> Number or String or Variable
Usage:
======
@rnetonet
rnetonet / simpleBool.py
Created April 22, 2024 16:52 — forked from kampta/simpleBool.py
Code to evaluate simple boolean logic in python using pyparsing
#
# simpleBool.py
#
# Example of defining a boolean logic parser using
# the operatorGrammar helper method in pyparsing.
#
# In this example, parse actions associated with each
# operator expression will "compile" the expression
# into BoolXXX class instances, which can then
# later be evaluated for their boolean value.