Skip to content

Instantly share code, notes, and snippets.

View lpinner's full-sized avatar

Luke Pinner lpinner

View GitHub Profile
@lpinner
lpinner / rerenamer.py
Last active August 23, 2019 21:51
Batch file renamer with regex and glob style searching
#!/usr/bin/python3
import os, sys
from urllib.parse import unquote, urlsplit
import fnmatch, re, sre_constants
from PyQt5 import uic
from PyQt5.QtCore import QObject, Qt
from PyQt5.QtWidgets import (
QWidget, QApplication, QDesktopWidget,
@lpinner
lpinner / setup.py
Last active April 7, 2016 02:28
Simple usercustomize.py to set up separate site.USER_BASE directories for 32 and 64bit python installs on Windows
from setuptools import setup
long_description = '''Simple usercustomize.py to keep separate site.USER_BASE/USER_SITE directories for 32 and 64bit
python installs on Windows.
Only required if you're installing extension modules (compiled pyd/dll) to the user site-packages directory, i.e.:
python setup.py install --user
pip install --user somepackage
@lpinner
lpinner / rioarray.py
Last active May 18, 2018 09:19
rasterio and dask for multithreaded chunked raster operations
import numpy as np
import rasterio as rio
import dask
import dask.array as da
class RioDataset():
def __init__(self, filepath, band=1):
self.band = band
self.dataset = rio.open(filepath)
self.dtype = self.dataset.dtypes[band-1]
@lpinner
lpinner / wms-1.1.1-to-kml.xsl
Last active August 29, 2015 14:01
wms-to-kml
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is heavily modified by Luke Pinner (2014)
Originally from the ESIP-EDAC WMS to KML converter.
Which is copyright (c) 2009 Earth Data Analysis Center
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@lpinner
lpinner / grive-sync
Created August 30, 2013 01:02
Grive sync on file/folder changes using inotifywait. See https://github.com/Grive/grive and http://www.webupd8.org/2012/05/grive-open-source-google-drive-client.html for info about grive. In Ubuntu you can add the grive-sync script to your startup applications to have it automatically monitor your local Google Drive folder.
I now use google-drive-ocamlfuse (https://github.com/astrada/google-drive-ocamlfuse).
For installation instructions see - http://www.webupd8.org/2013/09/mount-google-drive-in-linux-with-google.html
If you want my grive-sync inotifywait script, see the previous revision of this gist.