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 axios from 'axios' | |
const baseUrl = SOME_URL | |
const fetchAllData = async () => { | |
let allData = [] | |
let apiResponse = await axios.get(baseUrl) | |
allData.push(apiResponse.data_you_care_about) | |
while (apiResponse.next_cursor) { | |
apiResponse = await axios.get(baseUrl + `next_cursor=${apiResponse.next_cursor}`) |
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
paces = (13..18).to_a | |
aid_station_miles = [0.0,3.5,6.5,11.8,17.7,20.5,23.5,26.4,32.4] | |
start_time = 420 | |
puts (['Miles'] + paces.map { |m| "#{m} min/mi" }).join(',') | |
aid_station_miles.each do |milage| | |
elapsed_time = paces.reduce([]) do |times, pace| | |
total_mins = (milage * pace).round(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
/Users/Ryan/code/lantern/xealth-partner-sample-code/partner-api/gulper.js:78 | |
function runCommand(cmd, args, verbosity = 0) { | |
^ | |
SyntaxError: Unexpected token = | |
at exports.runInThisContext (vm.js:54:16) | |
at Module._compile (module.js:375:25) | |
at loader (/Users/Ryan/code/lantern/xealth-partner-sample-code/partner-api/node_modules/babel-register/lib/node.js:144:5) | |
at Object.require.extensions.(anonymous function) [as .js] (/Users/Ryan/code/lantern/xealth-partner-sample-code/partner-api/node_modules/babel-register/lib/node.js:154:7) | |
at Module.load (module.js:345:32) |
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
reference value kafka of package <root> refers to nonexisting symbol. in file .../JobRunner.scala | |
scala.tools.nsc.symtab.Types$TypeError: class file needed by StreamingContext is missing. | |
reference value kafka of package <root> refers to nonexisting symbol. | |
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan.toTypeError(UnPickler.scala:66) | |
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan$LazyTypeRef.complete(UnPickler.scala:79) | |
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan$LazyTypeRef.complete(UnPickler.scala:69) | |
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:730) | |
at scala.tools.nsc.symtab.Types$TypeMap$$anonfun$16.apply(Types.scala:3234) | |
at scala.tools.nsc.symtab.Types$TypeMap$$anonfun$16.apply(Types.scala:3231) |
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/sh | |
exec scala -savecompiled "$0" "$@" | |
!# | |
// Get the shell scripting enrichments | |
import scala.sys.process._ | |
val alwaysKeep = Set("develop", "master") | |
// Now delete any merged branches" | |
val branches: String = "git branch".!! |
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/env bash | |
# Requires CSVKit to be installed | |
# To install use pip install csvkit | |
cat geocoded_npi.csv | ruby -e 'STDIN.each { |l| fields = l.split(","); puts l if fields[3].to_f < 0.5 }' > lower-confidence-npis.csv | |
# Depending which address field you want to use you should change the column indexes | |
csvcut -c 1,29-33 full_nip_datadump.csv > npi-to-address.csv | |
csvjoin -c 1 npi-to-address.csv lower-confidence-npis.csv |
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
#Code taken from SO | |
#http://stackoverflow.com/questions/8751497/latitude-longitude-coordinates-to-state-code-in-r/8751965#8751965 | |
library(sp) | |
library(maps) | |
library(maptools) | |
# The single argument to this function, pointsDF, is a data.frame in which: | |
# - column 1 contains the longitude in degrees (negative in the US) | |
# - column 2 contains the latitude in degrees |
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
cd /tmp | |
wget "http://jdbc.postgresql.org/download/postgresql-9.2-1002.jdbc4.jar" | |
cp postgresql-9.2-1002.jdbc4.jar /usr/share/java/ | |
ln -s /usr/share/java/postgresql-9.2-1002.jdbc4.jar /usr/lib/sqoop/lib/postgresql-9.2-1002.jdbc4.jar | |
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
library(maps) | |
library(geosphere) | |
library(plyr) | |
library(ggplot2) | |
library(sp) | |
airports <- read.csv("http://www.stanford.edu/~cengel/cgi-bin/anthrospace/wp-content/uploads/2012/03/airports.csv", as.is=TRUE, header=TRUE) | |
flights <- read.csv("http://www.stanford.edu/~cengel/cgi-bin/anthrospace/wp-content/uploads/2012/03/PEK-openflights-export-2012-03-19.csv", as.is=TRUE, header=TRUE) | |
# aggregate nunber of flights |
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/env ruby -W0 | |
require 'geoip' | |
geocity_file_location = ARGV[0] || "./GeoLiteCity.dat" | |
geocoder = GeoIP.new(geocity_file_location) | |
i = 0 | |
STDIN.each do |ip| | |
STDERR.write("Processing Line: #{i}\n") if i % 1000 == 0 | |
i += 1 |
NewerOlder