Skip to content

Instantly share code, notes, and snippets.

@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 / RWADME.md
Created October 22, 2021 08:38
[Mount LUKS encrypted OS]
@GluTbl
GluTbl / date_time.py
Created November 9, 2021 13:05
[Date time "DDMMYY-HHMMSS" with UTC]
start_millis =int(datetime.strptime(start_time, "%d-%m-%Y-%H:%M:%S").replace(tzinfo=timezone.utc).timestamp() *1000)
@GluTbl
GluTbl / resume_gcode_gen.py
Last active January 25, 2022 14:23
[3D printer resumer gcode generator] #python
#!/usr/bin/python3
"""
You need to know the "Z_axis" value of the last saved value
You can save it using the serial data transmited by the 3D printer
For me i use qprompt and pass some data and extract the z axis
"""
@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
@GluTbl
GluTbl / usb_power_up.sh
Last active May 22, 2022 05:24
[Power Up usb for Ubuntu] #shell
echo "Usb power status:"
echo ""
sudo cat /sys/bus/usb/devices/*/power/level
echo ""
echo ""
while true; do
read -p "Do you wish to change usb power status? " yn
case $yn in
[Yy]* ) make install; break;;
@GluTbl
GluTbl / menu_selector.py
Created July 6, 2024 03:25
[Qprompt Menu] using menu selection in qprompt #python
import json
from typing import List, Dict, Any
from qprompt import Menu
class QpromptMenu:
def __init__(self, header: str, data: List[Dict[str, Any]], key_to_show):
self._data = data