Skip to content

Instantly share code, notes, and snippets.

View ianozsvald's full-sized avatar

Ian Ozsvald ianozsvald

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() }}
@ogrisel
ogrisel / ipynbhelper.py
Last active October 16, 2021 10:05
Hackish script to generate asciidoc from an IPython notebook JSON file.
"""Hackish script to convert a notebook into
Note that the content of markdown cells is not translated: it is assumed to
hold asciidoc content instead (even if it does not render correctly in the
browser editing the notebook file).
This script could be improved to use pandoc to handle the conversion instead.
Sample usage:
anonymous
anonymous / gs_sp_to_txt.sh
Created June 30, 2012 13:16
Google Speech to Text script
arecord -D plughw:1,0 -f cd -t wav -d 3 -r 16000 | flac - -f --best --sample-rate 16000 -o out.flac; wget -O - -o /dev/null --post-file out.flac --header="Content-Type: audio/x-flac; rate=16000" http://www.google.com/speech-api/v1/recognize?lang=en | sed -e 's/[{}]/''/g'| awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]; exit }' | awk -F: 'NR==3 { print $3; exit }'
@diogojc
diogojc / powerlaw.py
Created November 25, 2011 19:55
parameterizing and plotting Power Laws in python (Zipf example)
import numpy as np
def powerLaw(y, x):
"""
'When the frequency of an event varies as power of some attribute of that
event the frequency is said to follow a power law.' (wikipedia)
This is represented by the following equation, where c and alpha are
constants:
y = c . x ^ alpha