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 / 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
@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) {
@NiklasRosenstein
NiklasRosenstein / c4d_pluginid_exporter.py
Last active February 27, 2019 10:58
This script exports a list of all installed plugins to a text file. The first token in each line is the plugin ID where the rest of the line is the name of the plugin.
# Copyright (C) 2015 Niklas Rosenstein
# All rights reserved.
#
# File: c4d_pluginid_exporter.py
# Created: 2015-11-18
# Last Modified: 2015-11-18
# Description: This script exports a list of all installed plugins
# to a text file. The first token in each line is the plugin ID
# where the rest of the line is the name of the plugin.

Downgrade Windows 10

https://www.youtube.com/watch?v=VTjLd57QgDY

In the following RegEdit keys

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
  • HKEY_LOCAL_MACHINE\WOW6432Node\SOFTWARE\Microsoft\Windows NT\CurrentVersion

Edit the following values:

@NiklasRosenstein
NiklasRosenstein / iconbutton.py
Last active January 22, 2019 17:02
IconButton class for the Python Cinema 4D API.
# Copyright (C) 2013, Niklas Rosenstein
# http://niklasrosenstein.de/
#
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
#
# Changelog:
#
# 1.1: Corrected action msg for Command() method, information like qualifiers
@NiklasRosenstein
NiklasRosenstein / github-watch-all.py
Created June 19, 2018 12:40
Watch all repositories that you have read/write/admin access to.
import requests
API = 'https://api.github.com'
session = requests.Session()
session.auth = ('YourUsername', 'YourPassword')
def repos():
page = 0
while True:
@NiklasRosenstein
NiklasRosenstein / c4dpytask-2.py
Last active April 13, 2018 13:47
#c4dpytask #medium How can you load a texture and assign it to a plane with image dimensions? (you need a LoadDialog, BaseBitmap and Oplane)
# @rosensteinn #c4dpytask #medium How can you load a texture and assign
# it to a plane with image dimensions? (you need a LoadDialog, BaseBitmap
# and Oplane)
import c4d
def main():
# Poll the user for a filename. We specify that the file-type may be
# an image only.
filename = c4d.storage.LoadDialog(c4d.FILESELECTTYPE_IMAGES)
@NiklasRosenstein
NiklasRosenstein / c4d_show_shader_list.py
Created November 16, 2015 17:07
This script opens a dialog that displays all shaders in a material, tag or object that can be specified with a link box. http://i.imgur.com/wSBWR8Z.png
# Copyright (C) 2015 Niklas Rosenstein
# All rights reserved.
#
# File: show_shaders.py
# Last Modified: 16.11.2015
# Description: This script opens a dialog that displays all
# shaders in a material, tag or object that can be specified
# with a link box.
import c4d
@NiklasRosenstein
NiklasRosenstein / asyncio_rlock.py
Last active December 28, 2017 20:40
This is just hacked together real quick, not 100% production proven.
import asyncio
class RLock(asyncio.Lock):
"""
A reentrant lock for Python coroutines.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._task = None