Skip to content

Instantly share code, notes, and snippets.

View bohdon's full-sized avatar

Bohdon Sayre bohdon

View GitHub Profile
@bohdon
bohdon / p4_sync_by_size.py
Created February 13, 2019 04:41
Sync P4 files below size limit
import os
import click
from P4 import P4
@click.command()
@click.argument('path')
@click.option('-s', '--max-size', default=5, help='maximum size of the file, in MB')
@bohdon
bohdon / placeholders.py
Created March 6, 2019 18:21
Create .placeholder files in any empty leaf directories
import os
import sys
import click
@click.command()
@click.argument("root_path")
def build(root_path):
root_path = os.path.abspath(root_path)
@bohdon
bohdon / stylebot_gmail_export.json
Created March 11, 2019 07:37
stylebot export for making Gmail more like Inbox
{"mail.google.com":{"_enabled":true,"_rules":{".Cp":{"box-shadow":"0 -1px 0 #e0e0e0, 0 0 2px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.24)","margin":"10px 4px 20px 4px"},".aeH, .ar4, .aeJ, tr.J-KU-Jg, .nM, .aRs, tr.TD, .bkL":{"background":"#f4f4f4"},"a.l9":{"display":"none"},"button.gb_df.gb_nf svg":{"display":"none"},"div.J-J5-Ji.amH.J-JN-I.J-JN-I-JE.J-JN-I-Kq":{"display":"none"},"div.TN.bzz.aHS-bnt":{"margin-top":"10px"},"div.aDG":{"display":"none"},"div.bkK":{"margin-left":"80px","margin-right":"80px"},"div.bvX.G-Ni":{"display":"none"},"div.gb_Fe":{"display":"none"},"div.gb_hc svg":{"display":"none"},"div.l6":{"display":"none"},"div.l6 div":{"display":"none"},"div.ma":{"display":"none"},"div.md.mj div":{"display":"none"},"form.gb_Se.gb_qf":{"margin-left":"-180px"},"img.gb_Wa":{"display":"none"},"span.adl":{"display":"none"},"svg.gb_ge":{"display":"none"},"svg.gb_he":{"display":"none"},"td.aRz":{"background":"#f4f4f4","min-width":"110px"}}}}
@bohdon
bohdon / remove_empty_dirs.py
Created April 9, 2019 17:40
Remove empty dirs and their meta files for a Unity project
#! /usr/bin/env python
import os
import click
@click.command()
@click.argument("path")
@click.option("-n", "--dry-run", is_flag=True, help="dry-run")
def remove_empty_dirs(path, dry_run=False):
@bohdon
bohdon / p4_find_caseonly_files.py
Last active June 30, 2021 18:29
Find files in P4 that differ by name only in case
#! python
"""
Util for finding files in perforce that differ only in case.
Usage: p4_find_caseonly_files.py [OPTIONS] ROOT_PATH
Options:
--deleted
--output-obliterate TEXT File to write with list of deleted conflicting
@bohdon
bohdon / UE4Snippets.code-snippets
Created November 29, 2019 21:48
UE4 snippets for Visual Studio Code
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@bohdon
bohdon / maya_opm_shelf.py
Last active January 19, 2020 22:18
Maya 2020 offsetParentMatrix shelf commands
# create opm connection (select leader then follower)
# > opm
import pulse.nodes
wm = pulse.nodes.getWorldMatrix(pm.selected()[1])
pm.selected()[0].wm >> pm.selected()[1].opm
pm.selected()[1].inheritsTransform.set(False)
pulse.nodes.setWorldMatrix(pm.selected()[1], wm)
# break opm connection
# x opm
@bohdon
bohdon / jenkins_list_workspaces_in_use.gvy
Created March 6, 2020 20:16
Jenkins list workspaces in use
for (node in Jenkins.instance.nodes) {
computer = node.toComputer()
println("---------------------")
println(computer)
println(computer.workspaceList.inUse.keySet())
}
@bohdon
bohdon / locator_at_vert_center.py
Created March 16, 2020 17:04
Place a locator at the center of all selected vertx in Maya
# place locator at center of verticies
import pymel.core as pm
def getVertexBounds(verts):
"""
Return the bounds of the vertices as a
minimum and maximum world point.
"""
if not verts:
pm.warning('No verts selected')
@bohdon
bohdon / rename_end_jnts.py
Last active April 21, 2020 19:59
Rename all end joints in Maya to "END_jnt"
import pymel.core as pm
import pulse
jnts = pm.selected(typ='joint')
roots = set([pulse.joints.getRootJoint(jnt) for jnt in jnts])
for root in roots:
end_jnts = pulse.joints.getEndJoints(root)
for end_jnt in end_jnts: