Skip to content

Instantly share code, notes, and snippets.

@whophil
whophil / scipy-from-euler-convention.ipynb
Created November 23, 2022 18:32
Extrinsic/intrinsic convention swapped in `scipy.spatial.transform.Rotation.from_euler()` ?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whophil
whophil / pintfield.py
Created March 3, 2022 00:36
PintField implementation for uMongo
import collections
from marshmallow import ValidationError
from umongo.fields import BaseField
import numpy as np
from json import JSONEncoder
from ..._units import units as units_quantity
@whophil
whophil / daylight-derivatives.ipynb
Last active January 15, 2021 03:38
Computing derivatives of daylight hours
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whophil
whophil / jupyter.service
Last active October 30, 2023 16:33 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@whophil
whophil / config.xml
Last active November 19, 2020 20:32
KVM XML configuration file for Windows 8 HTPC with VGA, USB controller passthrough on ASRock FM2A78M-ITX.
<domain type='kvm' id='1'>
<name>Win8-HTPC-OVMF</name>
<uuid>a2c7ea78-f49a-ef5b-6b16-521d098d40c9</uuid>
<metadata>
<vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
</metadata>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<memoryBacking>
<nosharepages/>
@whophil
whophil / recursive_glob.py
Last active August 2, 2018 02:55
Recursive glob in Python: Find all files matching a glob-style pattern. Adapted from http://stackoverflow.com/a/2186565/6191541
import os
import fnmatch
def recursive_glob(rootdir='.', pattern='*'):
"""Search recursively for files matching a specified pattern.
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
"""
matches = []
@whophil
whophil / jupyter-style.ipynb
Last active November 27, 2021 09:40
Pretty style for Jupyter notebooks using Google web-fonts. Apply to all your notebooks using %run magic.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whophil
whophil / git-latexdiff.sh
Last active April 17, 2016 02:27 — forked from arthurd2/git-latexdiff.sh
Produces a diff PDF of a LaTeX repo against a specified hash using latexdiff.
#!/usr/bin/env bash
# Shell script to run latexdiff against the same file from a specified commit hash.
# Example:
# ./git-latexdiff.sh main.tex 12dfa1a
# $1 is the name of the old tex file (relative to the remote repo)
# $2 is the hash of the commit that we'd like to compare against
@whophil
whophil / conf.py
Last active April 11, 2016 15:52
Configuration for Sphinx readthedocs html theme.
# requires sphinx_rtd_theme to be installed on the build machine
# $ pip install sphinx_rtd_theme
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
@whophil
whophil / conf.py
Last active April 11, 2016 15:51
Sphinx extensions: autodoc, napoleon
sys.path.insert(0, os.path.abspath('.'))
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'nbsphinx'
]