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
#!/usr/bin/env python
from __future__ import print_function
import os
import pipes
import sys
import subprocess
# Replace this with "java.exe" or "javac.exe" to fixate this
# script on a certain Java executable file.
BINNAME = os.path.basename(sys.argv[0]) + '.exe'
import os
def splitpath(path):
"""
splitpath(path) -> (drive, parts, isabs)
Splits a path into its drive letter and path elements. If the OS
does not use drive letters, \\c drive will always be an empty
string. Note that on Windows, if a Unix-style absolute path is
passed, an empty \\c drive letter will be returned but \\c isabs
def get_some_basebitmap():
bmp = c4d.bitmaps.BaseBitmap()
bmp.InitWith('C:/Users/niklas/Desktop/foo.png')
return bmp
class Dialog(GeDialog):
def CreateLayout(self):
AddIconButton(self, 1000, "Button One", c4d.COLOR_SYNTAX_STRING)
AddIconButton(self, 1001, "Button Two", c4d.Vector(1.0, 0.66, 0.12), IconButton.M_ICONRIGHT)
@NiklasRosenstein
NiklasRosenstein / c4dpytask-5.py
Last active December 25, 2015 03:59
@rosensteinn #c4dpytask #medium Sort the selected objects in the #cinema4d object manager? #python #script @RagingClaw @PGoski Hah! For instance :) Let's choose the name of the object, case insensitive
# @rosensteinn #c4dpytask #medium Sort the selected objects in the
# #cinema4d object manager? #python #script
#
# @RagingClaw @Pgoski Hah! For instance :) Let's choose the name of
# the object, case insensitive
import c4d
sort_key = lambda x: x.GetName().lower()
@NiklasRosenstein
NiklasRosenstein / c4d-xpresso-min-max.py
Last active December 26, 2015 08:59
Dynamic input port handling for Python Nodes in XPresso (Cinema 4D).
import c4d
numerical_types = (
c4d.ID_GV_VALUE_TYPE_REAL, c4d.ID_GV_VALUE_TYPE_INTEGER,
c4d.DA_LONG, c4d.DA_REAL, c4d.DA_LLONG,
)
def main():
# Node output ports.
global Minimum, Maximum
@NiklasRosenstein
NiklasRosenstein / interpolator.cpp
Last active February 9, 2016 21:31
C++11 floating-point interpolation class with a convenient function to statically create an instance.
// 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
from __future__ import print_function
print("You've been jagged!")
print("Installing a Virus ...")

This Gist contains a bunch of Craftfiles to compile various libraries.

@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
@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.