Skip to content

Instantly share code, notes, and snippets.

@UnaNancyOwen
UnaNancyOwen / k4a_double_exponential_filter.h
Last active July 12, 2023 10:17
Double Exponential Smoothing Filter for Azure Kinect Body Tracking SDK
/*
k4a_double_exponential_filter.h
This file contains holt double exponential smoothing filter for filtering joints.
It was ported for Azure Kinect Body Tracking SDK based on following implementation.
https://social.msdn.microsoft.com/Forums/en-US/045b058a-ae3a-4d01-beb6-b756631b4b42
std::unordered_map<int32_t, double_exponential_filter> double_exponential_filter;
while( true )
@kylemcdonald
kylemcdonald / main.cpp
Last active June 20, 2022 01:05
Depth in shader using openFrameworks.
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofShader shader;
ofEasyCam cam;
ofFbo fbo;
void setup() {
ofBackground(0);
ofFbo::Settings s;
@abrhm
abrhm / raii_value.cpp
Created March 12, 2018 09:37
RAII value
#include <iostream>
#include <type_traits>
template<typename T, class Deleter>
class raii_value
{
public:
static_assert(std::is_fundamental<T>::value, "raii_value must hold a fundamental type");
@revotu
revotu / remove_attrs.py
Last active January 27, 2024 06:48
remove all HTML attributes with BeautifulSoup except some tags(<a> <img>...)
from bs4 import BeautifulSoup
# remove all attributes
def _remove_all_attrs(soup):
for tag in soup.find_all(True):
tag.attrs = {}
return soup
# remove all attributes except some tags
def _remove_all_attrs_except(soup):
@jpierson
jpierson / switch-local-git-repo-to-fork.md
Last active December 26, 2022 21:48 — forked from jagregory/gist:710671
How to move to a fork after cloning

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step)

    git clone git@github...some-repo.git
@keithweaver
keithweaver / create-folder.py
Created March 10, 2017 03:42
Create a folder with Python
import os
def createFolder(directory):
try:
if not os.path.exists(directory):
os.makedirs(directory)
except OSError:
print ('Error: Creating directory. ' + directory)
@martinmoene
martinmoene / value-semantics-sean-parent.cpp
Created August 18, 2015 15:07
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.
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Math.md
Last active February 4, 2024 20:51
GLSL Math functions

Trigonometry

const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;

float PHI = (1.0+sqrtf(5.0))/2.0;
@roundand
roundand / OpenWithSublimeText3.bat
Last active March 13, 2024 17:38 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@mantissa
mantissa / instanced.frag
Last active August 9, 2018 02:51
Demonstrates how to use perform rotations on instances drawn with ofVBOMesh::drawInstances(). Also uses per pixel lighting and color.
#version 120
#extension GL_EXT_gpu_shader4 : require
varying vec3 vertex_light_position;
varying vec3 vertex_normal;
void main(){
// calculate the shading based on the normal
float diffuse_value = max(dot(vertex_normal, vertex_light_position), 0.0);