Skip to content

Instantly share code, notes, and snippets.

View leingang's full-sized avatar

leingang

  • Department of Mathematics, Courant Institute of Mathematical Sciences, New York University @nyumathclinic
  • New York, New York
View GitHub Profile
@leingang
leingang / README.md
Last active May 9, 2024 13:10
Overleaf and Brightspace synchronization with git and Google Drive

Overleaf and Brightspace synchronization with git and Google Drive

Problem

We use Overleaf for collaboratively editing LaTeX documents. But Overleaf does not expose the compiled PDFs with a URL. This means to publish documents written on Overleaf, the PDF needs to be downloaded from Overleaf and uploaded to Brightspace.

  • One copy of the PDF is made for each Brightspace site (section) that publishes it
  • Any changes to the document need to be propagated to all copies
  • The name of the downloaded file is the project name, not the document name.
@leingang
leingang / nyu_colors.py
Last active March 14, 2024 20:06
The NYU Color Palette
from enum import Enum
NYU_VIOLET = "#57068c"
ULTRA_VIOLET = "#8900e1"
MEDIUM_VIOLET1 = "#702b9d"
MEDIUM_VIOLET2 = "#7b5aa6"
LIGHT_VIOLET1 = "#ab82c5"
LIGHT_VIOLET2 = "#eee6f3"
DEEP_VIOLET = "#330662"
BLACK = "#000000"
@leingang
leingang / colab-gdrive.py
Last active March 12, 2024 13:30
Allow a Google Colaboratory Jupyter Notebook to access Google Drive files
from pydrive2.auth import GoogleAuth
from pydrive2.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
@leingang
leingang / ssh-lpr.sh
Last active February 6, 2024 14:12
Print to CIMS printers with stapling (bypassing Pharos)
ssh leingang@access.cims.nyu.edu lpr -P mf-07 -\\# 25 -o ColorMode=Gray -o StapleLocation=UpperLeft < file.pdf
@leingang
leingang / gist:3aa194c0de590dbbdc238c8f353875c9
Last active July 9, 2022 14:40 — forked from davidwebca/gist:e26186b8f4c6795b19c043fffb6f9861
Detect black screen and split with ffmpeg remux
#!/bin/bash -x
# Splits video to separate scenes files when full black frames are found in the video
# Forked from https://gist.github.com/davidwebca/e26186b8f4c6795b19c043fffb6f9861
# Inspired by https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e
# Who got inspired by https://stackoverflow.com/a/38205105
file=""
out="."
dur=2.00
@leingang
leingang / .gitignore
Last active November 22, 2021 03:02
Test of l3build doc with supporting images
build/
*.log
*.aux
foo.pdf
/**
* Duration and Lap Calculations
* Matthew Leingang (https://github.com/leingang)
* 2018-09-15
*
* I want to be able to enter the number of laps and get the duration,
* or the duration and get the number of laps. To go one way only
* requires a formula, but to go both ways requires a script.
*/
@leingang
leingang / AMC-install-1.2.sh
Created May 8, 2018 16:53
Roll back AMC to 1.2 with macports
#!/bin/bash
# Install version 1.2.8 of auto-multiple-choice, with some patches
# (C) 2018 Akim Demaille and Matthew Leingang
#
# See https://project.auto-multiple-choice.net/boards/2/topics/6301
#
# UNTESTED
cd /tmp
git clone --single-branch https://github.com/macports/macports-ports.git
@leingang
leingang / gist:c49cbf37100ecbb6e2f58ca7761ef712
Last active October 26, 2017 13:37
How to change @inc to point to a relative directory
use File::Basename qw(dirname);
use FindBin qw($Bin);
use lib dirname($Bin) . '/lib';
\documentclass[png]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
% See http://tex.stackexchange.com/questions/276935/tikz-projection-parallel-to-given-line
\makeatletter
\tikzset{/tikz/parallel cs/.cd,
to line initial coordinate/.store in=\tikz@parallelcs@toA,
to line final coordinate/.store in=\tikz@parallelcs@toB,