Skip to content

Instantly share code, notes, and snippets.

View tsgiannis's full-sized avatar

John Tsioumpris tsgiannis

View GitHub Profile
@tsgiannis
tsgiannis / split.py
Last active February 18, 2022 22:25
Split a code file into smaller ones ...e.g you have a python file that has multiple classes ..and for easier studying you want to split it.
matches = ["class", "(", ":"]
with open("sailor.py") as f:
lines = f.readlines()
currentclassname = ''
currentlines =[]
for line in lines :
if all(x in line for x in matches) : # we have found a class
classname = line.split(" ", 2)[1].split("(",1)[0]
print(classname)
currentclassname=classname
@tsgiannis
tsgiannis / tzoker_predictor.py
Last active February 21, 2022 20:49
Simple tzoker predictor
import random
from time import sleep
logo = """
_ _ _ _ _
| |_ _______ | | _____ _ __ _ __ _ __ ___ __| (_) ___| |_ ___ _ __
| __|_ / _ \| |/ / _ \ '__| | '_ \| '__/ _ \/ _` | |/ __| __/ _ \| '__|
| |_ / / (_) | < __/ | | |_) | | | __/ (_| | | (__| || (_) | |
\__/___\___/|_|\_\___|_| | .__/|_| \___|\__,_|_|\___|\__\___/|_|
|_|
@tsgiannis
tsgiannis / ibm_i.py
Created February 28, 2025 09:02
Simple script for connecting to AS/400 and retrieving table data
import pyodbc
import json
import os
# A script by John Tsioumpris
CREDENTIALS_FILE = "as400_credentials.json"
# Function to save credentials
def save_credentials(credentials):
@tsgiannis
tsgiannis / laps.ps1
Last active March 13, 2025 09:42
Easy Laps Password retriever
#### START ELEVATE TO ADMIN #####
param(
[Parameter(Mandatory=$false)]
[switch]$shouldAssumeToBeElevated,
[Parameter(Mandatory=$false)]
[String]$workingDirOverride
)
# If parameter is not set, we are propably in non-admin execution. We set it to the current working directory so that
@tsgiannis
tsgiannis / execute_elevated_ps.cmd
Created March 13, 2025 09:11
Execute a powershell script as administrator and set execution policy
@echo off
powershell -Command "Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File \"%~dp0Laps.ps1\"' -Verb RunAs"
@tsgiannis
tsgiannis / treeviewQt.py
Created April 2, 2025 10:32
ActiveX alike QT Treeview
import sys
import random
from PyQt6.QtWidgets import (QApplication, QDialog, QVBoxLayout, QHBoxLayout,
QTreeWidget, QTreeWidgetItem, QPushButton,
QAbstractItemView, QStyleFactory, QMenu,
QHeaderView, QSizePolicy)
from PyQt6.QtCore import Qt, QSize, QPointF
from PyQt6.QtGui import QBrush, QColor, QPixmap, QPainter, QPen, QIcon, QRadialGradient, QAction