Skip to content

Instantly share code, notes, and snippets.

@spontaneOS
spontaneOS / any_with_list_comprehension.py
Created May 27, 2019 18:11
Use any() with list comprehension in Python
provinces_list = ['central', 'east_test', 'central_collection', 'west_gameplay']
list_keys = ('region', 'test', 'collection')
provinces_list = [p for p in provinces_list if not any(l in p.lower() for l in list_keys)]
@spontaneOS
spontaneOS / exploreFile.py
Created December 20, 2018 21:30
Launch explorer at location of and with given file selected.
# Launch explorer at location of and with given file selected.
import subprocess
subprocess.Popen("explorer /select," + "FILE_PATH")
@spontaneOS
spontaneOS / findLoadedHDAs.py
Created December 20, 2018 21:22
List of custom HDAs from Houdini asset manager.
# List of custom HDAs from Houdini asset manager.
def findLoadedHDAs():
'''
Returns a list of loaded HDAs in Houdini scene.
HDAs installed by default with Houdini are skipped.
'''
loadedHDAs = []
# Scan all node categories
for category in hou.nodeTypeCategories().values():
# Scan all node types
@spontaneOS
spontaneOS / saveHDA.py
Created December 20, 2018 21:19
Save a Houdini Digital Asset through tool shelf button
# Save a Houdini Digital Asset through tool shelf button
def saveHDA(hdaName_to_save):
'Save a particular HDA.'
# Get all instances of HDA
for node in hou.node("/obj").children():
hdaName = node.type().definition().nodeTypeName()
if hdaName_to_save in hdaName and (not node.isLocked()):
node.type().definition().updateFromNode(node)
saveHDA("HDA_NAME_TO_SAVE")
@spontaneOS
spontaneOS / vscode-extensions.json
Created December 18, 2018 17:57
Useful vscode extensions
{
"alexcvzz.vscode-sqlite": 1,
"andyyaldoo.vscode-json": 1,
"batisteo.vscode-django": 1,
"chrmarti.regex": 1,
"DavidAnson.vscode-markdownlint": 1,
"donjayamanne.jupyter": 1,
"donjayamanne.python-extension-pack": 1,
"DotJoshJohnson.xml": 1,
"GrapeCity.gc-excelviewer": 1,