Skip to content

Instantly share code, notes, and snippets.

View j9ac9k's full-sized avatar

Ogi Moore j9ac9k

View GitHub Profile
@j9ac9k
j9ac9k / day13.py
Created December 13, 2022 18:08
Aoc 2022 Day 13 Solution
import itertools
import functools
def compare(a, b):
if isinstance(a, int) and isinstance(b, int):
if a < b:
return True
elif a > b:
return False
else:
@j9ac9k
j9ac9k / benchmark_drawPoints.py
Last active June 9, 2022 04:29
benchmark drawPoints vs. drawPointsNp
from PySide6 import QtCore, QtGui
import shiboken6
import numpy as np
from time import perf_counter
class Points:
def __init__(self, use_drawNp):
self.use_drawNp = use_drawNp
self.alloc(0)
@j9ac9k
j9ac9k / reference_count.py
Created December 13, 2021 21:36
lambda python reference count
from pyqtgraph.Qt import QtWidgets
import weakref
import gc
class MyButton(QtWidgets.QPushButton):
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
self.clicked.connect(lambda : self.hello())
# self.clicked.connect(lambda: QtWidgets.QApplication.instance().exit())
# self.clicked.connect(self.hello)
@j9ac9k
j9ac9k / build_cSpell_dict.py
Created April 10, 2021 21:42
Generate word-lists from python modules, useful for spell checkers such as cSpell
import argparse
import importlib
import inspect
from collections import deque
from typing import Any, List, Set, Tuple
def get_nested_members(module, predicate=None) -> List[Tuple[str, Any]]:
return [
module_info
for module_info in inspect.getmembers(module, predicate=predicate)
@j9ac9k
j9ac9k / ffmpeg_examples.md
Created July 22, 2020 18:12
Short summary of ffmpeg usage

FFmpeg Walkthrough

basics

ffmpeg is a command line utility that presents a API to interacting with a variety of media types/encodings in a uniform fashion.

Depending on the ffmpeg distribiont, you may get access to utilities such as ffprobe (which provides information on a file) and ffplay (will play back a file). Those tools are critical.

Those tools, by default, will show all the arguments that ffmpeg was compiled with, which can get a little verbose. If you're going to run many ffmpeg commands, I suggest you get used to passing the -hide_banner argument.

@j9ac9k
j9ac9k / macOS_app_creation.md
Last active September 8, 2022 17:20
WIP Post for Creating Native Installer PyQt application

Building a PyQt5/PySide2 macOS Application

Preface

As part of my professional duties, I have been tasked with developing a desktop application to analyze audio files. This desktop application would need to be work across platforms (Windows, macOS and Ubuntu), and I cannot rely on dependencies having already been installed (such as Python itself). Naturally I turned to Qt (and more specifically, Qt for Python) due to its capabilities for creating GUI applications that work across OSs. As I could not be dependent on the end user having Python installed (so no deploying a wheel and calling it good), I decided it may be worth trying to make native installers (deb packages for linux, .app bundles and .dmg files for macOS, and setup.exe files for Windows).

In short, here were the objectives I aimed to have

  • Cross-Platform compatible GUI application
  • Deployment to users via native installers (no assumption of python being on the target machine)
@j9ac9k
j9ac9k / IR_reddit.ipynb
Created September 5, 2018 21:58
Homework Submission For Distributed Computing Class
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@j9ac9k
j9ac9k / dvd_conversion.md
Last active April 17, 2019 08:05
notes for converting some DVDs to a modern file format; including cropping of the letterbox, converting bitmap subtitles to text based, and visually lossless encoding.

FFMpeg DVD Conversion

To get crop geometry:

ffmpeg -i input.mkv -vf cropdetect=24:16:0 dummy.mkv
...
[Parsed_cropdetect_0 @ 0x3704360] x1:0 x2:639 y1:43 y2:317 w:640 h:272 x:0 y:46 pts:181320 t:181.320000 crop=640:272:0:46
...
tap 'homebrew/fuse'
tap 'homebrew/dupes'
tap 'homebrew/cask'
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
tap 'homebrew/cask-drivers'
cask_args appdir: '/Applications'
brew 'ack'