Skip to content

Instantly share code, notes, and snippets.

View liaokongVFX's full-sized avatar
🎯
调焦

了空 liaokongVFX

🎯
调焦
View GitHub Profile
@Meatplowz
Meatplowz / performFileDropAction.mel
Last active May 20, 2024 07:41
Override the Maya Drag and Drop Behavior for File Open/Import
// Randall Hess randall.hess@gmail.com
// Instructions: Copy this file over your local maya version to override the default behavior
// Maya 2022 and Higher
// Additional: You can also build and load this as a module and not overwrite the local maya file.
// Location: C:\Program Files\Autodesk\MayaXX\scripts\others\performFileDropAction.mel
global proc int
performFileDropAction (string $theFile)
@zhuang-hao-ming
zhuang-hao-ming / main.md
Last active June 30, 2024 02:39
如何对python代码做性能分析

做实验的时候常常会遇到一个脚本跑的很慢的情况,这个时候我们常常会想方设法的去做一些优化,来让脚本跑的快一些。 但是优化带来了两个问题,一个是优化后的代码仍然是正确的吗,第二个问题是优化有效果吗?

第一个问题可以依靠编写合适的单元测试来解决, 但是究竟如何编写合适的单元测试仍然是一个很大的问题,这个问题我们留待以后在讨论。

第二个问题可以依靠性能分析来解决,性能分析就是测试代码的执行时间,很多时候我们经常会用如下的方式来做性能分析,但是这种方法一来麻烦,二来会把代码弄得很混乱。

from time import time

begin_tick = time()
@sohelrana820
sohelrana820 / catch-php-output-buffering-data-jquery-ajax.php
Last active May 12, 2024 00:31
Get Streaming Data Over Jquery Ajax
<?php
/**
* Catch php output buffering data over jQuery AJAX
*
* @author: Sohel Rana (me.sohelrana@gmail.com)
* @author url: https://blog.sohelrana.me
* @link: https://blog.sohelrana.me/catch-php-output-buffering-data-jquery-ajax/
* @licence MIT
*/
import time, hou
# version 1. Static class
class SessionCallback(object):
last_time = time.time()
interval = 10 # sec
@classmethod
@jackdoerner
jackdoerner / dpx.py
Last active December 27, 2023 16:31
Read Metadata and Image data from 10-bit DPX files in Python 3
"""
dpx.py
Read Metadata and Image data from 10-bit DPX files in Python 3
Copyright (c) 2016 Jack Doerner
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
@paulwinex
paulwinex / alembic_maya_writer_anim.py
Last active August 21, 2018 09:06
Polygons + Normals + UVs + animation + custom point and prim attribs + groups
from pymel.core import *
import maya.OpenMaya as om
from imath import *
from alembic.Abc import *
from alembic.AbcGeom import *
import math
import alembic
def get_mesh_data():
#pragma opname fisheyelens
#pragma oplabel "Fisheye Lens"
#pragma hint x hidden
#pragma hint y hidden
#pragma hint Time hidden
#pragma hint dofx hidden
#pragma hint dofy hidden
#pragma hint aspect hidden
#pragma hint P hidden
@dbr
dbr / nuke_save_with_root_settings.py
Last active September 21, 2023 07:27
Saving selected Nuke nodes to file, preserving the root settings
def root_settings_to_string(root):
"""Serialise the project settings. Used when writing the selected
nodes (otherwise things like the frame range would be lost)
"""
# Write non-default settings, in .nk script format. Also write
# user-knob definitons to avoid errors like NUKE-256
rootstring = root.writeKnobs(nuke.TO_SCRIPT | nuke.WRITE_USER_KNOB_DEFS)
# TODO: Why doesn't writeKnobs write [first/last]_frame? Also
@QuantumCD
QuantumCD / Qt 5 Dark Fusion Palette
Created August 15, 2013 21:40
This is a complete (I think) dark color palette for the Qt 5 Fusion theme, as well as a nice style sheet for the tool tips that make them blend better with the rest of the theme. To have immediate effect, be sure to put this in your main function before showing the parent window. Child windows should automatically inherit the palette unless you …
qApp->setStyle(QStyleFactory::create("Fusion"));
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);