Skip to content

Instantly share code, notes, and snippets.

Yotam Gingold yig

Block or report user

Report or block yig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yig
yig / gallery_simple.py
Last active Dec 20, 2018
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.
View gallery_simple.py
@yig
yig / update_mactex.md
Created Aug 9, 2018
Instructions for updating MacTeX's BasicTeX every year
View update_mactex.md

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: http://www.tug.org/mactex/

  3. Save list of default packages:

@yig
yig / matrix derivatives.txt
Last active Sep 16, 2019
matrix derivatives via frobenius norm
View matrix derivatives.txt
matrix derivatives via Frobenius norm
# Automatic matrix derivatives: http://www.matrixcalculus.org/
# A good primer on basic matrix calculus: https://atmos.washington.edu/~dennis/MatrixCalculus.pdf
# The Matrix Reference Manual: http://www.ee.ic.ac.uk/hp/staff/dmb/matrix/intro.html#Intro
# Trying to understand the derivative of the inverse: https://math.stackexchange.com/questions/1471825/derivative-of-the-inverse-of-a-matrix
# Derivative of the pseudoinverse:
https://math.stackexchange.com/questions/2179160/derivative-of-pseudoinverse-with-respect-to-original-matrix
https://mathoverflow.net/questions/25778/analytical-formula-for-numerical-derivative-of-the-matrix-pseudo-inverse
@yig
yig / httpserver.jl
Last active Mar 28, 2018
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) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
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.
URL: https://gist.github.com/yig/f65e86b7730019d4060449f24342fcb4
=#
using HttpServer
using Base.Filesystem
@yig
yig / controlc_pipeline.py
Last active Jan 13, 2018
How to handle control-C when piping output to tee from Python.
View controlc_pipeline.py
# Run with
## python -u controlc_pipeline.py | 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 controlc_pipeline.py | tee -i foo.out
from __future__ import print_function, division
@yig
yig / DMAT2MATLAB.py
Created Aug 10, 2017
Convert a libigl DMAT to a Matlab .mat file.
View DMAT2MATLAB.py
#!/usr/bin/python
# Convert a libigl DMAT to a Matlab .mat file.
# 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/0fb7fe73b2ce914c4b1d6de3b4e4ba01
from __future__ import print_function, division
from numpy import *
@yig
yig / get_icloud_note
Created Jan 28, 2017
Command line program to get the contents of a Notes.app note
View get_icloud_note
#!/bin/bash
# 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/76e87324ca1e9c754e8f28a8ef294dd0
usage()
{
echo 1>&2 "Usage:" "$0" '<Notes.app note name>'
exit -1
@yig
yig / trim-together.py
Last active May 22, 2017
Applies imagemagick's -trim to a set of images, but applies the same crop to all of them together (making sure to cut nothing untrimmable off from any)
View trim-together.py
#!/usr/bin/env python
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
Description: Applies imagemagick's -trim to a set of images, but applies the same crop to all of them together (making sure to cut nothing untrimmable off from any).
URL: https://gist.github.com/yig/7770ec597c595ae4bf1d0de4ca5a65cf
'''
from __future__ import print_function, division
@yig
yig / PNG colorspace experiments
Created Oct 31, 2016
What happens when you create a PNG with and without sRGB or linear RGB colorspace headers?
View PNG colorspace experiments
## Make a 5 pixel gradient PNG with no header: 0, 64, 128, 191, 255.
## Save the values with PIL (Python Image Library). PIL does not store a header.
python make_png.py
'''
from numpy import *
from PIL import Image
N = 5
arr = zeros( (1,N,3) )
arr[:] = linspace(0,1,N)[newaxis,:,newaxis]
@yig
yig / cffi_asarray.py
Last active Mar 2, 2018
An `asarray` function that wraps a cffi pointer in a numpy.array.
View cffi_asarray.py
'''
Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
Description: An `asarray` function that wraps a cffi pointer in a numpy.array.
URL: https://gist.github.com/yig/77667e676163bbfc6c44af02657618a6
'''
from __future__ import print_function, division
import numpy
You can’t perform that action at this time.