Skip to content

Instantly share code, notes, and snippets.

View davidlatwe's full-sized avatar
:shipit:
Awesome

David Lai davidlatwe

:shipit:
Awesome
View GitHub Profile
@davidlatwe
davidlatwe / xrdp-nvidia-setup.sh
Created March 22, 2024 16:13 — forked from Nexarian/xrdp-nvidia-setup.sh
Setup for XRDP using Nvidia Acceleration
#!/usr/bin/env bash
set -e
cd ~
sudo -v
# Make sure system is in a good, updated, clean, state.
sudo apt-get -y update
@davidlatwe
davidlatwe / example.cpp
Created November 23, 2023 19:31 — forked from zekroTJA/example.cpp
Simple C++ asynchronous timer class
/*
COPYRIGHT © 2018 Ringo Hoffmann (zekro Development)
READ BEFORE USING: https://zekro.de/policy
*/
#include "timer.h"
using namespace std;
@davidlatwe
davidlatwe / chat.md
Created June 9, 2022 21:35
Some flash back on Sweet and Park with Colin

Hey Colin, sorry for the late reply. 😅

Let me start with some basic intro.

About Sweet and Park

  • Both Sweet and Park are rez command tools
  • Sweet can create/edit/manage rez suites
  • One rez suite for one project/template
  • Park connects to the production database and fetches active projects
@davidlatwe
davidlatwe / env-inspect.py
Last active February 9, 2022 21:23
Rez context environ inspector
from rez.config import config
from rez.rex import ActionInterpreter
from rez.resolved_context import ResolvedContext
config.packages_path.append("memory@any")
def memory_repository(packages):
Index: src/rezplugins/shell/_utils/powershell_base.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/rezplugins/shell/_utils/powershell_base.py b/src/rezplugins/shell/_utils/powershell_base.py
--- a/src/rezplugins/shell/_utils/powershell_base.py (revision d392c65bf63b4bca8106f938cec49144ba54e770)
+++ b/src/rezplugins/shell/_utils/powershell_base.py (date 1644346789393)
@@ -88,26 +88,14 @@
cls.syspaths = config.standard_system_paths
@davidlatwe
davidlatwe / python_decorator_guide.md
Created December 27, 2021 10:51 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@davidlatwe
davidlatwe / README.md
Created November 24, 2021 07:52
Test extracting archive file that contains unicode char with Python2 and 3
@davidlatwe
davidlatwe / README.md
Created November 1, 2021 19:08
Paired sotring

Paired sotring

@davidlatwe
davidlatwe / README.md
Last active October 21, 2021 04:57
Maya Mesh Hasher

Purpose

This is for identifying any geometry mesh changes during dependency data collecting process in publish, in Maya. Especially when publishing lookDev/Rig.

Artist often needs to work on modeling and look developing all together, which means the working model often not being the published one. And in publish process, system may not know which version of model is the dependency of current look.

To solve this kind of problem, we need to generate hashcode that based on target's feature. Take model as example, the hash function would based on mesh vertex position, normal, and UV.

With that hashcode saved with model verison data in database, we can verify look's model with previous version's hashcode to see if it's unchanged and matched the latest version of subset.

@davidlatwe
davidlatwe / README.md
Last active August 13, 2021 12:26
Workaround for Maya renderSetup layer overriding multiple same type/name AOVs

Workaround for Maya renderSetup layer overriding multiple same type/name AOVs

This is a note to self, to know why Maya renderSetup fails to apply renderLayer override on AOVs that are same type/name. (e.g. not able to disable specific AOV in renderLayer)

In Arnold, this happens when creating custom AOV with existing AOV name.

In Redshift, this happends when creating more than one AOV node that are same AOV type.

Hopefully, this will be fixed officially someday.