This file contains 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 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 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 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 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 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 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
# See https://pip.pypa.io/en/latest/installing.html for how to install pip, then: | |
# pip install simple-salesforce | |
from simple_salesforce import Salesforce | |
import string | |
# To get your SFDC token, see https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm | |
# salesforce_login.txt should contain the following, one per line: | |
# Your Name | |
# your_email@sfdc_account.com | |
# your_password |
This file contains 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
# Configure Flume agent (/etc/flume/conf/flume.conf) to receive syslog messages | |
agent.sources=syslogsource-1 | |
agent.channels=mem-channel-1 | |
agent.sinks=kafka-sink-1 | |
agent.sources.syslogsource-1.type=syslogtcp | |
agent.sources.syslogsource-1.port=13073 | |
agent.sources.syslogsource-1.host=0.0.0.0 | |
agent.sources.syslogsource-1.channels=mem-channel-1 |
This file contains 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 jaydebeapi | |
conn = jaydebeapi.connect('org.apache.phoenix.jdbc.PhoenixDriver', \ | |
['jdbc:phoenix:my_zk_server:2181:/hbase-unsecure', '', ''], \ | |
'/usr/hdp/current/phoenix-client/phoenix-client.jar') | |
curs = conn.cursor() | |
curs.execute('select * from WEB_STAT limit 1') | |
curs.fetchall() |
This file contains 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
DIR=$1 | |
cd $DIR | |
for file in * | |
do | |
tar -czvf $file.tgz $file/ | |
done |