Skip to content

Instantly share code, notes, and snippets.

@yig
yig / parametric_shape.py
Created April 11, 2024 16:03
A port of "Retrieval on Parametric Shape Collections" [Schulz et al. 2017]'s public code release to Python.
# A port of "Retrieval on Parametric Shape Collections" [Schulz et al. 2017]'s public code release to Python.
# Project website: <https://people.csail.mit.edu/aschulz/paramShapeRetrieval/index.html>
# This code was created by manually correcting the output of ChatGPT.
import numpy as np
class ParametricShape:
EPSILON_CONST = 1e-7
def __init__(self, filename=None, nParameters=None, defaultParameters=None, triangles=None,
@yig
yig / lch_histo.py
Last active March 26, 2024 13:50
Make an Lch histogram from an image. Try `lch_histo.py --wheel` and then `lch_histo.py --histofancy image.png wheel.png`.
#!/usr/bin/env python3
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
On GitHub as a gist: https://gist.github.com/yig/2de8f832b96f6ddffd788bb9c3e72ccf
'''
## pip install scikit-image drawsvg
@yig
yig / sig2text.py
Last active February 25, 2024 05:16
Converts a PDF file assumed to be a two-column ACM article to text. Ignores reviewer red numbering.
'''
# Author: Yotam Gingold <yotam@yotamgingold.com>
# License: CC0
# URL: <https://gist.github.com/yig/d55eba6221997d12d94fe6976a357edd>
## About
Converts a PDF file assumed to be a two-column ACM article to text. Ignores reviewer red numbering.
## Install
@yig
yig / autonirf.py
Last active January 30, 2024 04:28
Download 2023 data from the Indian Ministry of Education (MoE) National Institute Ranking Framework (NIRF) for all categories
## All the categories on <https://www.nirfindia.org/2023/Ranking.html>
## pip install requests beautifulsoup4
## Author: Yotam Gingold <yotam@yotamgingold.com>
## License: CC0
## URL: <https://gist.github.com/yig/bc29935d22845dc02bf5000bcf18ba25>
# from pathlib import Path
import csv
import os
@yig
yig / feedgen.py
Last active December 20, 2023 03:12
Create a valid podcast RSS feed from a base URL and a list of files.
#!/usr/bin/env python3
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
On GitHub as a gist: https://gist.github.com/yig/4784a86c1343d2bed789dd243ce980fc
'''
'''
Example:
@yig
yig / simplepalettes.py
Last active May 1, 2023 21:59
Generate palette swatches, one random and one following a template. Can also generate uniform color wheels in Lab/Luv space via `python3 simplepalettes.py --wheel -L 60 -c 33 triad foo`.
#!/usr/bin/env python3
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
On GitHub as a gist: https://gist.github.com/yig/3d2a68232554df3b76509438ebba2106
'''
from __future__ import print_function, division
@yig
yig / seam_edges.h
Last active July 15, 2021 11:08
Finds all UV-space boundaries of a mesh.
// Copyright (C) 2016 Yotam Gingold <yotam@yotamgingold.com>
// GitHub Gist: https://gist.github.com/yig/bea834b6e5262490611cdb4470a2f34c
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
@yig
yig / index.html.py
Last active October 15, 2020 14:06
Make a simple, static index.html for a directory listing the files and their sizes.
#!/usr/bin/env python3
# Author: Yotam Gingold <yotam@yotamgingold.com>
# License: Public Domain (CC0)
# URL: https://gist.github.com/yig/e59eaa22f5042320ecf18a87da4e44ae
from pathlib import Path
def make_index_html( path ):
path = Path(path)
@yig
yig / zoom-defang.sh
Last active September 11, 2023 11:54
Defang the macOS Zoom Installer. Extracts a .app that can be dragged to /Applications.
#!/bin/sh
## Author: Yotam Gingold
## License: CC0 (public domain) https://creativecommons.org/share-your-work/public-domain/cc0/
## URL: https://gist.github.com/yig/af5bbb054bb9c4de39abc9156e6863e1/
## Download the latest Zoom installer.
echo "==> Downloading the latest Zoom installer."
cd ~/Downloads
## Intel:
@yig
yig / mortgage.py
Created April 2, 2020 13:34
Two useful functions for calculating lifetime mortgage payments
## Author: Yotam Gingold <yotam@yotamgingold.com>
## License: Public domain, CC0: https://creativecommons.org/share-your-work/public-domain/cc0/
## URL: https://gist.github.com/yig/6eb1c3170e6e2e05df810fca8e47f3ca
"""
You can calculate your monthly payment for a loan for X years with interest rate Y%. For example:
> monthly_payment_for_termination_in_X_years( years = 30, principal = 300_000, interest_rate_per_year = 3.75/100 )
$1389.35