A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
#! /bin/bash | |
GCC_VERSION="5.2.0" | |
WORKDIR="$HOME/src/" | |
INSTALLDIR="/platform" | |
## NOTE: XCode must be installed (through App Store) and the following run to install command-line tools. | |
## THIS IS IMPORTANT! Among other things, it creates '/usr/include' and installs the system header files. | |
# xcode-select --install |
import nuke | |
def duplicate_node(node, to_file = None): | |
"""Slightly convoluted but reliable(?) way duplicate a node, using | |
the same functionality as the regular copy and paste. | |
Could almost be done tidily by doing: | |
for knobname in src_node.knobs(): |
class func_and_method_decorator(object): | |
'''A clased based decorator that takes parameters and works on plain functions | |
and instance methods''' | |
def __init__(self, *args, **kwargs): | |
'''The init function is called when a module where the decorator is used | |
is imported. It gets passed all parameters that are given to decorator | |
definition. I.e. | |
@func_and_method_decorator(foo='bar') |
#based on http://forums.thefoundry.co.uk/phpBB2/viewtopic.php?t=3602&sid=7c140135632c783e7147e0e1b577eaa6 | |
#which is most interesting... | |
#code=""" | |
print 'knobChanged fired...' | |
n=nuke.thisNode() | |
k=nuke.thisKnob() | |
if k.name()=='number': | |
print 'yyyay!!!!!' | |
#""" |
Export your shell environment for http proxy use | |
export http_proxy="http://hostname:port" or save it to your shell profile. (i.e. ~/.bash_rc) | |
export http_proxy='http://example.proxy_name.com:80' | |
For multi-user installs, use sudo -E to preserve the proxy settings in your environment: | |
Setting git to use a proxy | |
git config --global url.https://github.com/.insteadOf git://github.com/ | |
git config --global http.proxy %http_proxy% |
import matplotlib | |
matplotlib.use('webagg') | |
import numpy as np | |
from scipy.special import binom | |
import matplotlib.pyplot as plt | |
from matplotlib.lines import Line2D |
from __future__ import division | |
from argparse import ArgumentParser | |
import math | |
import os | |
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import cv2 |
From Wikipedia:
In mathematics, a Fourier series decomposes periodic functions or periodic signals into the sum of a (possibly infinite) set of simple oscillating functions, namely sines and cosines (or complex exponentials).
Use the bottom right form to change the visualized serie.
TERMINATORS = ["\n", ";"] | |
ESC = "\\" | |
QUOTES = ['"', "'"] | |
class c: | |
""" | |
Will be at the start of a list representing an expression | |
in curly braces. Every c() is equal to any other c() | |
""" |