Skip to content

Instantly share code, notes, and snippets.

View bufke's full-sized avatar

David Burke bufke

View GitHub Profile
@bufke
bufke / Dockerfile
Created October 1, 2015 21:23
GeoDjango with docker-compose
FROM python:3.4
ENV PYTHONUNBUFFERED 1
RUN apt-get update ; apt-get --assume-yes install binutils libproj-dev gdal-bin
RUN wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
RUN tar -xjf geos-3.4.2.tar.bz2
RUN cd geos-3.4.2; ./configure; make; make install
RUN wget http://download.osgeo.org/gdal/1.11.0/gdal-1.11.0.tar.gz
RUN tar -xzf gdal-1.11.0.tar.gz
@bufke
bufke / document_to_text.py
Last active May 28, 2023 13:31
Convert odt, doc, docx, pdf to text with python and some linux programs. Doesn't require Libreoffice.
from subprocess import Popen, PIPE
from docx import opendocx, getdocumenttext
#http://stackoverflow.com/questions/5725278/python-help-using-pdfminer-as-a-library
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from cStringIO import StringIO
@bufke
bufke / insert_hashes.py
Last active December 10, 2015 20:48
For migrating zentyal 2.2 to 3.0 user ldap attributues
import base64
import binascii
import subprocess
import sys
# Set these please!
sam_file = "/var/lib/samba/private/sam.ldb.d/DC\=ZENTYAL\,DC\=EXAMPLE\,DC\=ORG.ldb"
user_dn = "ou=Users,dc=zentyal,dc=example,dc=org"
samba_dn = 'CN=Users,DC=zentyal,DC=example,DC=org'
base_dn = "dc=zentyal,dc=example,dc=org"