Skip to content

Instantly share code, notes, and snippets.

View ColinKennedy's full-sized avatar
🏠
Working from home

Colin Kennedy ColinKennedy

🏠
Working from home
View GitHub Profile
@ColinKennedy
ColinKennedy / README.md
Created April 25, 2024 06:48 — forked from runiq/README.md
Neovim throttle & debounce

What are these?

Functions that allow you to call a function not more than once in a given timeframe.

Throttling on the leading edge

This can be illustrated with timing diagrams. In the following diagrams, f designates call to the throttled function, t is the period where the timer is running, and x shows you the actual execution point of the throttled function.

f 1  2  3  4  5  6
@ColinKennedy
ColinKennedy / example.usda
Last active April 19, 2023 02:08
A USD file with as much syntax details as possible
#usda 1.0
(
doc = """This is a docstring"""
subLayers = [ # This is an in-line comment
@./external_path.usda@,
@/absolute/path.usda@,
@uri:blah?extension=.usda:.usd:.usdc&meta=data@
]
)
@ColinKennedy
ColinKennedy / converter.h
Created September 22, 2022 06:07 — forked from wayhoww/converter.h
Boost.Python: Automatical Type Conversion
/**
* For Boost.Python
*
* Automatically convert between Python list, dict, tuple and C++ STL std::vector, std::map, std::tuple, respectively.
* --------------------------------------
* 自动转换 Python 和 STL 的几个常用数据类型。
*
* I am familiar with neither metaprogramming nor Boost.Python. This header works but I believe
* there are better ways (or even existing libraries) to do these conversions. Please comment at
* this page to help me improve it.
@ColinKennedy
ColinKennedy / pyPair.h
Created September 16, 2022 06:33
A somewhat oversimplified explanation on how to expose std::vector<std::pair<std::string, std::string>> to Boost.Python
#pragma once
/// Reference: https://github.com/snoyer/tictactoebot/blob/64b1e06937147e3e54ce4dcc465b7f76e1889ec6/opencv/pythonhelpers.h
#include <boost/python.hpp>
namespace py = boost::python;
template<typename T1, typename T2>
@ColinKennedy
ColinKennedy / thesaurus.vim
Created January 6, 2019 16:27
Use the 'Ron89/thesaurus_query.vim' GitHub Vim plugin and an active spellfile to make Vim's thesaurus feature actually useful
" Copied from thesaurus_query.vim. Otherwise, the `thesaurus_query` module may not be directly importable.
"
" Reference: https://github.com/Ron89/thesaurus_query.vim/blob/master/autoload/thesaurus_query.vim#L205-L214
"
pythonx << EOF
# IMPORT STANDARD LIBRARIES
import sys
import os
# IMPORT THIRD-PARTY LIBRARIES