Skip to content

Instantly share code, notes, and snippets.

View robertmaxwilliams's full-sized avatar
💭
student

Robert robertmaxwilliams

💭
student
View GitHub Profile
@bayerj
bayerj / gist:4131398
Created November 22, 2012 14:19
ipython save image with pillow and display
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)
@alonho
alonho / flask_pdb.py
Created December 27, 2012 15:40
Flask: drop into pdb on exception
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)
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* 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%;
}
@mortenpi
mortenpi / handle_segfault.c
Last active March 2, 2023 01:41
Recover gracefully from a segmentation fault (SIGSEGV) in C due to invalid pointer.
/*
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>