Skip to content

Instantly share code, notes, and snippets.

View ckolumbus's full-sized avatar
🐧
Live, Love, Code

Chris Drexler ckolumbus

🐧
Live, Love, Code
View GitHub Profile
@ckolumbus
ckolumbus / gist:2764461
Created May 21, 2012 20:29
Cherrypy Jinja handler
"""A Jinja Handler and tool. This code is in the public domain.
Adjusted for CherryPy 3.2
Usage:
@cherrypy.expose
@cherrypy.tools.jinja(template='index.html')
def controller(**kwargs):
return {
} # This dict is the template context
@ckolumbus
ckolumbus / waf.vim
Created March 14, 2014 09:29
waf build support settings for vim when used under Windows (not tested under Linux yet)
" add this to your vimrc or, if using [Project Addin](http://www.vim.org/scripts/script.php?script_id=69)
" you can use this file as in.vim
set makeprg=waf\ --notests
set shellpipe=2>&1\|tee
set errorformat=
"set errorformat+=%f(%l)\ :\ %t%*\\D%n:\ %m
"set errorformat+=%*[^\"]\"%f\"%*\\D%l:\ %m
"set errorformat+=%f(%l)\ :\ %m
"set errorformat+=%*[^\ ]\ %f\ %l:\ %m
@ckolumbus
ckolumbus / extract_pdf_comments.py
Created April 8, 2014 09:12
PDF Comment extraction with Python and PDFMIner
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdftypes import PDFObjectNotFound
pages = []
def extract(objid, obj):
global pages
if isinstance(obj, dict):
# 'Type' is PDFObjRef type
@ckolumbus
ckolumbus / register.py
Created April 8, 2014 12:33
Register/Unregister Python installations in Windows
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
import sys
@ckolumbus
ckolumbus / FOOBAR_main_template.py
Created April 9, 2014 15:03
Template for a main function in Python including optparse command line parsing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 20xx CKolumbus
# All rights reserved.
#
# This file is part of FOOBAR.
#
# FOOBAR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
from __future__ import absolute_import
from __future__ import unicode_literals
from urlparse import urljoin
from . import Extension
from ..treeprocessors import Treeprocessor
class AbsoluteImagesExtension(Extension):
""" Absolute Images Extension """
@ckolumbus
ckolumbus / tmux.conf
Created March 4, 2017 15:04 — forked from anonymous/tmux.conf
vim friendly tmux configuration
#Prefix is Ctrl-a
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
#Mouse works as expected ; not working with new tmux?
@ckolumbus
ckolumbus / build.sh
Created April 1, 2018 17:28
cake-build bash bootstrap script using dotnet core
#!/usr/bin/env bash
# based on https://github.com/devlead/BitbucketPipelinesShield/blob/master/build.sh
# c.f. https://github.com/cake-build/cake/issues/1751
##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
# CKolumbus: Remove dotnet-cli install section, assume sdk is installed
from enum import Enum
import json
def load_firefox_json(path, unique_tag, add_parent_folder_as_tag):
"""Open Firefox json export file and import data.
Ignore 'SmartBookmark' and 'Separator' entries.
Parameters
----------
@ckolumbus
ckolumbus / BrowserSelect_Example.reg
Created June 24, 2019 07:47
How to register portable browsers for use withy https://github.com/zumoshi/BrowserSelect
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable.exe]
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable.exe\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable.exe\shell\open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable.exe\shell\open\command]
@="C:\\PortableApps\\FirefoxPortable\\FirefoxPortable.exe"