Skip to content

Instantly share code, notes, and snippets.

View jbants's full-sized avatar

James Banting jbants

View GitHub Profile
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active March 20, 2024 08:12
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@sgillies
sgillies / geo_interface.rst
Last active July 9, 2024 15:21
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 16, 2024 16:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@springmeyer
springmeyer / mapnik-python-layer-access.py
Created August 23, 2012 16:51
Mapnik python example: load a map XML from a string and introspect the layers data
>>> import mapnik
>>> m = mapnik.Map(256,256)
>>> map_string = '''
... <Map>
... <Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
... <Datasource>
... <Parameter name="inline">
... x,y,name
... 0,0,foo
... 1,1,foo
@glarrain
glarrain / gist:3982485
Created October 30, 2012 19:37
Decode session data, no matter what hashes say. It helps in some cases where the Session.get_decoded method returns an empty dictionary because it is "suspicious" of user-data tampering. Based on source code from the Django project.
import base64
import pickle
from django.contrib.sessions.models import Session
from django.utils.encoding import force_unicode
def decode_session_data(session_key):
"""Decode the data in a session object stored under ``session_key``.
@plentz
plentz / nginx.conf
Last active July 17, 2024 09:16
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@clhenrick
clhenrick / README.md
Last active April 1, 2024 14:55
PostgreSQL & PostGIS cheatsheet (a work in progress)
@gka
gka / make-tile-urls.py
Last active August 26, 2022 06:27
python script to generate a list of projected tiles
#
# you might want to run this first:
#
# pip install pyproj mercantile
#
from pyproj import Proj
import mercantile
mercator = Proj('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +over +no_defs')
albers = Proj('+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=sphere +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +nadgrids=@null')
@jqtrde
jqtrde / modern-geospatial-python.md
Last active August 1, 2023 14:50
Modern remote sensing image processing with Python
@greinacker
greinacker / pythonista-install-boto.py
Created February 9, 2016 22:06 — forked from najibninaba/pythonista-install-boto.py
Pythonista script for installing boto
# Source: https://gist.github.com/najibninaba/5062153
#
# This script installs Boto in Pythonista. Run this script in your root folder and it will download and install Boto along with its
# dependencies. To use Boto, be sure to add boto-module in your sys.path before importing boto like so:
# import sys; sys.path.append('boto-module')
# import boto.ec2
#
# Credits:
# This script is inspired by omz's Evernote Installer script: https://gist.github.com/omz/5048588
#