Skip to content

Instantly share code, notes, and snippets.

View atvKumar's full-sized avatar

Kumaran atvKumar

View GitHub Profile
@atvKumar
atvKumar / mkWindow.py
Created July 27, 2015 11:47
Auto-updating GUI
#-------------------------------------------------------------------------------
# Boiler Plate Code for Windows
# By : Kumaran
import pymel.core as pm
class UI(pm.uitypes.Window):
_TITLE = "mkWindow"
_LAYOUT = "mkLayout"
_DOCKCONTROL = "mkDockCtrl"
@atvKumar
atvKumar / mkWindow.py
Created July 27, 2015 11:42
Boiler Plate Code for Windows GUI under PyMel/Python/Maya
#-------------------------------------------------------------------------------
# Boiler Plate Code for Windows
# By : Kumaran
import pymel.core as pm
class UI(pm.uitypes.Window):
_TITLE = "mkWindow"
_LAYOUT = "mkLayout"
_DOCKCONTROL = "mkDockCtrl"
@atvKumar
atvKumar / mkRenderQueue.jsx
Created May 5, 2015 09:56
After Effects Script to create folders and render Compositions.
// Copyright: Kumaran
function getSelectedComps(){
var allItems = app.project.items;
selectedComps = new Array();
for (var i = allItems.length; i >= 1; i--) {
eachItem = allItems[i];
if ((eachItem instanceof CompItem) && eachItem.selected) {
selectedComps[selectedComps.length] = eachItem;
//$.writeln(eachItem.name);
@atvKumar
atvKumar / mkDevTools.py
Last active January 14, 2023 04:06
Python Module Reloading and ReCompiling for Maya
from os import path
import compileall
import sys, types
def recompile(modulename):
"""Recompile the given module, its directory's contents!"""
myScriptPath = sys.modules[modulename.__name__].__path__[0]
if path.isdir(myScriptPath):
compileall.compile_dir(myScriptPath, force=True)
@atvKumar
atvKumar / mkSave.py
Last active August 29, 2015 14:16
Increment and Save in Maya
import maya.cmds as cmds
from os.path import join as joinpath, split as splitpath
class FileNotExist(IOError):
pass
def hasNumbers(inputString):
return any(char.isdigit() for char in inputString)
@atvKumar
atvKumar / zipbackup.py
Last active December 12, 2015 13:02
Backup Zip
import os
import copy
import subprocess as sp
zip_cmd = ['zip', '-r', '-9', '-T']
lwza_cmd = ['7za', 'a', '-t7z', '-mx9', '-v2g']
def loadExcludedListFromPath(path):
excludedList = list()
for afile in os.listdir(path):
@atvKumar
atvKumar / file_utils.py
Last active August 29, 2015 14:12
File Utilities
from __future__ import division
from platform import system
from os import stat
from os.path import basename, splitext, dirname, split as splitpath, \
join as joinpath
from datetime import datetime
from glob import glob
import hashlib
import subprocess
@atvKumar
atvKumar / Slice1.py
Created November 1, 2014 05:43
Slicing
# In[5]:
x = [[ 795. , 501.0292887 ],
[ 794.97154472, 501. ],
[ 794.96078431, 500. ],
[ 795. , 499.09090909],
[ 795.03921569, 500. ],
[ 795.02777778, 501. ],
[ 795. , 501.0292887 ]]
@atvKumar
atvKumar / IMDB_Scrapping_01.py
Created May 31, 2014 04:50
Use Requests and Beautiful Soup to Scrap for data
__author__ = 'kumar'
from bs4 import BeautifulSoup
import requests
page = requests.get('http://www.imdb.com/chart/?ref_=nv_ch_cht_2%3F')
soup = BeautifulSoup(page.text)
for x in soup.find_all('td', {"class": "ratingColumn"}):
@atvKumar
atvKumar / listdir_flavour1.py
Last active August 29, 2015 14:01
listdir VS walk
def listLocation(root_location,files = [],folders = []):
""" A recursive function to get directory content into arrays
Usage : x,y = listLocation(directory/path)
Returns 2 arrays 1 files array and 1 folders array """
for eachitem in os.listdir(root_location):
filePath = os.path.join(root_location,eachitem)
if os.path.isdir(filePath) and not eachitem.startswith('.'):
folders.append(filePath)
listLocation(filePath,files,folders)
elif os.path.isfile(filePath) and not eachitem.startswith('.'):