Skip to content

Instantly share code, notes, and snippets.

@yig
yig / qpsolver.h
Last active September 23, 2024 16:21
A tiny Eigen OSQP wrapper.
#pragma once
/*
Description: A tiny Eigen OSQP wrapper.
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/f8fb55fc37dbc11c4fc60cbca77b7dc7
*/
#include <Eigen/Dense>
@yig
yig / update_mactex.md
Created August 9, 2018 21:23
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: http://www.tug.org/mactex/

  3. Save list of default packages:

@yig
yig / autonirf.py
Last active July 17, 2024 10:26
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 / Latex space saving tricks
Last active July 8, 2024 06:44
Latex space saving tricks
%% Make everything look better.
%% http://tex.stackexchange.com/questions/553/what-packages-do-people-load-by-default-in-latex
%% http://www.howtotex.com/packages/9-essential-latex-packages-everyone-should-use/
\usepackage{microtype}
%% Shrink space around figures.
%% This beats manually adding negative \vspace commands everywhere.
%\setlength{\textfloatsep}{0pt}
%\setlength{\textfloatsep}{20pt plus 2pt minus 4pt}
%\setlength{\textfloatsep}{10pt plus 2pt minus 4pt}
@yig
yig / sig2text.py
Last active May 2, 2024 05:00
Converts a PDF file assumed to be a two-column ACM or CGF 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 / JavaScript reference.md
Last active April 21, 2024 23:36
An overview of JavaScript best practices. Geared towards someone with a C/C++/Java/Python background.

JavaScript reference for non-JavaScript programmers

Author: Yotam Gingold
License: Public Domain (CC0)

This document is intended as a reference or introduction to JavaScript for someone familiar with a language like C/C++/Java or Python. It follows best practices and gathers the scattered wisdom from matny stackoverflow questions and in-depth JavaScript essays. It relies on no external libraries.

@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 / wrapfigure_without_whitespace.tex
Created May 17, 2016 04:39
Eliminate white space around wrapfigure environments in LaTeX.
%% The typical answer for how to eliminate white space in wrapfigure doesn't work for me (I'm using a SIGGRAPH style sheet):
%% http://tex.stackexchange.com/questions/111393/too-much-space-around-wrap-figure
%% Instead, let's just offset the image.
%% The horizontal white space is \columnsep and the vertical white space is \intextsep.
%% Subtract them from the column width and offset the image accordingly.
%% How to move an image:
%% http://tex.stackexchange.com/questions/107340/how-to-shift-graphics-adjust-placement-of-figure-with-includegraphics
\begin{wrapfigure}[11]{R}{1in - .75\columnsep}
%\centering
\vspace{-\intextsep}
@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: