Skip to content

Instantly share code, notes, and snippets.

input.ZIP_CODE_3043|input.ZIP4_CODE_3044|input.WALK_SEQUENCE_3042|input.NUMBER_OF_SOURCES_NAME_ADDRESS_3027|input.PREFIX_TITLE_8093|input.NEW_TO_BUILD_4901|input.ADDRESS_TYPE_INDICATOR_3001|place.geoCodes.minorCivilDivisionCode|input.ADDRESS_LINE_3002|place.geoCodes.precisionLevelCode|place.geoCodes.tractCode|place.geoCodes.blockGroupCode|place.geoCodes.blockCode|place.geoCodes.fipsStateCode|place.geoCodes.fipsCountyCode|place.marketIndicesHousing.occupiedHousingUnits.ownerOccupied.medianValue|input.DELIVERY_POINT_BAR_CODE_3046|input.STATE_3038|input.TIME_ZONE_3041|input.PRESENCE_OF_PHONE_FLAG_3031|input.PHONE_3032|input.ZIP4_RECORD_TYPE_3045|input.DSF_DELIVERABILITY_INDICATOR_3037|input.DELIVERY_POINT_DROP_INDICATOR_8094|input.GENDER_CODE_3017|input.LOT_CARRIER_LINE_OF_TRAVEL_3008|input.FILE_DATE_3015|input.COMPANY_ID_4116|input.INDIVIDUAL_ID_4117|place.marketIndicesIncome.households.medianIncome|input.CARRIER_ROUTE_CODE_3009|input.ADDRESS_LINE2_4111|place.geoCodes.coreBaseStatisticalAreaCode|input.FIRST_NAM
@maxpospischil
maxpospischil / stronglyConsistentQuery.scala
Created February 26, 2018 18:40
Strongly consistent local secondary index query
private def recordsQuery =
ScanamoOps.query(
ScanamoQueryRequest(
tableName,
Some("incomplete_index"),
'pkey -> s"$uuid.${schema.id}",
new ScanamoQueryOptions(consistent = true, limit = Some(concurrencyLimit), None, None)
)
).map {
_.getItems.asScala.map { r =>
@maxpospischil
maxpospischil / eventuallyConsistentQuery.scala
Created February 26, 2018 18:39
Eventually consistent local secondary index query
val incompleteIndexTable: SecondaryIndex[BatchRecord] = BatchWorker.getIncompleteIndexTable(tableName)
private def recordsQuery =
incompleteIndexTable
.limit(concurrencyLimit)
.query('pkey -> s"$uuid.${dp.id}")
.map(_.toSet)
def nextRecords: Task[Set[BatchRecord]] = Task {
Scanamo.exec(client)(recordsQuery).collect {
{
"logger_name": "blackfin.execution.logging.Transaction",
"exception": null,
"service": "blackfin",
"schema": "transaction",
"date": 1502913751,
"event_uuid": "88490dd8-9bb7-4aee-8207-7e62dfc0f66d",
"message": "blackfin_transaction",
"transaction": {
"endpoint": "v2/data_bus",
# first_name last_name street_address phone_number
Brenden Grace 1945 Michael Pl
Brenden Grace 555 Whatever Ln
Brenden Grace 111-111-1111
Brenden Grace 555-555-5555
require 'net/http'
require 'securerandom'
t0 = Time.now
uri = URI.parse("http://a.com")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
puts "first call to net/http took this much time #{Time.now-t0}"
@maxpospischil
maxpospischil / gist:7c82efc0e533e865c324
Last active February 29, 2016 20:12
httpi_slowness
require 'net/http'
require 'securerandom'
10.times do |i|
t0 = Time.now
uri = URI.parse("http://apple.com?rand=#{SecureRandom.hex}")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = http.request(request)
require 'httpi'
url = "https://localhost:9003/libraries.json?token=1"
request = HTTPI::Request.new("#{url}?token=valid_token")
request.headers["Content-Type"] = 'application/json'
request.headers["From-Bluefin"] = 'true'
request.auth.ssl.verify_mode = :none
http_method = :get
HTTPI.request(http_method, request, adapter = nil)