Skip to content

Instantly share code, notes, and snippets.

View zachgates's full-sized avatar

Zach Gates zachgates

View GitHub Profile
@zachgates
zachgates / p3d_stats.py
Last active December 31, 2020 06:04
A manager for pstats using Panda3D
#!/usr/local/bin/python3.9
__all__ = ['PStatTree']
import contextlib
import functools
from panda3d.core import PStatCollector
import ctypes
import os
import platform
from typing import Optional, Union
from panda3d import core as p3d
from direct.directnotify import DirectNotifyGlobal
import numpy as np
import matplotlib.pylab as plt
from PIL import Image
PATH = input('Path to tilesheet: ')
TILESHEET = Image.open(PATH)
TILESHEET_DATA = np.array(TILESHEET)
TILESHEET_INFO = (16, 32, 1) # tile size, run, and offset
@zachgates
zachgates / print_progress.py
Last active July 29, 2018 08:56 — forked from Kerruba/text-progress-bar-in-console.py
Function for displaying code progress
# -*- coding: utf-8 -*-
import sys
def print_progress(stage, total, prefix='', suffix='', decimals=1, bar_length=100):
"""
Call in a loop to create terminal progress bar
@params:
stage - Required : current stage (Int)
total - Required : total stages (Int)
@zachgates
zachgates / DataTree.py
Created July 27, 2018 08:47
A PyQt5 Widget for editing JSON data
import ast
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QAbstractItemView, QTreeWidget, QTreeWidgetItem
from PyQt5.QtWidgets import QMenu
class DataTreeItem(QTreeWidgetItem):