Skip to content

Instantly share code, notes, and snippets.

View 2bbb's full-sized avatar

2bit 2bbb

View GitHub Profile
@2bbb
2bbb / Brewfile
Created June 3, 2022 17:11
homebrew
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
# build tools
brew "autoconf"
brew "automake"
brew "ccache"
brew "cmake"
brew "coreutils"
@2bbb
2bbb / list-of-addons-git.sh
Created December 4, 2020 06:51 — forked from tyhenry/list-of-addons-git.sh
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
@2bbb
2bbb / ofxAVFoundationVideoPlayerUtils.h
Last active May 6, 2020 07:14
ofxAVFoundationVideoPlayerUtils
//
// ofxAVFoundationVideoPlayerUtils.hpp
//
// Created by 2bit on 2020/05/03.
//
#ifndef ofxAVFoundationVideoPlayerUtils_hpp
#define ofxAVFoundationVideoPlayerUtils_hpp
#include "ofVideoPlayer.h"
@2bbb
2bbb / hash_from_file.js
Last active June 2, 2019 19:49
calculate hash from file stream
const fs = require('fs');
const crypto = require('crypto');
const hash_from_file = (file, algorithm = 'sha256') => new Promise((resolve, reject) => {
try {
const stat = fs.statSync(file);
const hash = crypto
.createHash(algorithm)
.setEncoding('hex');
fs
@2bbb
2bbb / ver.cpp
Created April 18, 2019 16:05 — forked from yohhoy/ver.cpp
compiler version snippet
#if defined(__clang__)
#pragma message "Clang " __VERSION__
#elif defined(__GNUC__)
#pragma message "GCC " __VERSION__
#elif defined(_MSC_VER)
// https://qiita.com/yumetodo/items/8c112fca0a8e6b47072d
#define STR(s) #s
#define DUMP(s) #s "=" STR(s)
#pragma message ("MSVC " DUMP(_MSC_VER) " " DUMP(_MSC_FULL_VER))
#endif
@2bbb
2bbb / alt_float_cpp11.hpp
Last active March 27, 2019 15:38
alt_float c++11
// original code (with C++14) by kazatsuyu (https://github.com/kazatsuyu)
// CC0 https://creativecommons.org/publicdomain/zero/1.0/deed.en
/*
CC0 1.0 Universal (CC0 1.0)
Public Domain Dedication
No Copyright
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. See Other Information below.
@2bbb
2bbb / promise.cpp
Created March 20, 2018 06:49
promise-js.cpp
#include <cstddef>
#include <cstdint>
#include <type_traits>
namespace bbb {
namespace {
template <bool b, typename type>
using enable_if_t = typename std::enable_if<b, type>::type;
template <bool b, typename t, typename f>
using conditional_t = typename std::conditional<b, t, f>::type;
@2bbb
2bbb / string_utils.cpp
Last active March 18, 2018 07:14
string_utils
#include <string>
#include <sstream>
#include <cstdio>
#include <type_traits>
#include <cstddef>
#include <iostream>
namespace bbb {
inline namespace string_utils {
@2bbb
2bbb / polyfunction.cpp
Last active March 8, 2018 19:25
polyfunction
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <functional>
namespace bbb {
namespace {
template <bool b, typename type>
using enable_if_t = typename std::enable_if<b, type>::type;
};
@2bbb
2bbb / infix_op.cpp
Last active February 24, 2018 07:00
infix_op
#include <utility>
namespace bbb {
namespace infix_op {
template <typename function_type>
struct infix_op {
inline infix_op() : f() {};
template <typename ... arguments>
inline infix_op(arguments ... args) : f(std::forward<arguments>(args) ...) {};