Skip to content

Instantly share code, notes, and snippets.

bl_info = {
"name": "Sequence Switcher",
"author": "Campbell Barton",
"version": (1, 0),
"blender": (2, 6, 4),
"location": "Sequencer Header",
"description": "Switches finals with current renders",
"warning": "",
"wiki_url": "",
"tracker_url": "",
/* varargs macros (keep first so others can use) */
/* --- internal helpers --- */
#define _VA_NARGS_GLUE(x, y) x y
#define _VA_NARGS_RETURN_COUNT(\
_1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, _10_, _11_, _12_, _13_, _14_, _15_, _16_, \
_17_, _18_, _19_, _20_, _21_, _22_, _23_, _24_, _25_, _26_, _27_, _28_, _29_, _30_, _31_, _32_, \
_33_, _34_, _35_, _36_, _37_, _38_, _39_, _40_, _41_, _42_, _43_, _44_, _45_, _46_, _47_, _48_, \
_49_, _50_, _51_, _52_, _53_, _54_, _55_, _56_, _57_, _58_, _59_, _60_, _61_, _62_, _63_, _64_, \
count, ...) count
#define _VA_NARGS_EXPAND(args) _VA_NARGS_RETURN_COUNT args
data = tuple(range(500000))
N = 3
import struct
import time
print("Iter pack:\n----\n")
for i in range(N):
t = time.time()
v = b''.join(struct.pack('d', elem) for elem in data)
print("> ", time.time() - t)
@ideasman42
ideasman42 / linked_list_sort.c
Created May 23, 2015 06:10
Mergesort single linked list (improvements from SE answer)
/* Originally from: http://stackoverflow.com/a/27663998/432509
*
* With following modifications:
* - Use a pointer to the tail (remove 2x conditional checks, reduces code-size).
* - Avoid re-assigning empty values the size doesn't change.
* - Corrected comments.
*/
static void *listbase_sort_impl(struct Link *head, int (*cmp)(const void *, const void *))
{
/*
* ***** BEGIN MIT LICENSE BLOCK *****
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
/*
* Example of how preprocessor can be used to ensure unique args.
* (by checking their identifiers).
*
* See: http://stackoverflow.com/questions/31631862
*
* ... and yes, this is ridiculous! (more a testcase to see if its even possible).
*/
/* -------------------------------------------------------------------- */
Module(
body=[
Import(
names=[
alias(
name='ast',
asname=None,
),
],
),
def sandbox_code(code):
import numba
from types import FunctionType
fn = FunctionType(code, {}, "fn", ())
fn_jit = numba.jit(fn, nopython=True)
a = fn_jit._compile_for_args()
import IPython; IPython.embed()
return fn_jit.__code__
def safe_eval(expr):
diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp
index 979376f..b31715d 100644
--- a/toonz/sources/common/tapptools/tenv.cpp
+++ b/toonz/sources/common/tapptools/tenv.cpp
@@ -5,8 +5,8 @@
#include "tconvert.h"
#include "tfilepath_io.h"
+#include <QDir>
#include <QSettings>
@ideasman42
ideasman42 / test_static_libs.diff
Created March 31, 2016 06:18
Static libs test (no need for LD_PRELOAD ...)
diff --git a/toonz/sources/colorfx/CMakeLists.txt b/toonz/sources/colorfx/CMakeLists.txt
index 037eb6f..278252a 100644
--- a/toonz/sources/colorfx/CMakeLists.txt
+++ b/toonz/sources/colorfx/CMakeLists.txt
@@ -16,7 +16,7 @@ set(SOURCES
add_translation(colorfx ${HEADERS} ${SOURCES})
-add_library(colorfx SHARED ${HEADERS} ${SOURCES})
+add_library(colorfx STATIC ${HEADERS} ${SOURCES})