Skip to content

Instantly share code, notes, and snippets.

Avatar

David Burke bufke

View GitHub Profile
@bufke
bufke / Dockerfile
Created Oct 1, 2015
GeoDjango with docker-compose
View Dockerfile
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 Jun 3, 2021
Convert odt, doc, docx, pdf to text with python and some linux programs. Doesn't require Libreoffice.
View document_to_text.py
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 Dec 10, 2015
For migrating zentyal 2.2 to 3.0 user ldap attributues
View insert_hashes.py
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"