Skip to content

Instantly share code, notes, and snippets.

yig / seam_edges.h
Last active Jul 15, 2021
Finds all UV-space boundaries of a mesh.
View seam_edges.h
// Copyright (C) 2016 Yotam Gingold <>
// GitHub Gist:
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 /
Last active Oct 15, 2020
Make a simple, static index.html for a directory listing the files and their sizes.
#!/usr/bin/env python3
# Author: Yotam Gingold <>
# License: Public Domain (CC0)
# URL:
from pathlib import Path
def make_index_html( path ):
path = Path(path)
yig /
Last active Mar 25, 2021
Defang the macOS Zoom Installer. Extracts a .app that can be dragged to /Applications.
## Author: Yotam Gingold
## License: CC0 (public domain)
## URL:
## Download the latest Zoom installer.
echo "==> Downloading the latest Zoom installer."
cd ~/Downloads
curl -LO ''
yig /
Created Apr 2, 2020
Two useful functions for calculating lifetime mortgage payments
## Author: Yotam Gingold <>
## License: Public domain, CC0:
## URL:
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 )
yig / flatten.js
Created Jan 17, 2020 — forked from timo22345/flatten.js
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
View flatten.js
<!doctype html>
<title>Flatten.js, General SVG Flattener</title>
Random path and shape generator, flattener test base:
Basic usage example:
yig /
Last active Feb 20, 2021
Creates nearly the simplest possible static HTML image gallery for a set of images. Just the images with CSS max-width, max-height, padding, and optionally a title. Optional thumbnails.
yig /
Created Aug 9, 2018
Instructions for updating MacTeX's BasicTeX every year

Once you get the dreaded error message that tlmgr won't install any new packages, it's time to upgrade to the latest texlive.

  1. Save list of currently installed packages:

     tlmgr list --only-installed > previously_installed_texlive_packages.txt
  2. Download and install the latest BasicTex.pkg:

  3. Save list of default packages:

yig / matrix derivatives.txt
Last active Apr 9, 2021
matrix derivatives via frobenius norm
View matrix derivatives.txt
matrix derivatives via Frobenius norm
# Automatic matrix derivatives:
# A good primer on basic matrix calculus:
# The Matrix Reference Manual:
# Trying to understand the derivative of the inverse:
# Derivative of the pseudoinverse:
yig / httpserver.jl
Last active Dec 4, 2019
A simple static file server written in Julia. Listens on localhost port 8000. Doesn't serve files outside current working directory (unless symlinked). Doesn't print directory listings.
View httpserver.jl
Author: Yotam Gingold <yotam (strudel)>
License: Public Domain [CC0](
Description: A simple static file server written in Julia. Listens on localhost port 8000. Doesn't serve files outside current working directory (unless symlinked). Doesn't print directory listings. Runs on Julia 1.3.
using HTTP
using Base.Filesystem
yig /
Last active Jan 13, 2018
How to handle control-C when piping output to tee from Python.
# Run with
## python -u | tee foo.out
# Then press control-C.
## You never see the output without an IOError handler,
## because an IOError is generated (stdout went away) before a KeyboardInterrupt.
## You could catch the IOError and redirect stdout manually. UPDATE: That doesn't seem to work.
## Or you could tell `tee` to ignore SIGINT and exit this program gracefully:
# python -u | tee -i foo.out
from __future__ import print_function, division