Skip to content

Instantly share code, notes, and snippets.

View AlexEshoo's full-sized avatar

Alex AlexEshoo

View GitHub Profile
print 'Hello World!'
@AlexEshoo
AlexEshoo / gist:89e5e049699e95998c11968f9b42d626
Created August 2, 2017 18:17
PyQt5 system tray program init
import sys
from PyQt5 import QtWidgets, QtGui
class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
def __init__(self, icon, parent=None):
QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
menu = QtWidgets.QMenu(parent)
exitAction = menu.addAction("Exit")
self.setContextMenu(menu)
@AlexEshoo
AlexEshoo / sys_tray_qt_gist.py
Created August 2, 2017 18:17
PyQt5 system tray program init
import sys
from PyQt5 import QtWidgets, QtGui
class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
def __init__(self, icon, parent=None):
QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
menu = QtWidgets.QMenu(parent)
exitAction = menu.addAction("Exit")
self.setContextMenu(menu)
from PIL import Image, ImageGrab
import time
import datetime
prev = datetime.datetime.now()
while True:
#im.show()
im = ImageGrab.grab()
colors = im.getcolors(95570)#16777216) #max number of colors in 24bit color depth
import serial
import threading
port = serial.Serial(
port='COM14',
baudrate=9600,
timeout=10
)
def write_power(p):
@AlexEshoo
AlexEshoo / progress_bar.py
Created May 1, 2018 19:40
Python Progress Bar
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'):
"""
Source: https://stackoverflow.com/a/34325723/4017197
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
suffix - Optional : suffix string (Str)
decimals - Optional : positive number of decimals in percent complete (Int)
@AlexEshoo
AlexEshoo / parametric_spline.py
Created August 30, 2018 15:30
Parametric Spline path
from matplotlib import pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
t = np.linspace(0, 10, 5)
x = np.array([0, 2, 3, 10, 15])
y = np.array([0, 1, 2, 8, 15])
f = interp1d(x,y, kind='cubic')
@AlexEshoo
AlexEshoo / IEEE 754 Conversion Python
Last active January 16, 2024 15:22
IEEE 754 Conversion Python
Used for gist name.