Skip to content

Instantly share code, notes, and snippets.

View NiklasRosenstein's full-sized avatar
💭
I may be slow to respond.

Niklas Rosenstein NiklasRosenstein

💭
I may be slow to respond.
View GitHub Profile
# Copyright (c) 2017 Niklas Rosenstein
#
# 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:
#
# The above copyright notice and this permission notice shall be included in
@NiklasRosenstein
NiklasRosenstein / complex.frag
Last active March 28, 2019 16:56
Functions for complex numbers in GLSL. https://www.shadertoy.com/
vec2 cmpxcjg(in vec2 c) {
return vec2(c.x, -c.y);
}
vec2 cmpxmul(in vec2 a, in vec2 b) {
return vec2(a.x * b.x - a.y * b.y, a.y * b.x + a.x * b.y);
}
vec2 cmpxpow(in vec2 c, int p) {
for (int i = 0; i < p; ++i) {
#!/usr/local/bin/nodepy
choices = {
'S': range(1, 10),
'L': range(1, 5),
'V': range(1, 5),
'H': range(1, 4),
'R': range(1, 4),
'E': range(1, 4),
'C': range(1, 9),
import c4d
def calc_line_plane_intersection(o, d, a, n):
"""
Calculates the intersection of the line described by *o* and *d*
with the plane described by *a* and *n*.
"""
dot = d.Dot(n)
if abs(dot) < 1.0e-7: return None # parallel to plane
@NiklasRosenstein
NiklasRosenstein / extract-c4d-sdk.py
Last active June 22, 2019 16:55
Extract all files of the Cinema 4D SDK into a separate directory.
# Extract the Cinema 4D SDK from a Cinema 4D installation.
# Copyright (C) 2016 Niklas Rosenstein
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
CONTAINER OoffsetYSpline {
INCLUDE Obase;
GROUP ID_OBJECTPROPERTIES {
REAL PY_OFFSETYSPLINE_OFFSET { UNIT METER; }
}
}
@NiklasRosenstein
NiklasRosenstein / require.b64-79.py
Last active October 8, 2016 09:54
Blobs for py-require v0.17
# py-require-0.17-b64-79
import base64 as b, types as t, zlib as z; m=t.ModuleType('require'); blob=b'\
eJytGU1v7Lbxvr9CdQ6SnlXZTg4FnCgIGrwCOfQ9oH23xULQailbsSSqpPS8RtD/3pnhkCK1WhdBctn\
lx3A43x9UWVbz9CxVWRbxp/alq3T0L6nFoCfRDtEPyo0H2kyqKX3qq7bLa9n/GO/K8qtQupUDnr/PH/\
4W79p+lGqKhFKDtJN2EmqSstN2oa+Ufq46O5VuY5S6PY/V9GwXprdRuF39pncn0USDVD0CJef0cRcpM\
c1qACQ5ruVu0y5UR83A6a4GJoBF8Z+5VeKjUlIlvxBuGiO2EQBCsH/K09yJn+UwifOUyOOvop4QEikp\
y3Zop7JMtOiaDK/JlOhkdcrqStfVSWTtMHZVLewc4E/iDJBKDIQlwpNEaNG1ekpwlNplg6swf3aRMRX\
8H7VNZAAi0WkR/aOCXwvLtxf8/y5sQGERzBYykezC/O2in0YlR1DtmxEGkl5WXUfCIN6U0HM3FfsDjF\
+f204QGtzhrbwaRzGcEicEZJ2ACu9CwkRKdpaU189VOyQfDJqVYhOymtwo7guMkRiBGi581V9TYZGk2\
auCq8rj2yRqCbL+JAeRlS9CjMBg+9Uu6KmqX05ihDP3RpkzyCPhSzKSQ+4uiJVZj51+CX9VP4tSz03T\
@NiklasRosenstein
NiklasRosenstein / atom-update-links.py
Last active August 9, 2016 10:07
This script creates symlinks for the ATOM configuration files into your ownCloud/Dropbox/Box/OneDrive/GoogleDrive folder.
@NiklasRosenstein
NiklasRosenstein / c4d_IntegrateSplineData.py
Last active November 14, 2017 19:06
Adaptive method for approximating the integral of a c4d.SplineData (i.e. the area "under" the spline).
# Copyright (c) 2016 Niklas Rosenstein
#
# 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:
#
# The above copyright notice and this permission notice shall be included in
@NiklasRosenstein
NiklasRosenstein / old-beak-build.py
Created July 9, 2016 17:52
LOL, this is what Craftr could've been. Luckily it's not. https://github.com/craftr-build/craftr
# Copyright (c) 2014, Niklas Rosenstein
#
# 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:
#
# The above copyright notice and this permission notice shall be included in