Skip to content

Instantly share code, notes, and snippets.

View lcrs's full-sized avatar
🍅

lwws lcrs

🍅
View GitHub Profile
#!/usr/bin/python
# Pass year and month e.g. python monthly.py 2020 02
# ...will transcode or symlink everything found into /works/monthlies/monthlies202002/rushes/
import subprocess, sys, os
def find(folder, pattern, year, month):
firstofmonth = '%s-%s-01' % (year, month)
firstnextmonth = '%s-%d-01' % (year, int(month)+1)
c = ['find', folder, '-iname', pattern, '-type', 'f', '-newermt', firstofmonth, '!', '-newermt', firstnextmonth]
@lcrs
lcrs / gist:7100e46f7385b10ab790ef18dbcbee99
Last active September 13, 2019 07:57
point-based vector displacement with UV offset
uv on points, massive smooth of P with attribblur, normal, polyframe
then into this with the original on second input:
v@diff.x = dot(@opinput1_P - @P, v@N);
v@diff.y = dot(@opinput1_P - @P, v@tangentu);
v@diff.z = dot(@opinput1_P - @P, v@tangentv);
remesh the smoothed one then output of above into second input of:
@lcrs
lcrs / argh
Created March 10, 2019 04:46
grrr
00000000001b7200 s EH_frame1
0000000000005520 T _convert_10bit_y_uv_vectors_to_10bit_rgb_vectors_bt601_sse2_ssse3
00000000000055f0 T _convert_10bit_y_uv_vectors_to_10bit_rgb_vectors_bt709_sse2_ssse3
0000000000005470 T _convert_10bit_y_uv_vectors_to_10bit_rgb_vectors_sse2_ssse3
0000000000004d90 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt601_sse2_ssse3
0000000000004e50 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt601_sse2_ssse3_sse41
0000000000004f10 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3
0000000000004fd0 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_bt709_sse2_ssse3_sse41
0000000000005090 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_sse2_ssse3
0000000000005150 T _convert_10bit_y_uv_vectors_to_8bit_rgb_vectors_sse2_ssse3_sse41
@lcrs
lcrs / matchboxlist.py
Last active February 23, 2019 16:51
List matchbox shaders and their descriptions
#!/usr/bin/python
import os, glob, xml.etree.ElementTree as et
html = open('/tmp/matchboxlist.html', 'w')
xmls = glob.glob('/opt/Autodesk/presets/2019.2.1/matchbox/shaders/LOGIK/*.xml')
xmls.sort()
for xml in xmls:
@lcrs
lcrs / perc-dup-chek.py
Created February 2, 2019 20:32
check for matching images using perceptual hashing
from PIL import Image
import imagehash, os, sys
basenames1 = os.listdir(sys.argv[1])
basenames2 = os.listdir(sys.argv[2])
list1 = []
list2 = []
for (dirn, basen, lis) in ((sys.argv[1], basenames1, list1), (sys.argv[2], basenames2, list2)):
for fil in basen:
// Create a basis from points of triangle.
matrix3 basis_from_triangle(vector p1, p2, p3)
{
// Axes vectors. May not be orthogonal.
vector X, Y, Z;
Z = p2 - p1;
X = p3 - p1;
Y = normalize(cross(Z, X)) * length(p2 - p3);
return set(X, Y, Z);
}
@lcrs
lcrs / progress.py
Last active November 21, 2020 01:18
#!/usr/bin/python
# Prints a progress bar and stats for a folder filling with files
# Pass the path and the total expected count, like:
# ./progress.py /path/to/somewhere/ 900
# |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU | 62% 157/250 0.2fps 6.4spf eta0:09:57
# TODO:
# o Data rate stats
# o Take a fragment of shell script for custom counting
import os, sys, time, datetime
#!/usr/bin/python
# pass: /path/to/scene.hip ropname startframe endframe howmany threadseach
# e.g.:
# /works/useful/poast/hrender-multi.py /Volumes/fast/nissan/eye/eye_v08.hip mantra1 1 118 16 1
import sys, os, time
hipfile = sys.argv[1]
rop = sys.argv[2]
start = int(sys.argv[3])
set cut_paste_input [stack 0]
version 11.2 v1
CheckerBoard2 {
inputs 0
format "2048 1024 0 0 2048 1024 1 2048x1024"
name CheckerBoard1
selected true
xpos -40
ypos -153
}
# Retime a tracked object to better fit a target curve
# Select two Transform nodes: the first with a jerky tracked curve, the
# second with a smooth target curve
# Group effort by Lewis Saunders, Unai Martínez Barredo, Erwan Leroy
# Make a function to calculate the distance between two points
def distance(a, b):
return pow((a[0]-b[0])**2 + (a[1]-b[1])**2, 0.5)
# Find the closest point to p on the line ab