Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Kif11's full-sized avatar
🐁
Expanding digital frontier

Kirill Kovalevskiy Kif11

🐁
Expanding digital frontier
View GitHub Profile
@Kif11
Kif11 / basic_logging.py
Last active January 14, 2023 18:09
Python basic logging boilerplate for console log
import logging
log = logging.getLogger()
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
log.addHandler(handler)
log.setLevel(logging.INFO)
log.info('Hello World!')
@Kif11
Kif11 / bootstrap_nuke.sh
Created July 14, 2017 04:03
Creates PATH sumlinks for all versions of Nuke installed
#!/usr/bin/env bash
function bootstrap_nuke {
# Find all versions of Nuke installed
# and sumlink them to /usr/local/bin
nukes=$(
find /Applications/Nuke* -maxdepth 1 -type d -name Nuke* \
| egrep '(Nuke|NukeX)[0-9]+.[0-9]+v[0-9]+\.app'
)
@Kif11
Kif11 / shotgun_pure_request.sh
Created July 14, 2017 03:53
Example of HTTP request to Shotgun constructed in Bash
#!/usr/bin/env bash
function get_entity {
entity_type="$1"
if [[ -z $entity_type ]]; then
echo "Usage: sg_req [entity_type]"
return 1
fi
@Kif11
Kif11 / remove_maya.sh
Created July 14, 2017 03:49
Remove maya and associated files from your OSX
#!/usr/bin/env bash
# CAUTION! This might brake other Autodesk apps and their licenses
ver=2016
prod_key=657H1
# Unregister License
/Volumes/Install\ Maya\ $ver/Install\ Maya\ $ver.app/Contents/Resources/adlmreg -u N $prod_key $ver.0.0.F
/Volumes/Install\ Maya\ $ver/Install\ Maya\ $ver.app/Contents/Resources/adlmreg -u S $prod_key $ver.0.0.F
@Kif11
Kif11 / switch_command.sh
Created June 14, 2017 22:37
Bash basic case statement
cmd=$1
case $cmd in
"cmd1")
shift
# execute cmd1
;;
"cmd2")
shift
# execute cmd2
@Kif11
Kif11 / which_os.sh
Created June 14, 2017 22:31
Find current OS in bash
if [[ `uname` == "Linux" ]]; then
# Linux
elif [[ `uname` == "Darwin" ]]; then
# OSX
elif [[ `uname` = CYGWIN_NT* ]]; then
# Cygwin
fi
@Kif11
Kif11 / append_to_sudoers.sh
Last active June 14, 2017 22:28
Safe way to append a line to your sudoers file
# This is a safe way to append a line to your sudoers file
# The validation will be performed with "visudo -c"
# before replacing the sudoers file
if [[ -z $1 ]]; then echo "No line provided to append"; return 1; fi
# Include directive to be appended to sudoers file
include_line=$1
su_bac_file="/var/tmp/sudoers.bac"
@Kif11
Kif11 / obj_in_frust.py
Created June 7, 2017 17:11
Maya script to find if object located within camera frustum
import maya.cmds as cmds
import maya.OpenMaya as OpenMaya
import math
# Find if object located within camera frustum
# Usage:
# from obj_in_frust import in_frustum
# in_frustum('camera1', 'pCube1')
class Plane(object):
@Kif11
Kif11 / platform
Created February 1, 2017 00:20
Get current OS
platform = {'linux2': 'linux', 'darwin': 'mac', 'win32': 'windows'}[sys.platform]
def get_maya_location():
"""
Return maya install location on Windows
Source: https://github.com/JukeboxPipeline/jukebox-core/blob/master/src/jukeboxcore/ostool.py
:returns: path to maya
:rtype: str
:raises: errors.SoftwareNotFoundError
"""
# The supported maya versions