Skip to content

Instantly share code, notes, and snippets.

@spelufo
spelufo / open3d_poisson_recon_helpers.py
Created May 27, 2024 14:15
open3d_poisson_recon_helpers.py
def mesh_cleanup(mesh_o3d):
mesh_o3d.remove_non_manifold_edges()
mesh_o3d.merge_close_vertices(0.001)
mesh_o3d.remove_duplicated_vertices()
mesh_o3d.remove_duplicated_triangles()
mesh_o3d.remove_unreferenced_vertices()
mesh_o3d.remove_degenerate_triangles()
# This seems to keep the majority normal direction, but without knowing
# how it works there's the risk that it flips all the faces.
@spelufo
spelufo / git-log-to-json.sh
Created November 7, 2024 17:33
Convert git log output to JSON
# Similar to https://til.simonwillison.net/jq/git-log-json
git log --pretty=format:'%H%x00%an <%ae>%x00%ad%x00%s%x00' | python -c 'import sys, json
for line in sys.stdin:
commit, author, date, *message = line.split("\x00")
print(json.dumps({"commit": commit, "author": author, "date": date, "message": message[0]}))
'
@spelufo
spelufo / backup.sh
Created July 29, 2025 07:31
A backup script
#!/bin/sh
set -e
test "$#" -ge 2 || {
echo >&2 'usage: backup DIR DEST [ROOT]'
echo >&2 ' Make a backup of DIR in DEST/DATE/PATH, where:'
echo >&2 " * DATE is the today's date in the format YYYY-MM-DD."
echo >&2 ' * PATH is the path to DIR relative to ROOT (ROOT defaults to /).'
echo >&2