Skip to content

Instantly share code, notes, and snippets.

View KristoforMaynard's full-sized avatar

Kristofor Maynard KristoforMaynard

View GitHub Profile
@KristoforMaynard
KristoforMaynard / imayavi.py
Last active June 6, 2019 08:45
Mayavi tools for ipython notebooks
# -*- coding: utf-8 -*-
"""Make Mayavi plots inline to ipython notebooks
Imports mayavi and mlab and adds them to interpreter namespace. Loading
this extension also sets up inline matplotlib (aka `%matpotlib inline`)
and sets offscreen rendering on linux.
Note:
Offscreen rendering on OS X doesn't seem to work, but on linux,
inline plots don't work without offscreen rendering. "Don't work"
@KristoforMaynard
KristoforMaynard / iembedmedia.py
Created August 19, 2015 16:15
Embed raw media in an ipython notebook
# -*- coding: utf-8 -*-
"""Embed raw media in an ipython notebook
The point of embedding raw media is that one can save as html, and
the media will automatically be embedded in the result.
Installation:
Place in ~/.ipython/extensions/, or wherever your extensions live.
Note: If the notebook server is not local, then embedding media may
#!/usr/bin/env python
"""Serve up an image from a music file
Install:
I highly recomend running this script with py3k since it has better
unicode support.
On a Raspbery Pi:
#!/usr/bin/python
#
# retrieved from:
# https://github.com/ocelma/python-itunes/blob/e3adf9e837ccbf9ded9d7352ad8e45b56ab410eb/itunes/__init__.py
#
# edited by KristoforMaynard@github to be python 3 compliant and add
# :py:class:`EmptyReturner`, :py:class:`ResultWrapper`, and :py:func:`wrap_results`
"""A python interface to search iTunes Store"""
from __future__ import division, print_function, unicode_literals
from __future__ import print_function
import sys
import textwrap
def format_heading(text, style="-"):
return "{0}\n{1}\n".format(text, style * len(text))
def format_table(names, descriptions, style="=", func_heading="Function ",
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>XPNAtoZ_Stats</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
We can't make this file beautiful and searchable because it's too large.
,artist,album,name,release date,release year,release month,release day,time played
0,Jackson 5,Jackson Five's Greatest Hits,ABC,,,,,2016-11-30 06:01:00
1,Elvis Presley,50 Million Elvis Fans Can't Be Wrong,A Big Hunk O' Love,,,,,2016-11-30 06:04:00
2,Johnny Cash,At San Quentin,A Boy Named Sue (live),1969-06-04,1969.0,6.0,4.0,2016-11-30 06:06:00
3,Joni Mitchell,Blue,A Case Of You,1971-06-22,1971.0,6.0,22.0,2016-11-30 06:10:00
4,Ernie K-Doe,Var-Best Of N.O. R&B Vol.1,A Certain Girl,,,,,2016-11-30 06:16:00
5,Warren Zevon,Bad Luck Streak In Dancing School,A Certain Girl,1980-02-15,1980.0,2.0,15.0,2016-11-30 06:19:00
6,Sheryl Crow,Sheryl Crow,A Change,1996-09-24,1996.0,9.0,24.0,2016-11-30 06:24:00
7,Sam Cooke,The Man And His Music,A Change Is Gonna Come,1986-02-01,1986.0,2.0,,2016-11-30 06:28:00
8,The Beatles,Sgt. Pepper's Lonely Hearts Club Band,A Day In The Life,1967-06-01,1967.0,6.0,1.0,2016-11-30 06:31:00
@KristoforMaynard
KristoforMaynard / f2py_libgfortran_hack.py
Created November 7, 2017 17:38
Force f2py to discover libgfortran path
# the folloing gfortran hacks are to work around a treacherous bug when
# using anaconda + f2py (numpy) + a local gfortran on MacOS / Linux...
# in short, anaconda ships its own libgfortran to make numpy / scipy
# work, but this will conflict with some gfortran compilers...
# AND numpy assumes that `gfortran -print-libgcc-file-name` will give the
# path to libgfortran (it practice it doesn't on Debian / MacPorts)... SO
# we let numpy discover the path to libgfortran using
# `gfortran -print-file-name=libgfortran.so` (or dylib) because that will
# give us the correct link path, and fortran code that we compile with f2py
# will be correctly linked to the lib supplied by OUR compiler
{
"schema_version": "3.0.0",
"repositories": [
"https://gist.github.com/KristoforMaynard/6804f526f97504d9dd123f4c090624e1/raw/packages.json"
]
}
#!/usr/bin/env python
"""Install a new package into an anaconda environment and copy new
entries in Anaconda's cache to ``./conda-cache/``. You can bring
``./conda-cache`` to an air-gapped computer and install the packages
using
$ conda install --offline --use-local --use-index-cache conda-cache/*
Note: