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
/* | |
Credits to: | |
- https://linux.die.net/man/2/setcontext | |
- https://stackoverflow.com/questions/8456085/why-cant-i-ignore-sigsegv-signal | |
*/ | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <signal.h> |
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
/* | |
* I add this to html files generated with pandoc. | |
*/ | |
html { | |
font-size: 100%; | |
overflow-y: scroll; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
} |
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
def drop_into_pdb(app, exception): | |
import sys | |
import pdb | |
import traceback | |
traceback.print_exc() | |
pdb.post_mortem(sys.exc_info()[2]) | |
# somewhere in your code (probably if DEBUG is True) | |
flask.got_request_exception.connect(drop_into_pdb) |
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
from IPython.core.display import Image as image | |
from PIL import Image | |
def save_and_display(arr, fname): | |
pilimg = Image.fromarray(arr) | |
pilimg.save(fname) | |
return image(filename=fname, width=600) |