This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Configure eth0 | |
# | |
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
DEVICE="eth0" | |
NM_CONTROLLED="yes" | |
ONBOOT=yes | |
HWADDR=A4:BA:DB:37:F1:04 | |
TYPE=Ethernet | |
BOOTPROTO=static |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Export all data from this database | |
cd C:\Program Files\MySQL\MySQL Server 5.6\bin | |
REM To export to file (structure only) | |
mysqldump --no-data [DATABASENAME] -h localhost -u [USER] -p[PASSWORD] > C:\databackup\database_ddl_backup.sql | |
mysqldump --no-create-info --no-create-db [DATABASENAME] -h localhost -u [USER] -p[PASSWORD] > C:\databackup\database_data.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make 13 into 0013 | |
'{:04}'.format(13) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all nodes of type Read | |
readnodes = nuke.allNodes('Read') | |
for readnode in readnodes: | |
print readnode | |
# List all knobs for selected node | |
print( nuke.toNode('Read1') ) | |
# List all knobs for specific node | |
print( nuke.selectedNode() ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def traverseBackwardsAndFindFolder( startPath, searchForFolder ): | |
# Usage example: traverseBackwardsAndFindFolder( nuke.root().name(), 'render' ) | |
returnPath = '' | |
for i in range(len(startPath.split('/'))): | |
startPath = startPath[:startPath.rfind('/')] | |
# Check if it exists | |
if (os.path.isdir(startPath + '/' + searchForFolder)): | |
returnPath = startPath + '/' + searchForFolder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List Nuke's environment settings | |
print( nuke.root() ) | |
# Nuke script's filename | |
print( os.path.basename( nuke.root().name() ) ) | |
# Nuke script's directory | |
print( os.path.dirname( nuke.root().name() ) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getSubdirs( directory ): | |
for item in os.listdir( directory ): | |
# print path to all subdirectories first. | |
if os.path.isdir( os.path.join( directory, item ) ): | |
print item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This searches for a sequence of characters | |
import os | |
def checkForDir(searchDirs, partialOrFullDirNameToFind): | |
for searchDir in searchDirs: | |
for directory in os.listdir(searchDir): | |
if partialOrFullDirNameToFind in directory.lower(): | |
foundDirectories.append(searchDir + directory) | |
return str(foundDirectories[len(foundDirectories)-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, fnmatch | |
startDirectory = 'C:/temp' | |
filetypes = ['*.jpg', '*.exr'] | |
for root, dirs, files in os.walk( startDirectory ): | |
for extension in ( tuple(filetypes) ): | |
for filename in fnmatch.filter(files, extension): | |
filepath = os.path.join(root, filename) | |
if os.path.isfile( filepath ): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
startDirectory = "c:/temp/" | |
searchString = "maya2012" | |
replacement = """multiline | |
string""" | |
for dname, dirs, files in os.walk(startDirectory): | |
for fname in files: | |
if ".ma" in fname: | |
fpath = os.path.join(dname, fname) |
OlderNewer