Skip to content

Instantly share code, notes, and snippets.

Avatar

Eriks Vitolins evitolins

View GitHub Profile
@evitolins
evitolins / RRM_utils.py
Last active Dec 19, 2019
Maya Python Snippets
View RRM_utils.py
'''
This fixes a RRM bug (v1.4.7) where saved RRM setups do not preserve a
module's 'pinned' status.
'''
import maya.cmds as cmds
import maya.mel
def RRM_fixPinBug(objs):
for obj in objs:
trans = cmds.xform(obj,q=True, r=True, translation=True)
maya.mel.eval("RRM_PinProxies(1, 0);")
@evitolins
evitolins / docker_aliases.sh
Last active Feb 21, 2019
Helpful aliases to interact with Docker
View docker_aliases.sh
# ------------------------------------
# Docker Aliases
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get running containers
alias dps="docker ps"
# Get all containers
@evitolins
evitolins / new_user.sh
Created Jan 29, 2019
Create a new Linux User w/ default SSH files
View new_user.sh
NEWUSER="my_new_user"
sudo mkdir -p /home/${NEWUSER}/.ssh && \
sudo touch /home/${NEWUSER}/.ssh/authorized_keys && \
sudo useradd -d /home/${NEWUSER} ${NEWUSER} && \
sudo usermod -aG sudo ${NEWUSER} && \
sudo chown -R ${NEWUSER}:${NEWUSER} /home/${NEWUSER}/ && \
sudo chown root:root /home/${NEWUSER} && \
sudo chmod 700 /home/${NEWUSER}/.ssh && \
sudo chmod 644 /home/${NEWUSER}/.ssh/authorized_keys
View animschool_video_bonus_controls.js
var v = $('#video_html5_api')[0];
var offsetTime = function (video, offset) {
video.currentTime = (video.currentTime + offset);
};
var c = document.createElement('div');
c.style.position="absolute";
c.style.top="0";
c.style.right="0";
var createButton = function (video, label, offset) {
var b = document.createElement("button");
View adarkroom
## Save Point
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb20iOnRydWUsIm91dHNpZGUiOnRydWUsIndvcmxkIjp0cnVlfX0sInN0b3JlcyI6eyJ3b29kIjozMiwiZnVyIjo1MDAxLCJiYWl0IjoxNjQ3LCJ0ZWV0aCI6NjMsInNjYWxlcyI6MTA4LCJtZWF0IjoyNTUsImNsb3RoIjoxMjcsImNoYXJtIjo2LCJsZWF0aGVyIjozMDY3LCJjdXJlZCBtZWF0IjoxNiwiY29tcGFzcyI6MSwidG9yY2giOjEwLCJib25lIHNwZWFyIjowLCJ3YXRlcnNraW4iOjEsInJ1Y2tzYWNrIjoxLCJsIGFybW91ciI6MSwiaXJvbiI6MzI0NSwiYm9sYXMiOjAsImNhc2siOjEsIndhZ29uIjoxLCJpIGFybW91ciI6MSwiaXJvbiBzd29yZCI6MSwibWVkaWNpbmUiOjAsInN0ZWVsIHN3b3JkIjoxLCJzdGVlbCI6Mjc2LCJyaWZsZSI6MCwiYnVsbGV0cyI6MSwiZ3JlbmFkZSI6MCwibGFzZXIgcmlmbGUiOjAsImVuZXJneSBjZWxsIjowLCJiYXlvbmV0IjowLCJ0cmFwIjowLCJjYXJ0IjowLCJodXQiOjAsImxvZGdlIjowLCJ0cmFkaW5nIHBvc3QiOjAsInRhbm5lcnkiOjAsInNtb2tlaG91c2UiOjAsIndvcmtzaG9wIjowLCJzdGVlbHdvcmtzIjowLCJhcm1vdXJ5IjowLCJ3YXRlciB0YW5rIjoxLCJjb252b3kiOjEsInMgYXJtb3VyIjoxLCJjb2FsIjo0OX0sImNoYXJhY3RlciI6eyJwdW5jaGVzIjo1LCJzdGFydmVkIjoyLCJkZWh5ZHJhdGVkIjoxLCJwZXJrcyI6eyJzY291dCI6dHJ1ZX19LCJpbmNvbWUiOnsiZ2F0aGVyZXIiOnsiZGVsYXkiOjEwL
View maya_subdivide_joints.py
import maya.cmds as cmds
'''
Split joint chain between 2 joints (parent/child).
Usage Example:
jnts = cmds.ls(selection=True, type='joint')
@evitolins
evitolins / commandPort.py
Created Aug 31, 2014
Maya CommandPort methods to assist with MayaSublime package integration.
View commandPort.py
import maya.cmds as cmds
def activateCommandPort(host='127.0.0.1', port='7002', language="python"):
path = host + ":" + port
active = cmds.commandPort(path, q=True)
if not active:
cmds.commandPort(name=path, sourceType=language)
else:
print("%s is already active" % path)
@evitolins
evitolins / selectExportables.mel
Created Oct 26, 2017
Quickly select exportable items (joints and mesh belonging to skin clusters)
View selectExportables.mel
proc string[] getTransform(string $shape[]) {
string $transform[];
for ($node in $shape) {
if ( "transform" != `nodeType $node` ) {
// If given node is already a transform, just pass on through
string $parents[] = `listRelatives -fullPath -parent $node`;
appendStringArray($transform, $parents, size($parents));
}
}
return $transform;
@evitolins
evitolins / gistbox_scrape.js
Created Oct 26, 2017
Grab your gistBox urls and associated labels into JSON
View gistbox_scrape.js
// Run this in the JS console, after logging into your GistBox
var gists = app.gists.models;
var data = [];
var i, ii, g, l;
for (i=0; i<gists.length; i++) {
gist = gists[i];
g = {};
g.id = gist.id;
g.url = gist.attributes.link_url;
@evitolins
evitolins / simple_flex_grid.css
Created Jun 18, 2017
A simple responsive grid using flexbox
View simple_flex_grid.css
.grid .cell {
position: relative;
margin: 1rem 1rem 2rem;
}
@media screen and (min-width: 600px) {
.grid {
display: flex;
flex-wrap: wrap;
flex-direction: row;
You can’t perform that action at this time.