Skip to content

Instantly share code, notes, and snippets.

View gabraganca's full-sized avatar
🚀
going above and beyond

Gustavo Bragança gabraganca

🚀
going above and beyond
View GitHub Profile
@gabraganca
gabraganca / output_toggle_html.tpl
Last active February 15, 2017 17:37
Template to use with `ipython nbconvert` when generating HTML. With this, all input cell are hidden. Thanks @damianavila for the initial setup (http://www.damian.oquanta.info/posts/hide-the-input-cells-from-your-ipython-slides.html). I have also take some code from the `custom.css` of @olgablot published in http://nbviewer.ipython.org/5357268.
{%- extends 'full.tpl' -%}
{% block input_group -%}
<div class="input_hidden">
{{ super() }}
</div>
{% endblock input_group %}
{%- block header -%}
{{ super() }}
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@gabraganca
gabraganca / gist:7011378
Created October 16, 2013 17:13
Odd behavior with the ipython notebook and the matplotlib. When I call `%matplotlib inline` it overrides the size of of `figure.figsize' of my matplotlibrc.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@gabraganca
gabraganca / ipynb_rc.py
Last active December 20, 2015 20:08
Resources for the Ipython notebook
%matplotlib inline
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 16, 12 # that's default image size for this interactive session
plt.rcParams['figure.dpi'] = 100
plt.rcParams['axes.titlesize'] = 22
plt.rcParams['axes.labelsize'] = 18
plt.rcParams['lines.linewidth'] = 2
plt.rcParams['lines.markersize'] = 8
plt.rcParams['xtick.labelsize'] = 14
plt.rcParams['ytick.labelsize'] = 14
#!/usr/bin/env python
"""
Script for running and save notebooks from command line.
How to use: `ipynb_run_save.py foo.ipynb
Some tweaks over ipydoctest.py from minrk
by @damianavila
"""
def append(xs, yss):
return [[x] + ys for x in xs for ys in yss]
def make_lists(*xss):
if len(xss) == 1:
return [[x] for x in xss[0]]
h, t = xss[0], xss[1:]
return append(h, make_lists(*t))
import numpy as np
def create_list(list1, list2):
"""
list1 : N-dimensional list
list2 : 1-dimensional list
"""
return np.array([np.append(np.array(i), j) for i in list1 for j in list2])
@gabraganca
gabraganca / contour_plot
Last active December 17, 2015 12:59
Do a contour plot on a 3D array
import scipy.stats as st
import numpy as np
import matplotlib.pytlot as plt
def contour_plot(array3d, **kwargs):
"""
Do the contour plot of a X, Y, Z vector.
Parameters
----------
To get Git to diff between your odt/odp/ods files you will need to do the following things:
Install a conversion tool
$ sudo yum install odt2txt
Create your git config info directory if it's not already there
$ mkdir -p ~/.config/git/info
Add in attributes (you can paste this straight in or edit the file accordingly)
$ cat > ~/.config/git/info/attributes <<DELIM