Skip to content

Instantly share code, notes, and snippets.

@tyhenry
tyhenry / stitch_pngs.sh
Created March 21, 2024 15:54
Stich PNGs in directories to MP4
#!/bin/bash
mindepth=0
maxdepth=0
original_dir=$(pwd)
print_help() {
echo "Usage: $0 [OPTION]..."
echo "Create videos from PNG files in directories."
echo
@tyhenry
tyhenry / mp4info.js
Created January 23, 2024 22:54
Get metadata on MP4 video using mp4box.js
import * as MP4Box from 'mp4box';
// returns a Promise that resolves to video metadata using MP4Box.js
export const getMp4Info = async (videoBlob) => {
const mp4boxfile = MP4Box.createFile();
return new Promise((resolve, reject) => {
mp4boxfile.onReady = function (info) {
resolve(info);
};
mp4boxfile.onError = function (e) {
@tyhenry
tyhenry / replace_transparent_pixels.py
Created August 29, 2023 20:57
python script to help fix the RGB values of transparent pixels in images
#!/usr/bin/env python
# pip install Pillow
from PIL import Image
def replace_transparent_pixels(base_image_path, replacement_image_path, output_image_path):
base_image = Image.open(base_image_path)
replacement_image = Image.open(replacement_image_path)
base_image = base_image.convert("RGBA")
@tyhenry
tyhenry / git-refs.sh
Created August 2, 2022 13:47
git refs command - list all refs (local / remote branches with last commit info)
git config --global alias.refs "for-each-ref refs/ --sort=committerdate --format='%(color:red)%(committerdate:short) %(color:yellow)%(objectname:short) %(align:25,left)%(color:cyan)%(refname:short)%(end) %(color:magenta)%(subject) %(color:green)%(authorname)'"
@tyhenry
tyhenry / ofApp.cpp
Created January 30, 2022 15:33
ofxVimba sample
#include "ofApp.h"
using namespace cv;
using namespace ofxCv;
using namespace ofxVimba;
#define PAUSE_EXIT_FAILURE cout << "press any key to quit" << endl; std::cin.get(); ofExit(EXIT_FAILURE);
//--------------------------------------------------------------
void ofApp::setup(){
@tyhenry
tyhenry / 1pux2csv.py
Created December 9, 2021 17:10
Convert 1password export file (.1pux archive -> export.data) to CSV format
import csv
import json
import os
def convert(file_in, dir_out=""):
with open(file_in, 'r', encoding='utf8') as json_file:
data = json.load(json_file)
for account in data["accounts"]:
print(f"Processing account: {account['attrs']['name']}")
for vault in account["vaults"]:
@tyhenry
tyhenry / clone.mjs
Created November 22, 2021 19:20
javascript deep clone
const clone = (objIn) => {
if (objIn === null || typeof (objIn) !== 'object') {
return objIn; // must be object to clone, otherwise we return value
}
const objOut = Array.isArray(objIn) ? [] : {};
Object.keys(objIn).forEach((key) => {
objOut[key] = clone(objIn[key]);
});
return objOut;
};
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
@tyhenry
tyhenry / component.hpp
Last active November 7, 2020 00:39 — forked from martinmoene/value-semantics-sean-parent.cpp
Code from talk: Inheritance Is The Base Class of Evil by Sean Parent at Going Native 2013
// Sean Parent. Inheritance Is The Base Class of Evil. Going Native 2013
// Video: https://www.youtube.com/watch?v=bIhUE5uUFOA
// Code : https://github.com/sean-parent/sean-parent.github.io/wiki/Papers-and-Presentations
/*
Copyright 2013 Adobe Systems Incorporated
Distributed under the MIT License (see license at
http://stlab.adobe.com/licenses.html)
This file is intended as example code and is not production quality.
@tyhenry
tyhenry / list-of-addons-git.sh
Last active December 4, 2020 06:51
list ofxAddons for OF project, with git repo / version info > 'addons.git.make'
#!/bin/bash
# list-of-addons-git.sh
#
# to be run inside of an openFrameworks project with 'addons.make' file.
# writes 'addons.git.make' - list addons and git repo urls, branches, and commits to 'addons.git.make' file
INPUT="addons.make" # addons list file
OUTPUT="addons.git.make" # output file