Skip to content

Instantly share code, notes, and snippets.

tyhenry /
Created Dec 9, 2021
Convert 1password export file (.1pux archive -> 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 / 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;
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
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:
// Code :
Copyright 2013 Adobe Systems Incorporated
Distributed under the MIT License (see license at
This file is intended as example code and is not production quality.
tyhenry /
Last active Dec 4, 2020
list ofxAddons for OF project, with git repo / version info > 'addons.git.make'
# 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 / 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) (
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 / 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
// 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:
tyhenry / Any.h
Created Dec 18, 2019
C++ "dictionary" - mixed-type map
View Any.h
// C++11 "any" class for multi-type storage
// (better to use C++17 std::any or std::variant)
class AnyBase
virtual ~AnyBase() = 0;
inline AnyBase::~AnyBase() {}
tyhenry / derplet_vs2017.vssettings
Last active Mar 5, 2020
"Derplet" VS2017 color scheme + keyboard settings
View derplet_vs2017.vssettings
<UserSettings><ApplicationIdentity version="15.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"/></ToolsOptions><Category name="Environment_Group" RegisteredName="Environment_Group"><Category name="Environment_KeyBindings" Category="{F09035F1-80D2-4312-8EC4-4D354A4BCB4C}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_KeyBindings" PackageName="Visual Studio Environment Package"><Version></Version><KeyboardShortcuts><ScopeDefinitions><Scope Name="Team Explorer" ID="{7AA20502-9463-47B7-BF43-341BAF51157C}"/><Scope Name="VC Dialog Editor" ID="{543E0C02-8C85-4E43-933A-5EF320E3431F}"/><Scope Name="Find All References Tool Window" ID="{1FA1FD06-3592-4D1D-AC75-0B953320140C}"/><Scope Name="XML (Text) Editor" ID="{FA3CD31E-987B-443A-9B81-186104E8DAC1}"/><Scope Name="Text Editor" ID="{8B382828-6202-11D1-8870-0000F87579D2}"/><Scope Name="Work Item Results View" ID="{7026002D-01F6-44E7-95CF-A896C00DA3F8}"/><Scope Name="Solution Explorer" ID="{3AE