Skip to content

Instantly share code, notes, and snippets.

View tbnorth's full-sized avatar

Terry Brown tbnorth

View GitHub Profile
MapServer Mapnik GeoServer GeoNode CKAN GeoNetwork
Render maps Y Y Y < N
Serve WMS Y ? Y < N
Serve WFS Y ? Y < N
Serve WFS-T ? ? Y < N
Render tiles Y Y Y ? N
Catalog data N N N ? Y Y
Publish metadata N N N? ? Y Y
Harvest metadata N N N ? Y Y
@language unknown_language
#!/bin/sh
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes
if git diff-index --cached --quiet HEAD --ignore-submodules -- ; then
echo Version info script sees nothing to do
exit
fi
@tbnorth
tbnorth / gist:383d2ccd0f7605fa87ed
Last active August 29, 2015 14:07
Review entire git commit history of a file, for security issues, passwords, sensitive information, etc.

Say you want to push a git repo. that you've been working on privately to a publicly viewable place, how do you review not just the current working copy / HEAD for sensitive information, but the whole history of files that might contain details you don't want to make public? Something like this seems reasonably efficient:

git log --patch --reverse path/to/file.py | grep '\(^+\|^commit\)'| sed 's/^+//'

Including only lines starting with "+" or "commit" shows you only what's added to the file. As long as you start at the beginning, the deletions (lines starting with "-") and context (everything else) don't matter.

Deleting the '+' at the beginning of each line means you can dump the output from the above into your favorite editor to get syntax highlighting, which perhaps makes it easier to read. You might need to use a temporary file with an appropriate extension, e.g.:

git log --patch --reverse path/to/file.py | grep '\(^+\|^commit\)'| sed 's/^+//; s/^commit/#commit/' >delme.py
@tbnorth
tbnorth / vb_register_drive.py
Last active August 29, 2015 14:19
vbox error
# The problem seems to be that createhd / storageattach do not register the
# media in any media registry, so non-standard media locations aren't
# findable.
#
# The quick hack vb_register_drive.py below can be used to register the media in
# either Virtualbox.xml or the .vbox file of a machine, and then everything works.
# vb_register_drive.py is a quick and dirty hack with lots of assumptions
# this is my recipe for making a vm on a headless machine which fails as seen
# below
@tbnorth
tbnorth / showsel.sh
Created July 7, 2015 18:13
show selection / clipboard content
while true; do
echo
for thing in primary secondary clip-board; do
echo $thing
text=$(xclip -out -selection $thing 2>/dev/null || echo N/A)
echo " " ${text:0:40}
done
sleep 1
done
@tbnorth
tbnorth / 00_cleanup.rst
Last active September 29, 2015 15:00
Clean up "incremental" (--link-dest) rsync backups

Backups with rsync's --link-dest are great, they let you keep backup daily versions of files with instant file level access while being fast and relatively space efficient.

The code below prunes duplicates etc. from large collections of --link-dest based incremental backups when the overhead of the directory structure etc. starts to consume too much space.

@tbnorth
tbnorth / gist:5530059
Last active December 17, 2015 01:39
My leo-editor @settings / @DaTa abbreviations (first) and @settings / @DaTa abbreviations-subst-env (second)
# Comments lines (lines starting with '#') are ignored.
# Non-comment lines should have the form::
#
# name=definition
# Definitions in @data abbreviation nodes override definitions in @data
# global-abbreviation nodes. Typically you would define @data abbreviation nodes
# in myLeoSettings.leo
# jump to and select next placeholder
@tbnorth
tbnorth / gist:6157834
Created August 5, 2013 17:39
Randomize letters and digits in a Leo (http://leoeditor.com/) subtree, best installed as a @button node.
# WARNING - no undo
# randomize letters and digits in a subtree to allow sensitive
# information to be used in examples of Leo usage (http://leoeditor.com/)
from random import sample
from string import lowercase, uppercase, digits
def blur(s):
s = [sample(lowercase, 1)[0] if i in lowercase else
sample(uppercase, 1)[0] if i in uppercase else
@tbnorth
tbnorth / gist:6165576
Last active December 20, 2015 16:59
Webkit free-layout pane provider for Leo (http://leoeditor.com/)
from PyQt4 import QtGui, QtWebKit, QtCore, Qt
from PyQt4.QtCore import Qt as QtConst
class WebKitPaneProvider:
ns_id = '_add_tmce_pane'
def __init__(self, c):
self.c = c
# Careful: we may be unit testing.
if hasattr(c, 'free_layout'):
splitter = c.free_layout.get_top_splitter()
@tbnorth
tbnorth / pywarp.py
Last active December 25, 2015 07:19
pywarp.py, warp / teleport / relocate / move mouse / pointer / cursor when it's moved over / enters an invisible window / region of the screen / display.
"""
pywarp.py, Terry Brown, terry_n_brown@yahoo.com, Fri Oct 11 12:07:50 2013
Warp / teleport / relocate / move mouse / pointer / cursor when it's
moved over / enters an invisible window / region of the screen / display.
Can be used to override physical monitor layout. I have three
monitors, 2 x 1680x1050, and one 1920x1080. I'd like them laid out
out left to right 1680x1050 1920x1080 1680x1050 but the graphics
cards I'm using can't render across that total width, so instead