Skip to content

Instantly share code, notes, and snippets.

@maltefiala
maltefiala / Create Issuelist
Last active September 5, 2015 11:07
Create Github Issuelist
import json
with open('issuelist_json') as json_data:
myjson = json.load(json_data)
for issue in myjson:
print("- [ ]", "[" + issue["title"] + "](" + issue["html_url"], ")" )
@maltefiala
maltefiala / CherryPy Writing Uploads
Last active August 29, 2015 14:27
CherryPy Writing Uploads
#!/bin/env python3.4
# mainly copied from https://cherrypy.readthedocs.org/en/3.2.6/progguide/files/uploading.html
import os
localDir = os.path.dirname(__file__) # current working directory
absDir = os.path.join(os.getcwd(), localDir) # os.getcwd() : Return a string representing the current working directory.
import cherrypy
// requires jQuery
$(function clickToActivate() {
$(".videoplaceholder" ).click(function() {
var videourl = $( this ).attr( "videourl" );
$( this ).replaceWith( '<iframe src="' + videourl + '" frameborder="0"></iframe>' );
});
});
// CODE FOR CSS
@maltefiala
maltefiala / print2pdf.el
Last active September 28, 2022 10:23
emacs print-to-pdf on OSX
;; Adapted following script to OSX:
;; https://genomeek.wordpress.com/2013/03/08/emarch-2-create-a-pdf-with-highlighted-code-source/
(defun print-to-pdf ()
(interactive)
(ps-spool-buffer-with-faces)
(switch-to-buffer "*PostScript*")
(write-file "tmp.ps")
(kill-buffer "tmp.ps")
(setq cmd (concat "pstopdf tmp.ps -o " (buffer-name) ".pdf"))
(shell-command cmd)
import argparse
import configparser
# Parse the command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='the name of the config file')
args = parser.parse_args()
# Parse the input data
config = configparser.ConfigParser()