Skip to content

Instantly share code, notes, and snippets.

View mwouts's full-sized avatar

Marc Wouts mwouts

View GitHub Profile
@mwouts
mwouts / Debug Jupyter notebooks in Pycharm.md
Last active December 9, 2022 16:47
2018-06 Debug Jupyter notebooks with PyCharm

Did you ever had to debug some large cell in a Jupyter notebook? In the below I share my experience on the subject. We'll review the classical methods for debugging notebooks, and finally I'll show how to set breakpoints in PyCharm for code being execute in a jupyter notebook, and benefit of the comfort of a real Python IDE for debugging.

Debug in the notebook

Before I actually describe what Pycharm can do, we quickly review the jupyter commands for debugging.

Catch exceptions

@mwouts
mwouts / jupytext_13.md
Last active February 2, 2020 07:51
New in Jupytext 1.3

What's new in Jupytext 1.3?

Jupytext's Word Cloud

The image was generated with the wordcloud package - see this notebook.

We are also looking for a logo for Jupytext. Please let us know if you can help!

@mwouts
mwouts / jupyter_notebook_config.py
Last active September 22, 2020 13:25
A save hook for Jupyter that automatically exports notebooks as slides
"""This is a save hook for Jupyter that automatically exports your notebook to reveal slides,
every time you save it, if
- it has at least one cell with a "slideshow" metadata
- and if the notebook is not `Untitled...`
Add the following to your `.jupyter/jupyter_notebook_config.py` file:
(source: https://gist.github.com/mwouts/04a6dfa571bda5cc59fa1429d130998f )
"""
import io
@mwouts
mwouts / _introducing_itables.md
Last active February 12, 2024 13:14
Pandas DataFrames as interactive HTML DataTables

Pandas DataFrames as interactive HTML DataTables

In Jupyter Notebook, Jupyter Lab, Google Colab, VS Code and PyCharm

Pandas DataFrames are central to Data Analysis in Python. In this post, we introduce the itables Python package that enhances how these DataFrames are displayed, by turning them into interactive HTML DataTables.


Using itables is as simple as

@mwouts
mwouts / mp4concat.py
Last active June 25, 2022 22:09
Lossless concatenation of MP4 files using ffmpeg (H.264 video and AAC audio)
"""
This is a script that concatenates mp4 files using the method recommended at
https://trac.ffmpeg.org/wiki/Concatenate, i.e. it does the equivalent of
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
To run this script, execute
python mp4concat input1.mp4 input2.mp4 ... --output output.mp4
in a Python environment in which 'click' is installed (execute 'pip install click' otherwise)
@mwouts
mwouts / Itables demo.gif
Last active April 22, 2023 08:47
ITables demos
Itables demo.gif