Skip to content

Instantly share code, notes, and snippets.

Christopher Crouzet christophercrouzet

Block or report user

Report or block christophercrouzet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@christophercrouzet
christophercrouzet / countargs.h
Created Sep 14, 2019
Counting Variadic Macro Arguments in C99 and C++
View countargs.h
/*
Credits: Jens Gustedt
https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments
*/
#include <stdio.h>
#define EXPAND(x) x
#define CONCAT_(a, b) a##b
@christophercrouzet
christophercrouzet / mayabake.py
Created Dec 24, 2016
Quick and dirty prototype of a naive animation bake implementation for Autodesk Maya.
View mayabake.py
#!/usr/bin/env mayapy
import itertools
import math
import random
import timeit
from maya import cmds, OpenMaya, OpenMayaAnim
@christophercrouzet
christophercrouzet / google_foobar-3_1_find_the_access_codes.py
Last active Oct 1, 2017
Failed attempt at the exercise level 3.1 “Find the Access Codes“ from Google's Foobar challenge.
View google_foobar-3_1_find_the_access_codes.py
#!/usr/bin/env python2.7
"""Find the Access Codes
In order to destroy Commander Lambda's LAMBCHOP doomsday device, you'll need
access to it. But the only door leading to the LAMBCHOP chamber is secured with
a unique lock system whose number of passcodes changes daily. Commander Lambda
gets a report every day that includes the locks' access codes, but only she
knows how to figure out which of several lists contains the access codes. You
need to find a way to determine which list contains the access codes once
@christophercrouzet
christophercrouzet / mayaskin.py
Last active Jan 18, 2017
Quick and dirty Maya skin load/save
View mayaskin.py
# Relies on https://github.com/christophercrouzet/banana.maya
import collections
import json
from maya import OpenMaya, OpenMayaAnim, cmds
import banana.maya
banana.maya.patch()
@christophercrouzet
christophercrouzet / multiprocessing.py
Created Aug 24, 2016
Python's asynchronous queues vs synchronous pipes.
View multiprocessing.py
#!/usr/bin/env python3
import logging
import multiprocessing
_LOGGER = multiprocessing.log_to_stderr()
_LOGGER.setLevel(logging.DEBUG)
@christophercrouzet
christophercrouzet / incrementindices.h
Created Apr 26, 2015
Compile-time multidimensional indices incrementer
View incrementindices.h
#ifndef INCREMENTINDICES_H
#define INCREMENTINDICES_H
#include <cstddef>
#include <type_traits>
#include <m3ta/at>
#include <m3ta/concatenate>
#include <m3ta/integersequence>
#include <m3ta/popback>
@christophercrouzet
christophercrouzet / strides.h
Last active Aug 29, 2015
Compute the strides of a n-dimensional array either at compile or run time.
View strides.h
#ifndef STRIDES_H
#define STRIDES_H
#include <cstddef>
#include <m3ta/concatenateintegersequences>
#include <m3ta/integersequence>
#include <m3ta/reverseintegersequence>
@christophercrouzet
christophercrouzet / multidimensionalarray.h
Last active Nov 30, 2018
Nested initializer lists for multidimensional arrays in C++11.
View multidimensionalarray.h
#ifndef MULTIDIMENSIONALARRAY_H
#define MULTIDIMENSIONALARRAY_H
#include <array>
#include <cstddef>
#include <type_traits>
// https://github.com/christophercrouzet/m3ta
#include <m3ta/nestedinitializerlists>
#include <m3ta/pass>
@christophercrouzet
christophercrouzet / gist:b3e4567c4fd3a9fe9b8c
Last active Aug 29, 2015
Check if a function that can be called with a specific set of arguments exists.
View gist:b3e4567c4fd3a9fe9b8c
#include <iomanip>
#include <iostream>
#include <string>
#include <type_traits>
#include <utility>
template<typename T>
struct Functions;
@christophercrouzet
christophercrouzet / distance.h
Last active Aug 29, 2015
Compute the distance in ulps between floating-point numbers in C++11.
View distance.h
#ifndef DISTANCE_H
#define DISTANCE_H
#include <algorithm>
#include <cassert>
#include <cmath>
#include <limits>
#include "floatingpointtraits.h"
You can’t perform that action at this time.