Skip to content

Instantly share code, notes, and snippets.

Avatar

Ogi Moore j9ac9k

  • Sensory
  • Portland, OR
View GitHub Profile
@j9ac9k
j9ac9k / dvd_conversion.md
Last active Apr 17, 2019
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.
View dvd_conversion.md

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
...
@j9ac9k
j9ac9k / convert.py
Last active Apr 18, 2019
Python Script to Convert ITerm XML color config files to Putty color registry files
View convert.py
import xml.etree.ElementTree as ET
import sys
try:
input_file = sys.argv[1]
tree = ET.parse(input_file)
except:
raise 'Provide xml filename to convert'
root = tree.getroot()
@j9ac9k
j9ac9k / ffmpeg_examples.md
Created Jul 22, 2020
Short summary of ffmpeg usage
View ffmpeg_examples.md

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 Feb 19, 2021
WIP Post for Creating Native Installer PyQt application
View macOS_app_creation.md

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 / build_cSpell_dict.py
Created Apr 10, 2021
Generate word-lists from python modules, useful for spell checkers such as cSpell
View build_cSpell_dict.py
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 / gauss.py
Last active Jun 1, 2021
Gaussian Elimination in Python
View gauss.py
def gauss(A):
m = len(A)
assert all([len(row) == m + 1 for row in A[1:]]), "Matrix rows have non-uniform length"
n = m + 1
for k in range(m):
pivots = [abs(A[i][k]) for i in range(k, m)]
i_max = pivots.index(max(pivots)) + k
# Check for singular matrix