Skip to content

Instantly share code, notes, and snippets.

View jbants's full-sized avatar

James Banting jbants

View GitHub Profile
@jbants
jbants / app.py
Created August 25, 2016 03:42 — forked from rduplain/app.py
Add a second static directory to Flask, in ../static/.
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/base/<path:filename>')
def base_static(filename):
return send_from_directory(app.root_path + '/../static/', filename)
@jbants
jbants / r.hillshade.multi
Created January 16, 2017 22:47 — forked from maning/r.hillshade.multi
Creates a multidirectional, oblique-weighted, shaded-relief image from an input DEM image.
#!/bin/sh -x
############################################################################
#
# MODULE: r.hillshade.multi
#
# AUTHOR(S): Emmanuel Sambale esambale@yahoo.com emmanuel.sambale@gmail.com
# with comments and improvement from the GRASS user mailing list.
#
# PURPOSE: Creates a multidirectional, oblique-weighted, shaded-relief image
# from an input DEM image. Original ARC 6.0.1 GRID procedure was
@jbants
jbants / RemoteSensingImageClassification.py
Created March 25, 2018 22:44
Remote Sensing Image Classification with Python and Scikit-Learn
# ----------------------------------------------------------------------
# Remote Sensing Image Classification Workflow for Landsat data with soft
# voting on a SVM and Gradient Boosting classifier. Outlier in the
# training data are flagged through an Isolation Forest algorithm.
# Feature Selection is done by a Recursive Feature Elimination method.
# The results are classification and classification probability raster
# images in TIF format.
#
# Written by Dimo Dimov, MapTailor, 2017
# ----------------------------------------------------------------------
@jbants
jbants / condaenv.txt
Created July 24, 2018 18:32 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
@jbants
jbants / README-Template.md
Created November 18, 2018 03:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@jbants
jbants / python_environment_setup.md
Created November 18, 2018 21:49 — forked from wronk/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant