Skip to content

Instantly share code, notes, and snippets.

View timlehr's full-sized avatar
🍜
Dreaming of ramen

Tim Lehr timlehr

🍜
Dreaming of ramen
View GitHub Profile
@schworer
schworer / undo_dec.py
Created February 22, 2012 17:57
quick and dirty Maya Python undo decorator
from functools import wraps
from maya import cmds
def undo(func):
""" Puts the wrapped `func` into a single Maya Undo action, then
undoes it when the function enters the finally: block """
@wraps(func)
def _undofunc(*args, **kwargs):
try:
# start an undo chunk
@revolunet
revolunet / icon-packs.md
Last active December 28, 2019 16:36
List of free icon packs

Icon ressources collection

@octavifs
octavifs / std::map_to_boost::python::dict.cpp
Last active March 9, 2021 03:04
Converts C++ std::map to boost::python::dict
// Converts a C++ map to a python dict
template <class K, class V>
boost::python::dict toPythonDict(std::map<K, V> map) {
typename std::map<K, V>::iterator iter;
boost::python::dict dictionary;
for (iter = map.begin(); iter != map.end(); ++iter) {
dictionary[iter->first] = iter->second;
}
return dictionary;
}
@fredrikaverpil
fredrikaverpil / get_set_values.py
Last active May 20, 2024 20:31
Get and set knob values #nuke
# Get all nodes of type Read
readnodes = nuke.allNodes('Read')
for readnode in readnodes:
print readnode
# List all knobs for selected node
print( nuke.toNode('Read1') )
# List all knobs for specific node
print( nuke.selectedNode() )
@lschmierer
lschmierer / dark_fusion.py
Last active March 11, 2025 01:08 — forked from QuantumCD/Qt 5 Dark Fusion Palette
Qt5 Dark Fusion Palette for Python
qApp.setStyle("Fusion")
dark_palette = QPalette()
dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
dark_palette.setColor(QPalette.WindowText, Qt.white)
dark_palette.setColor(QPalette.Base, QColor(25, 25, 25))
dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
dark_palette.setColor(QPalette.ToolTipText, Qt.white)
@BlackIkeEagle
BlackIkeEagle / h264-vivaldi-linux.md
Last active May 6, 2019 09:34 — forked from ruario/h264-vivaldi-linux.md
Using H.264 in Vivaldi for Linux

How to use H.264 support In Vivaldi, via an alternative FFMpeg library

Intro

The following is a quick guide to get tthis working on various Linux distros. As a side note, if you have Chrome installed alongside Vivaldi, Netflix should also work after making these changes.

Ubuntu

Install chromium-codecs-ffmpeg-extra

@alexcmd
alexcmd / MeshCut.cs
Created December 29, 2015 08:29
Mesh cut algorithm for Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MeshCut
{
private static Plane blade;
private static Transform victim_transform;
private static Mesh victim_mesh;
@justinfx
justinfx / MImage_to_QImage.py
Created January 28, 2016 07:12
Passing pixel pointer from a Maya MImage to Qt's QImage
"""
Simplified version of original forum post:
http://tech-artists.org/forum/showthread.php?4547-Passing-uchar-pointer-with-PySide-in-Maya
"""
import ctypes
import maya.OpenMaya as om
from PySide import QtCore, QtGui
# Build a test MImage
@zonble
zonble / KKSimplePlayer.swift
Created April 21, 2016 16:34
Using AudioQueue and Swift to do a simple stream player
import Foundation
import AudioToolbox
class KKSimplePlayer: NSObject {
var URL: NSURL
var URLSession: NSURLSession!
var packets = [NSData]()
var audioFileStreamID: AudioFileStreamID = nil
var outputQueue: AudioQueueRef = nil
var streamDescription: AudioStreamBasicDescription?
@amirasaran
amirasaran / BaseThreading
Created October 27, 2016 06:36
Python threading with callback function (callback function run after thread is finished)
import time
import threading
class BaseThread(threading.Thread):
def __init__(self, callback=None, callback_args=None, *args, **kwargs):
target = kwargs.pop('target')
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs)
self.callback = callback
self.method = target