This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, pyproj, shapefile | |
input_file = sys.argv[1] | |
output_file = sys.argv[2] | |
source_spatialref = sys.argv[3] | |
target_spatialref = sys.argv[4] | |
sf = shapefile.Reader(input_file) | |
shapes = sf.shapes() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -eu | |
source /root/.bashrc | |
MODE=$1 | |
MASTER_FQDN=$2 | |
NIFI_HOME=$3 | |
HOSTNAME=$(hostname -f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%angular | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.5/leaflet.css" /> | |
<div id="map" style="height: 500px; width: 100%"></div> | |
<script type="text/javascript"> | |
function initMap() { | |
var map = L.map('map').setView([30.00, -30.00], 3); | |
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); | |
var geoMarkers = L.layerGroup().addTo(map); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%angular | |
<div id='testDiv'> | |
</div> | |
<script> | |
var el = angular.element($('#testDiv').parent('.ng-scope')); | |
angular.element(el).ready(function() { | |
window.locationWatcher = el.scope().compiledScope.$watch('dummy', function(newValue, oldValue) { | |
$('#testDiv').append(newValue); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.nifi.remote.client.SiteToSiteClientConfig | |
import org.apache.nifi.remote.client.SiteToSiteClient | |
import org.apache.nifi.spark.NiFiReceiver | |
import org.apache.spark._ | |
import org.apache.spark.streaming._ | |
val ssc = new StreamingContext(sc, Seconds(2)) | |
val wifiConfig = new SiteToSiteClient.Builder() | |
.url("http://raspberrypi:8080/nifi") | |
.portName("wifi") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list(table: String, col: String) : Array[(String, String)] = { | |
sqlContext.sql("select distinct " + col + " from " + table + " order by " + col).collect.map(x => (x(0).asInstanceOf[String], x(0).asInstanceOf[String])) | |
} | |
def tables(): Array[(String, String)] = { | |
sqlContext.sql("show tables").collect.map(x => (x(0).asInstanceOf[String], x(0).asInstanceOf[String])) | |
} | |
def columns(table: String) : Array[(String, String)] = { | |
sqlContext.sql("select * from " + table + " limit 0").columns.map(x => (x, x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get list of distinct values on a column for given table | |
def distinctValues(table: String, col: String) : Array[(String, String)] = { | |
sqlContext.sql("select distinct " + col + " from " + table + " order by " + col).collect.map(x => (x(0).asInstanceOf[String], x(0).asInstanceOf[String])) | |
} | |
//Get list of tables | |
def tables(): Array[(String, String)] = { | |
sqlContext.sql("show tables").collect.map(x => (x(0).asInstanceOf[String], x(0).asInstanceOf[String])) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%angular | |
<input id="textbox" class="hide" ng-model="someAngularVar"></input> | |
<button id="btn" type="submit" onclick="update()">UpperCase It!</button> | |
<script type="text/javascript"> | |
function update(){ | |
var element = $('#textbox'); | |
var currentVal = element.val(); | |
//Update the value | |
element.val(currentVal.toUpperCase()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"paragraphs": [ | |
{ | |
"title": "Page Setup", | |
"text": "%angular\n\u003cscript src\u003d\"https://cdn.plot.ly/plotly-latest.min.js\"\u003e\u003c/script\u003e\n\u003cdiv id\u003d\"dummy\" vars\u003d\"data,dataSchema\"\u003e\u003c/div\u003e\n\u003cscript type\u003d\"text/javascript\"\u003e\n var div \u003d $(\u0027#dummy\u0027);\n //Given an element in the note \u0026 list of values to fetch from Spark\n //window.angularVars.myVal will be current value of backend Spark val of same name\n function hoist(element, varNames){\n window.angularVars \u003d {};\n var scope \u003d angular.element(element.parent(\u0027.ng-scope\u0027)).scope().compiledScope;\n $.each(varNames, function(i, v){\n window[v+\u0027-watcher\u0027] \u003d scope.$watch(v, function(newVal, oldVal){\n console.log(\u0027Setting \u0027 + v + \u0027 to:\\n\u0027);\n console.log(newVal);\n window.angularVars[v] \u003d newVal;\n });\n });\n }\n hoist(div, div.attr(\u0027vars\u0027).split(\u |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%angular | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> | |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | |
<div id="mapid" style="height:500px;"></div> | |
<script type="text/javascript"> | |
var Leaflet = L.noConflict(); | |
var map = Leaflet.map('mapid', {center: [40,-97], zoom: 4}); | |
var tiles = Leaflet.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png").addTo(map); | |
var states = [{ | |
"type": "Feature", |