NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| #!/usr/bin/env bash | |
| set -e | |
| cd ~ | |
| sudo -v | |
| # Make sure system is in a good, updated, clean, state. | |
| sudo apt-get -y update | 
| /* | |
| COPYRIGHT © 2018 Ringo Hoffmann (zekro Development) | |
| READ BEFORE USING: https://zekro.de/policy | |
| */ | |
| #include "timer.h" | |
| using namespace std; | |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| ''' | |
| This plugin was ported to python from C++, | |
| All credits by Anno Schachner | |
| original plugin is here https://github.com/wiremas/tension | |
| ''' | |
| import sys | |
| import maya.api.OpenMaya as om2 | |
| import maya.OpenMaya as om | 
| import maya.api.OpenMaya as om2 | |
| import maya.cmds as mc | |
| import contextlib | |
| from colorbleed.maya.lib import iter_parents | |
| @contextlib.contextmanager | |
| def maintained_time(): | |
| ct = cmds.currentTime(query=True) | 
Source: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
by Sander Marechal
I've written a simple Python class for creating daemons on unix/linux systems. It was pieced together for various other examples, mostly corrections to various Python Cookbook articles and a couple of examples posted to the Python mailing lists. It has support for a pidfile to keep track of the process. I hope it's useful to someone.
| #!/bin/bash | |
| #Download Maya from here: http://download.autodesk.com/us/support/files/maya_2016_service_pack_6/Autodesk_Maya_2016_SP6_EN_Linux_64bit.tgz | |
| #Get a student License from: http://www.autodesk.com/education/free-software/maya | |
| #Log in and select maya 2016, your language and an OS. Either should work. | |
| # !!!!!! IMPORTANT !!!!!! | |
| # BEFORE RUNNING, REPLACE "USER" AND "HOME" AT THE BOTTOM OF THIS SCRIPT WITH YOUR USERNAME AND HOME FOLDER | |
| # !!!!!! IMPORTANT !!!!!! | 
| [run] | |
| branch = True | |
| source = . | 
| from cefpython3 import cefpython | |
| import sys, os | |
| import platform | |
| import ctypes | |
| from PySide.QtGui import * | |
| from PySide.QtCore import * | 
| 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 |