Last active
February 5, 2021 01:21
-
-
Save fish8/49dddc7f598fe526246f9d9a869957d7 to your computer and use it in GitHub Desktop.
jupyter notebook code search and print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pynb-code, show all codes in a jupyter notebook | |
jq -j '.cells | map( select(.cell_type == "code") | .source +["\n\n"]) | .[][] ' $@ | |
#beautify code in notebook and copy to clipboard as rich text | |
pynb-code xxx.ipynb |pygmentize -f rtf | xclip -t text/rtf -selection clipboard | |
#find print | |
find . -name "*.ipynb" -exec pynb-code {} + | |
#find grep | |
find . -name "*.ipynb" -print|xargs -n1 -I% nbgrep 'sstool' % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment