Skip to content

Instantly share code, notes, and snippets.

View pdbartsch's full-sized avatar

Paul Bartsch pdbartsch

  • UC Santa Barbara
  • 93455
View GitHub Profile
@pdbartsch
pdbartsch / process_landsat.sh
Last active March 23, 2017 20:13 — forked from andymason/Landsat 8 gdal processing
Landsat 8 gdal processing
#! /bin/bash
# Forked from: Andy Mason https://gist.github.com/andymason/6780828
# Convert Landsat 8 GeoTIFF images into RGB pan-sharpened JPEGs.
#
# Requirements:
# * gdal http://www.mapbox.com/tilemill/docs/guides/gdal/
# * convert (image-magick)
# * dans-gdal-scripts https://github.com/gina-alaska/dans-gdal-scripts
@pdbartsch
pdbartsch / gist:baeca4c85bda38dec84c5a566e9957d4
Last active April 11, 2016 23:02
OpenStreetMap Overpass, Quantum GIS
* cygwin64 to get wget on windows
* QGIS 2 OpenStreetMap Vectors
QGIS 2.0 integrates OpenStreetMap import as a core functionality. To get OSM data:
Menu "Vector -> Openstreetmap -> Load data" will connect to the OSM server and download data. You can skip this step if you already have a .osm XML file.
"Import topology from an XML file" below will convert your .osm file into a spatialite database, and create a db connection.
"Export topology to Spatialite" then allows you to open the database connection, select the type of data you want (points, lines, polygons) and choose tags to import. This creates a spatialite geometry layer that you can then add to your project via the "add a spatialite layer" menu.
More details here. Note that this process imports raw OSM GIS data not any particular map style/symbology.
@pdbartsch
pdbartsch / map.geojson
Last active May 23, 2016 17:13
building footprints
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pdbartsch
pdbartsch / MAPPS California Counties
Created February 28, 2017 16:01
Quick map of California Counties using Bryan McBride's MAPPS tool. See: https://github.com/bmcbride/mapps/blob/gh-pages/README.md
https://bmcbride.github.io/mapps/?
src=https://gist.githubusercontent.com/pdbartsch/4a4ad6c68ab75d597610/raw/4adc6d41320d06e42a43e4075106932ca7b44cd5/ca_counties.geojson
&
icon=http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons/matte-blue-and-white-square-icons-culture/117332-matte-blue-and-white-square-icon-culture-state-california.png
&
fields=NAMELSAD,STATEFP,COUNTYFP,COUNTYNS
&
sortfield=NAMELSAD
&
title=California%20Counties
@pdbartsch
pdbartsch / html5shiv-printshiv.js
Created July 6, 2017 23:17
UCSB Get Latitude & Longitude
/**
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createE
@pdbartsch
pdbartsch / ChangeRemoteOrigin.md
Last active May 11, 2018 17:11
How to change remote origin

Move a repository from one web host to another

  • cd \local\repository\directory
  • show current remote and the name of the remotes: git remote -v
  • take the name of the remote you'd like to remove (e.g. origin or destination) and plug it into the next command
  • git remote rm origin will remove a remote named 'origin' but substitute your remote name here

Push the repo to new host:

  • git remote add origin https://[email protected]/userName/remoteRepoName.git
  • git push -u origin master
@pdbartsch
pdbartsch / GitHooks.md
Last active July 9, 2018 23:36
git hooks

question:

When using VS Code I often forget to push changes after a commit. Any extensions or hacks to just push with each commit?

answer

git hooks

The hooks are all stored in the hooks subdirectory of the Git directory. In most projects, that’s .git/hooks.

  • create an executable file called post-commit with no file extension in the hooks directory with the following 2 lines
  1. #!/bin/sh
  2. git push origin master
@pdbartsch
pdbartsch / code.py
Created December 30, 2018 18:40
Simple example to illustrate my problem using an Adafruit Hallowing with CircuitPython. When using the built in red led on pin 13, the light remains off until I ask it to turn on with the capacitive touch pad. When using an external led through any GPIO pin (including 13) my led is on by default and then blinks as expected when touching the touc…
import board, digitalio, touchio, time
led = digitalio.DigitalInOut(board.D9)
#led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
touch = touchio.TouchIn(board.TOUCH4)
while True:
if touch.value:
@pdbartsch
pdbartsch / code.py
Last active January 2, 2019 22:00
Play the star spangled banner using Circuit Python and the Circuit Playground Express from Adafruit! I went to search for the notes to the song online and found that Ryan Aebi had already converted them to frequency in Hz , so he saved me a ton of time.
'''
star spangled banner on Circuit Playground Express using Circuit Python
'''
from adafruit_circuitplayground.express import cpx
# color palette for NeoPixels
red = (30, 00, 0)
white = (255, 255, 255)
@pdbartsch
pdbartsch / code.py
Last active January 29, 2019 16:16
The code running lights and sounds on my outlaw class pinewood derby police car 2019 using Adafruit's Hallowing and CircuitPython
import time
import array
import math
import board
import pulseio
import digitalio
import touchio
import audioio
import busio
import adafruit_lis3dh