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 com.google.cloud.dataflow.sdk.coders.Coder; | |
| import com.google.cloud.dataflow.sdk.coders.CoderFactory; | |
| import com.google.cloud.dataflow.sdk.coders.SerializableCoder; | |
| import com.google.common.hash.BloomFilter; | |
| import java.util.Collections; | |
| import java.util.List; | |
| public class BloomFilterCoderFactory implements CoderFactory { | |
| @Override |
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 subprocess | |
| number_legit_AP = 1 | |
| output = subprocess.check_output('gobbledegook', shell=True) | |
| if output != number_legit_AP: | |
| send_email() |
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.spark.ml.feature._ | |
| import org.apache.spark.ml.classification._ | |
| import org.apache.spark.mllib.regression.LabeledPoint | |
| import org.apache.spark.mllib.linalg.Vector | |
| import org.apache.spark.sql._ | |
| import org.apache.spark.mllib.classification.{LogisticRegressionWithLBFGS, LogisticRegressionModel} | |
| import org.apache.spark.ml.feature.VectorAssembler | |
| //helper function | |
| def load(path: String, sqlContext: SQLContext): DataFrame = { |
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
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 65, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "outputs": [], | |
| "source": [ |
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
| var gulp = require('gulp'), | |
| util = require('gulp-util'), | |
| jshint = require('gulp-jshint'), | |
| mocha = require('gulp-mocha'); | |
| var srcFiles = './src/**/*.js'; | |
| var testFiles = './test/**/*.js'; | |
| gulp.task('test', function() { | |
| return gulp.src(testFiles, {read: false}) |
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
| FROM debian:latest | |
| # Update the repository and install Redis Server | |
| RUN apt-get update | |
| RUN apt-get install -y redis-server libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential | |
| RUN apt-get install -y lua-nginx-redis | |
| ADD nginx.conf /etc/nginx/nginx.conf | |
| RUN apt-get install -y curl screen vim |
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 expandQueryString(s: String) : Array[(String, String)] = | |
| s.split("\\?").last.split("&").map(_.split("=", -1)) | |
| .map(x =>{ | |
| if(x.length > 1) Some(x.head, x.tail.mkString("=")) | |
| else None | |
| }).flatten | |
| .filterNot(_._2 == "") |
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 parse(uri: String) : Map[String,Seq[String]] = { | |
| if (uri == null || uri.isEmpty) { | |
| return Map() | |
| } | |
| def parsePairs(pair: String) : (String, String) = { | |
| val bits = pair.decodeUrl.split("=") | |
| (bits(0), bits(1)) | |
| } |
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 boto.s3 | |
| from boto.s3.key import Key | |
| import sys | |
| import math | |
| def percent_cb(complete, total): | |
| sys.stdout.write(str(math.trunc(complete/max(total, 1)) * 100) + '%..') | |
| if total == complete: | |
| print 'done!' |
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
| public class TaxCalculationException : ApplicationException | |
| { | |
| private string _zipCode; | |
| public TaxCalculationException(string zipCode, Exception ex) | |
| : base("An error occurred while processing tax.", ex) | |
| { | |
| _zipCode = zipCode; | |
| } | |
| } |