Skip to content

Instantly share code, notes, and snippets.

@GluTbl
GluTbl / ReadMe.md
Created March 2, 2021 05:06
[Esptool]
@GluTbl
GluTbl / logger_util.py
Last active August 11, 2024 17:00
[Python logger] get logging in python #python
import logging
# Copied from https://stackoverflow.com/a/56944256
class LogFormat(logging.Formatter):
BLUE = {"color": "blue"}
GREEN = {"color": "green"}
GREY = {"color": "grey"}
YELLOW = {"color": "yellow"}
RED = {"color": "red"}
@GluTbl
GluTbl / ultrasonic_distance_measure.ino
Created April 26, 2021 05:31
[Ultrasonic distance measurre without delay by using interupts]
#include <Arduino.h>
#include <Ticker.h>
#define ULTRASONIC_PIN_INPUT D1
#define ULTRASONIC_PIN_OUTPUT D4
@GluTbl
GluTbl / pdf_eroder.py
Last active July 3, 2021 09:00
[Pdf Erorder] #python
import os
import shutil
import sys
import traceback
import uuid
import time
import cv2
import numpy as np
from fpdf import FPDF
from pdf2image import convert_from_path, pdfinfo_from_path
@GluTbl
GluTbl / image2stl.py
Created July 6, 2021 04:50
[image to stl] #python3
#Source code copied from https://github.com/andrisdru/image2stl
#pip3 install numpy-stl pillow argparse
import argparse
import numpy as np
from stl import mesh
from PIL import Image
@GluTbl
GluTbl / subprocess_utill.py
Created July 17, 2021 08:48
[Python runnng subprocess]
################Executing Command################
def execution_timer(time_out, cmd_process):
kill = lambda process: process.kill()
my_timer = Timer(time_out, kill, [cmd_process])
try:
my_timer.start()
stdout, stderr = cmd_process.communicate()
finally:
@GluTbl
GluTbl / execute_util.py
Created July 29, 2021 07:56
[Execute shell in python]
import shlex
import subprocess
def execute_command(command: str, path=None):
command_splited = shlex.split(command)
if path is None:
process = subprocess.Popen(command_splited)
else:
process = subprocess.Popen(command_splited, cwd=path)
process.communicate()
@GluTbl
GluTbl / test_arduino_gpio.cpp
Created September 18, 2021 16:32
[GPIO arduino test] #arduino
//For digital pins
#define DIGITAL_PIN_COUNT 12
char *digital_pins[] = {"D0", "D1", "D2" , "D3" , "D4" , "D5", "D6", "D7", "D8", "D9", "D10", "D11", "D12", "D13"};
int *valid_digital_pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
////////////////////////
//For Aanlogue pin
#define ANALOG_PIN_COUNT 6
@GluTbl
GluTbl / README.md
Last active May 18, 2025 15:51
[Mount LUKS encrypted OS]
@GluTbl
GluTbl / install.sh
Created December 1, 2021 11:56
[Setting VNC Server on UBUNTU]
sudo apt update
sudo apt-get install tigervnc-scraping-server
mkdir -p ~/.vnc
vncpasswd
x0vncserver -passwordfile ~/.vnc/passwd -display :0