Skip to content

Instantly share code, notes, and snippets.

@tyhenry
tyhenry / git-refs.sh
Created Aug 2, 2022
git refs command - list all refs (local / remote branches with last commit info)
View git-refs.sh
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 Jan 30, 2022
ofxVimba sample
View ofApp.cpp
#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 Dec 9, 2021
Convert 1password export file (.1pux archive -> export.data) to CSV format
View 1pux2csv.py
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 Nov 22, 2021
javascript deep clone
View clone.mjs
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;
};
View fix_node_env_git_bash.sh
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
@tyhenry
tyhenry / component.hpp
Last active Nov 7, 2020 — 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
View component.hpp
// 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 Dec 4, 2020
list ofxAddons for OF project, with git repo / version info > 'addons.git.make'
View list-of-addons-git.sh
#!/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
@tyhenry
tyhenry / dof.bokeh.2.4.frag
Created Sep 25, 2020
depth of field bokeh 2.4 shader by Martins Upitis
View dof.bokeh.2.4.frag
#version 330
/*
DoF with bokeh GLSL shader v2.4
by Martins Upitis (martinsh) (devlog-martinsh.blogspot.com)
----------------------
The shader is Blender Game Engine ready, but it should be quite simple to adapt for your engine.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
So you are free to share, modify and adapt it for your needs, and even use it for commercial use.
@tyhenry
tyhenry / raii.cpp
Last active Feb 5, 2020
RAII - auto-cleanup based on object lifetime
View raii.cpp
#include <iostream>
#include "raii.h"
int main() {
int value = 0;
std::cout << value << std::endl;
// scope_guard c'tor arg is run on scope_guard destruction
raii::scope_guard g(
[&](){
View vv_extrudeFont.cpp
#include "vv_extrudeFont.h"
//--------------------------------------------------------------
// Original credits go to jefftimeisten, see https://forum.openframeworks.cc/t/extrude-text-into-3d/6938
//
// This method returns a vector containing the vbo meshes required
// to render the front, back and sides of each character in the given string.
//
// @example:
//