Skip to content

Instantly share code, notes, and snippets.

View hbisneto's full-sized avatar
💭
Drinking Coffee ☕

Heitor Bardemaker A. Bisneto hbisneto

💭
Drinking Coffee ☕
View GitHub Profile
@hbisneto
hbisneto / Expression.py
Created January 19, 2025 17:47
Expression.py
import re
from collections import defaultdict
def parse_expression(expression):
"""Converte a string de expressão em uma lista de termos com coeficientes e variáveis."""
# Regex para capturar coeficientes e variáveis
pattern = r'([+-]?\d*)([a-zA-Z]+)'
terms = re.findall(pattern, expression)
parsed_terms = []
for coef, var in terms:
import tkinter as tk
def invert_y(canvas, y):
# Obtendo a altura do canvas
canvas_height = canvas.winfo_height()
# Invertendo a o eixo Y
return canvas_height - y
# Criando a janela principal
root = tk.Tk()
# Lista contendo apenas os itens de farmácia
itens_de_farmacia = []
# Lista de compras
lista_compra = [
"Dipirona",
"Paracetamol",
"Item3",
"Repelente",
"Item5",
@hbisneto
hbisneto / check_conn.py
Created October 30, 2023 16:19
Check if an MQTT client is connected
import paho.mqtt.client as mqtt
flag_connected = 0
def on_connect(client, userdata, flags, rc):
global flag_connected
flag_connected = 1
def on_disconnect(client, userdata, rc):
global flag_connected
@hbisneto
hbisneto / FirefoxDownloader.ps1
Created October 19, 2023 18:50
Download Mozilla Firefox with PowerShell
# Specify the URL of the Firefox download file
$url = "https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US"
# Specify the path for the downloaded file
$output = "$env:temp\FirefoxInstaller.exe"
# Download the file
Invoke-WebRequest -Uri $url -OutFile $output
# Start the installation
Start-Process -FilePath $env:temp\FirefoxInstaller.exe -Args "/silent /install" -Verb RunAs -Wait
@hbisneto
hbisneto / chromeDownloader.ps1
Created October 19, 2023 18:48
Download Google Chrome with PowerShell
# Specify the URL of the Chrome download file
$url = "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
# Specify the path for the downloaded file
$output = "$env:temp\chrome_installer.exe"
# Download the file
Invoke-WebRequest -Uri $url -OutFile $output
# Start the installation
Start-Process -FilePath $env:temp\chrome_installer.exe -Args "/silent /install" -Verb RunAs -Wait
@hbisneto
hbisneto / string_replace.py
Created October 9, 2023 15:43
Python String Replace
string = "Let kids play outside without adult supervision?"
new_string = string.replace("without", "with")
new_string = new_string.replace("?","!")
print(new_string)
@hbisneto
hbisneto / RunningApps.swift
Created September 21, 2023 21:55
Swift code used to get applications list running in a macOS
//
// main.swift
// RunningApps
//
// Created by Heitor Bisneto on 21/09/23.
//
import Foundation
import AppKit
@hbisneto
hbisneto / AssocArray.php
Last active September 1, 2023 17:04
AssocArray.php
<?php
$arrayAssociativo = array(
"nome" => "João",
"idade" => 30,
"cidade" => "São Paulo"
);
$json = json_encode($arrayAssociativo);
?>
@hbisneto
hbisneto / apple_icon.svg
Created July 31, 2023 02:11
MacInfo: Brand New MacInfo App Icon
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.