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 / 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
@davidlatwe
davidlatwe / inheritance_tracking.py
Created January 19, 2018 10:50
Tracking class inheritance
class FirstGen(object):
def tracker(self, trace=None):
if trace is None:
trace = []
for base in self.__class__.__bases__:
if "tracker" in dir(base):
trace += [base.__name__]
base().tracker(trace)
return trace
@davidlatwe
davidlatwe / mongo_sort_behavior.py
Last active January 19, 2018 10:50
Full code to reproduce MongoDB sorting behavior (basic data types)
import copy
try:
basestring
except NameError:
basestring = str
"""Usage Example
@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 / 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 / CONTRIBUTING.md
Created December 15, 2017 14:00
Good Contributing Guide Line Steal From miquelcampos/mgear

Contributing to mGear

Argument shorthands

In Maya, some arguments have a short equivalent. Don't use it.

Wrong

pm.workspace(q=True, rd=True)
@davidlatwe
davidlatwe / README.md
Last active November 26, 2017 15:27
Avalon Vanilla Config Proposal

Avalon Vanilla Config Proposal

Still in experiment stage, but I think the idea is becoming a little more solid now, good for discussion. And maybe this could develope as a vanilla config for Avalon.

Goal

  1. Provide a basic description of Avalon-Config package
  2. Git comparable
@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 / 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 / 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__ = "[email protected]"
import sys
import os
import logging
import xml.etree.ElementTree as xml