Skip to content

Instantly share code, notes, and snippets.

View insertinterestingnamehere's full-sized avatar

Ian Henriksen insertinterestingnamehere

View GitHub Profile
@insertinterestingnamehere
insertinterestingnamehere / configurations.txt
Last active March 12, 2022 17:36
Different Possible Configurations of the MF8 Crazy Doderhombus
143 configurations other than all ones
Numbers correspond to the faces in this order:
white, pink, yellow, tan, green, light blue, light green, blue, orange, purple, gray, red
default: (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1)
(0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0)
(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
(0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0)
(0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1)
(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
(0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1)
# Copyright Ian Henriksen 2020
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
@insertinterestingnamehere
insertinterestingnamehere / arithmetic.cpp
Created April 7, 2016 23:45
Demonstrates a bug in MSVC 2015 Update 2
#include <map>
#include <memory>
#include <vector>
#include <limits>
#include <cstdint>
#include <iostream>
#include <atomic>
#include <sstream>
#include <algorithm>
#include <array>
#include <iostream>
#include <type_traits>
#include <typeinfo>
template <typename T, T... I>
struct integer_sequence {
enum { size = sizeof...(I) };
typedef T value_type;
};
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@insertinterestingnamehere
insertinterestingnamehere / mod.pxd
Created October 19, 2015 22:28
This shows how to wrap a C++ function in a capsule within Cython, how to call a function pointer wrapped in a capsule object, how to export that function as a part of the modules C API, and how to call that function from outside the module using ctypes.
cdef double cymul(double, double) nogil
@insertinterestingnamehere
insertinterestingnamehere / call_dgemm.py
Last active October 7, 2020 09:36
This shows how to use SciPy's Cython-exposure of the BLAS and LAPACK libraries from within ctypes.
import numpy as np
import ctypes as ct
from scipy.linalg import cython_blas
#ct.cdll.LoadLibrary("libopenblas.dll")
#openblas = ct.CDLL("libopenblas.dll")
#dgemm = openblas.dgemm
ct.pythonapi.PyCapsule_GetPointer.restype = ct.c_void_p
ct.pythonapi.PyCapsule_GetPointer.argtypes = [ct.py_object, ct.c_char_p]
@insertinterestingnamehere
insertinterestingnamehere / gist:ba7b72997e98626d672d
Created October 19, 2015 15:49
templated implicit conversion
#include <iostream>
#include <type_traits>
template <typename T>
struct forward_type {
typedef T type;
};
class myint {
public:
@insertinterestingnamehere
insertinterestingnamehere / enable_for.cpp
Created September 15, 2015 17:33
This shows how to enable a template for an explicit list of types.
#include <iostream>
#include <type_traits>
template<typename T, typename... UsableTypes>
struct SearchImpl : std::is_same<T, UsableTypes>...
{
};
template<typename T, typename... UsableTypes>
struct Search : std::is_base_of<std::true_type, SearchImpl<T, UsableTypes...>>::type
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /
c /IC:\Users\Owner\libdynd\thirdparty\datetime\include /IC:\Users\Owner\libdy
nd\include /IC:\Users\Owner\libdynd\thirdparty\utf8\source /IC:\Users\Owner\l
ibdynd\msvc_build\include /IC:\Users\Owner\libdynd\tests\..\thirdparty /IC:\U
sers\Owner\libdynd\tests\. /W3 /WX /O2 /Ob2 /D WIN32 /D _WINDOWS /D _VARIADIC
_MAX=10 /D NDEBUG /D "CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /EHsc /MD /GS /
fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"test_libdynd.dir\Relea
se\\" /Fd"test_libdynd.dir\Release\vc140.pdb" /Gd /TP /wd4503 /errorReport:qu
eue -bigobj C:\Users\Owner\libdynd\tests\pp\test_pp_arithmetic.cpp C:\Users\