Skip to content

Instantly share code, notes, and snippets.

@thomashollier
thomashollier / pyenv_cheat-sheet.txt
Last active February 10, 2024 02:44
pyenv cheat sheet
# Pyenv cheat sheet
"pyenv" allows you to install and manage different versions of python on the same machine
"pyenv virtualenv" allows you to have and manage different package install environments
brew install pyenv pyenv-virtualenv
https://realpython.com/intro-to-pyenv
@thomashollier
thomashollier / Jerusalem stone SEexpr script.txt
Last active February 10, 2024 02:46
A procedural jerusalem stone texture generator with controls on size variations, grout width and corner roundness
############### USER PARAMETERS ######################
$frequency = 1; # 1.0, 4
$irregularity = 0.075; # 0, 1
$cornerSharpness = 30; # 1,50
$groutWidth = 0.05; # 0,.5
$groutSharpness = 0.5; # 0,1
$numberOfRows = 20; # 10,30
$rowSizeVariation = 0; #0 , 1
$minNumberOfBricks = 10; #5,20
@thomashollier
thomashollier / gist:474b521e3afbaf86cb7e06631d4222c1
Created December 4, 2023 07:38
seExpr script to make a jerusalem stone texture
$noiseBigU = fbm([$u*8, $v*8,1],6,2,.75);
$u = $u + $noiseBigU*.005;
$noiseBigV = fbm([111+$u*8, 111+$v*8,0],6,2,.75);
$v = $v + $noiseBigV*.0025;
# number of horizontal bands
$vNum = 20;
# variation in width of horizontal bands
$vVar = 0.35;
@thomashollier
thomashollier / imageMagickWarp.bsh
Last active March 15, 2024 05:58
Imagemagick image warp
#### Reference commands to do uv mapping with magick
# create a grad by making 'n' vertical bands of colors and blurring
echo "P2 4 1 255\n 137 195 125 255" | convert - -depth 16 -scale 151x50\! -blur 0x6 -resize 4096x1436\! +matte displace_map.tif
# use the grad to warp image
# note use of fx expression to make it resolution independent
inputImage=test.jpg
outputImage=testWarped.jpg
magick ${inputImage} -depth 16 displace_map.tif -virtual-pixel Gray -compose Displace -set option:compose:args '%[fx:w*.0855]x%[fx:0]' -composite -crop '%[fx:h*2]x%[fx:h]+%[fx:w*0.146]+%[fx:0]' ${inputImage}
@thomashollier
thomashollier / imageSize_And_MatteThickness.py
Last active February 10, 2024 02:48
Fit image A into B with even border
# This takes an image with an arbitrary aspect ratio and figures out the thickness of the border
# necessary to fit that image into an arbitrarily sized page while preserving the image's aspect ratio
# AKA: I'd like to center a randomly sized image into a standard (or also randomly) sized frame
# AKA: I want to put this image into this frame but I want an even border and I don't want to crop my image
imageWidth = 1080
imageHeight = 1920
pageWidth = 24
pageHeight = 36
@thomashollier
thomashollier / pyenvAndVenv
Last active May 16, 2023 22:54
Steps to setup pyenv and setting up venv environnments for various AI and NeRF tools
# osX and linux
brew install pyenv
# osX install python deps
brew install openssl readline sqlite3 xz zlib tcl-tk
# debian/ubuntu python deps
sudo apt update;
sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
@thomashollier
thomashollier / makeHuginCLIPano.bsh
Created April 8, 2023 00:43
Script to automatically stitch panos on the command line using hugin command line tools
PREFIX=$(basename $(pwd))
pto_gen -o project.pto *jpg
echo -----
echo cpfind
echo -----
echo ""
@thomashollier
thomashollier / sortImagesByTimestamps.py
Created April 8, 2023 00:40
sort images in subdirs by timestamp
#!/Users/thomas/miniconda3/bin/python3
import os, sys, subprocess
srcDir = "pix"
images=os.listdir("./pix/")
images.sort()
images=[x for x in images if x.split(".")[-1:][0]=="jpg"]
# ffmpeg filter, force landscape (or keep as is if already landscape) and
# rotate so top left and bottom right corner line up in the middle of the final frame
-vf 'transpose=2:passthrough=landscape,rotate=atan2(iw\,ih):ow=sqrt(iw*iw+ih*ih)'
@thomashollier
thomashollier / gist:a56e68ca9d18a4ab9b12cd6d6fb5d5ff
Created March 17, 2023 03:08
Create USD Unreal material binding
from pxr import Usd, UsdGeom, Sdf, UsdShade
import os
##############
# Assuming a single mesh usd file
# Create a material and a binding to an Unreal material location so it gets automagically assined on load
# Remove the existing material assignment if one is found in the file
#
##############