Skip to content

Instantly share code, notes, and snippets.

Daniel Rech dmr

Block or report user

Report or block dmr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dmr / gist:c168646cdac49a108da7
Created May 21, 2014
random_reorder_pdf_file takes a PDF file as input and generates 30 pdfs with the same slides but in random order. Helpful to study
View gist:c168646cdac49a108da7
#!/usr/bin/env python
import sys
from pyPdf import PdfFileWriter, PdfFileReader
from random import shuffle
import sha
import os
def random_reorder_pdf_file(fn):
fn_base, ext = os.path.splitext(fn)
dmr /
Created Nov 4, 2013
The script accepts a glob pattern and prints the base64 encoded image on the commandline. Helpful to convert images to inline css
import base64
import glob
import argparse
import os
# fmt_str = u"define(function(){{return 'data:{mimetype};base64,{content}';}});"
fmt_str = u'"data:{mimetype};base64,{content}"'
dmr / gist:6120628
Created Jul 31, 2013
I have an improved version of to share. All you need in addition to this is one element for the modal <div class="modal fade" data-bind="modal: currentModal"> </div> somewhere on your page and then you open a dialog by writing to the currentModal observable and you close the dialog by nulling it: curre…
View gist:6120628
ko.bindingHandlers.modal = {
init: function(element, valueAccessor, allBindings, vm, context) {
var modal = valueAccessor();
//init the modal and make sure that we clear the observable no matter how the modal is closed
$(element).modal({show: false}).on("", function() {
if (ko.isWriteableObservable(modal)) {
You can’t perform that action at this time.