Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@chsasank
chsasank / ipynb_to_gallery.py
Last active February 21, 2024 14:29
Convert jupyter notebook to sphinx gallery notebook styled examples.
@parente
parente / README.md
Last active May 25, 2016 17:20
All-In-One Jupyter Notebook to Jupyter Dashboard Server
@hhuuggoo
hhuuggoo / meta.yaml
Created April 15, 2015 15:26
simplest conda recipe for pure python package (without setuptools!)
package:
name: examplepackage
version: "1.0"
@akimd
akimd / ipynbdoctest,py
Created October 27, 2014 08:19
Same as https://gist.github.com/minrk/2620735, but with a context diff display of mismatches
#!/usr/bin/env python
"""
simple example script for running and testing notebooks.
Usage: `ipnbdoctest.py foo.ipynb [bar.ipynb [...]]`
Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook.
"""
from __future__ import print_function
@martijnvermaat
martijnvermaat / gitlab-ipython-notebook.md
Last active May 8, 2023 00:53
View IPython notebooks in GitLab

Viewing IPython notebooks in GitLab

GitLab is open source software to collaborate on code (a GitHub clone to run on your own server). Clicking a blob (a file in a repository) in GitLab shows a nice rendering if GitLab supports the file type (e.g., images, Markdown documents), or its content as plain text otherwise. The patch described here adds support to GitLab for rendering IPython notebooks (.ipynb files).

import IPython.core.display
import matplotlib as mpl
def clean():
# set mpl defaults for nice display
mpl.rcParams['font.size'] = 12
mpl.rcParams['figure.figsize'] = (18, 6)
mpl.rcParams['lines.linewidth'] = 1
@thearn
thearn / gzip_pickle.py
Created April 20, 2013 00:57
Functions for saving and loading python objects using pickle with gzip compression.
import pickle
import gzip
def save(object, filename, protocol = 0):
"""Saves a compressed object to disk
"""
file = gzip.GzipFile(filename, 'wb')
file.write(pickle.dumps(object, protocol))
file.close()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.