Skip to content

Instantly share code, notes, and snippets.

@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@jbwhit
jbwhit / 2017-03-USC-Career-Conference-Supplementary.md
Last active May 17, 2017 18:33
Here are the supplementary materials for my USC Career Conference Keynote.
anonymous
anonymous / pca_animation.m
Created January 26, 2017 21:47
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@nathanielatom
nathanielatom / bokeh_audio_player.py
Last active January 18, 2024 05:53
Custom Bokeh Model for audio playback (along with a sample plot that has a playback span cursor).
# encoding: utf-8
import bokeh.models as bkm
import bokeh.core as bkc
from bokeh.util.compiler import JavaScript
class AudioPlayerModel(bkm.layouts.Column):
"""
Audio player using https://howlerjs.com/.
@soxofaan
soxofaan / README.md
Last active May 2, 2025 22:26
Simple pretty CSV and TSV file viewer.
@kastnerkyle
kastnerkyle / fancy_youtube_encode.sh
Last active April 23, 2024 06:22
Fancy encoding of a wav file (or possibly others in the future) to youtube format
# Based on example here https://trac.ffmpeg.org/wiki/Encode/YouTube
text=$(basename $1 .wav)
ffmpeg -i $1 -filter_complex \
"[0:a]avectorscope=s=640x518,pad=1280:720[vs]; \
[0:a]showspectrum=mode=separate:color=intensity:scale=cbrt:s=640x518[ss]; \
[0:a]showwaves=s=1280x202:mode=line[sw]; \
[vs][ss]overlay=w[bg]; \
[bg][sw]overlay=0:H-h,drawtext=fontfile=/usr/share/fonts/truetype/fonts-japanese-gothic.ttf:fontcolor=white:x=10:y=10:text=$text[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy $text.mkv
@pjbull
pjbull / jupyter_notebook_config.py
Last active November 13, 2023 20:17
Create .py and .html on save of Jupyter notebook
import os
import re
from nbconvert.nbconvertapp import NbConvertApp
from nbconvert.postprocessors.base import PostProcessorBase
class CopyToSubfolderPostProcessor(PostProcessorBase):
def __init__(self, subfolder=None):
self.subfolder = subfolder
@kokes
kokes / Issue_2697.ipynb
Created March 9, 2016 00:28
Testing pandas issue #2697
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbwhit
jbwhit / post-save-hook.py
Last active September 21, 2023 04:50
Saves Jupyter Notebooks as .py and .html files automatically. Add to the ipython_notebook_config.py file of your associated profile.
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py and .html files."""
if model['type'] != 'notebook':
return # only do this for notebooks
d, fname = os.path.split(os_path)
check_call(['jupyter', 'nbconvert', '--to', 'script', fname], cwd=d)
check_call(['jupyter', 'nbconvert', '--to', 'html', fname], cwd=d)