Skip to content

Instantly share code, notes, and snippets.

View dli7319's full-sized avatar

David Li dli7319

View GitHub Profile
@dli7319
dli7319 / aen1.txt
Last active September 14, 2023 02:17
Anki Card Creation Aeneid
Arma virumque canō, Trōiae quī prīmus ab ōrīs
Ītaliam, fātō profugus, Lāvīniaque vēnit
lītora, multum ille et terrīs iactātus et altō
vī superum saevae memorem Iūnōnis ob īram;
multa quoque et bellō passus, dum conderet urbem,
inferretque deōs Latiō, genus unde Latīnum,
Albānīque patrēs, atque altae moenia Rōmae.
Mūsa, mihī causās memorā, quō nūmine laesō,
quidve dolēns, rēgīna deum tot volvere cāsūs
// ==UserScript==
// @name Google Colab Touch
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Clicks a button on the colab editor to keep it connected.
// @author You
// @match https://colab.research.google.com/*
// @grant none
// ==/UserScript==
@dli7319
dli7319 / spherical_helpers.py
Last active June 16, 2020 19:20
Useful functions for dealing with spherical equirectangular images in python + numpy
import numpy as np
def spherical_to_cartesian(theta, phi, r=None):
"""
Spherical to cartesian
:param theta: value or array between 0 and 2*pi
:param phi: value or array between 0 and pi
:return: array or nx3 array
"""
if type(theta) is list:
@dli7319
dli7319 / save_png.h
Last active October 30, 2019 18:40
Use FFMpeg to load or save a PNG
#pragma once
#include <cstdio>
#include <fstream>
#include <iostream>
#include <string>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>