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 / resize_tex.py
Created March 7, 2017 06:31 — forked from SEVEZ/resize_tex.py
Resize textures using python
import maya.cmds as cmds
import maya.OpenMaya as om
fileNodes = cmds.ls(sl=1)
width = 1024
height = 1024
image = om.MImage()
for i in fileNodes:
filePath = cmds.getAttr(i+'.fileTextureName')
@davidlatwe
davidlatwe / messages.md
Created August 23, 2017 18:26 — forked from mharris717/messages.md
A Conversation About OOP vs. FP Turns Constructive

Just tried to put this in a more readable format: https://github.com/svanderbleek/haskellandchill.com/blob/master/a-conversation-about-oop-vs-fp-turns-constructive.md

Person Time Message
sagar 10:47 why is that, why is OOP trash
katychuang 10:48 excellent question
katychuang 10:49 I've been told FP and OOP are different paradigms
katychuang 10:52 I'm going to butcher a quote from a talk by Evie so I'm going to paraphrase… She said something like when you work with OOP you create lots of objects and rules on how they should interact and yet somehow end up having to touch each other a lot and inappropriately
katychuang 10:53 On the other hand FP (especially Haskell) is like working with shapes, like that baby shape fitting toy where you focus more on fitting the type parameters correctly
katychuang 10:56 I think of programming as building a piping system. FP (especia
@davidlatwe
davidlatwe / README.md
Created November 2, 2017 06:43 — forked from mottosso/README.md
Nodes with unique IDs

Nodes with unique IDs in Maya

unique_id1.py associates a new ID to every DAG-node in the scene, unique_id2.py does the same but keeps existing IDs as-is. Finally, unique_id3.py updates IDs and ensures that no duplicate ID exists in the scene.

@davidlatwe
davidlatwe / MayaDockingClass.py
Created November 23, 2017 05:59 — forked from liorbenhorin/MayaDockingClass.py
Maya 2017 PySide2 Docking Qt QMainWindow
"""
This is what you need to do in order to get a qt window to dock next to maya channel box,
In all maya versions, including 2017 with PySide2
"""
__author__ = "liorbenhorin@gmail.com"
import sys
import os
import logging
import xml.etree.ElementTree as xml
@davidlatwe
davidlatwe / undo_dec.py
Created November 23, 2017 07:29 — forked from schworer/undo_dec.py
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
@davidlatwe
davidlatwe / maya2017install.sh
Created November 23, 2017 17:01 — forked from borgfriend/maya2017install.sh
Maya 2017 Installation on Ubuntu 16.04
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!”
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@davidlatwe
davidlatwe / mongodb_basic_commands.md
Last active December 24, 2017 20:58 — forked from leommoore/mongodb_basic_commands.md
MongoDB - Basic Commands

MongoDB - Basic Commands

Saving Data

db  //Tells you the current database

show collections //Shows the collections available in the current db

db.foo.save({_id:1, x:10}) //Save the document into the foo collection  

db.bar.save({_id:1, x:10}) //Save the document into the bar collection

@davidlatwe
davidlatwe / gist:8522709a1e604079c5d2e01ec92ad7f3
Created December 27, 2017 10:18 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@davidlatwe
davidlatwe / dict_merge.py
Created March 19, 2018 11:13 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct