Skip to content

Instantly share code, notes, and snippets.

View eskibars's full-sized avatar

Shane Connelly eskibars

View GitHub Profile
@eskibars
eskibars / gsheet-vectara.js
Created February 16, 2024 20:13
Vectara GSheet Integration
/**
* Calculates the sale price of a value at a given discount.
* The sale price is formatted as US dollars.
*
* @param {string} question The RFI question to answer.
* @param {number} discount The discount to apply, such as .5 or 50%.
* @return The answer according to Vectara.
* @customfunction
*/
function VectaraRFIAnswer(question) {
@eskibars
eskibars / instructions.md
Last active March 12, 2019 16:54
Getting data from shapefiles into geojson

Finding Data

Open geo data can be found in a lot of places. Open city data is a great source of geo data in many jurisdictions. Searching for "open data <cityname>" can yield a lot of results. For example, https://datasf.org/opendata/ is San Francisco's open data portal. Some jurisdictions will have dedicated GIS portals.

You'll often find geo data in a few formats:

  1. A CSV of geo points
  2. Shapefiles for geo points
  3. Shapefiles for geo shapes
  4. WKT (Well-known text)
  5. GeoJSON
@eskibars
eskibars / console-example
Created August 10, 2017 20:36
Example of date search
PUT t
PUT /t/t/_mapping
{
"properties": {
"publishdate": {
"type": "date"
}
}
}
@eskibars
eskibars / gist:0f0ff0303d9d166c02cc547af5b2c358
Created November 18, 2016 15:45
simulate painless script
POST _ingest/pipeline/_simulate
{
"pipeline" :
{
"description": "_description",
"processors": [
{
"script":
{
"lang": "painless",
@eskibars
eskibars / input.txt
Last active November 8, 2016 18:59
Cumulative sum + serial differencing
POST t/type_name
{
"d": "2016-01-01T01:01:01",
"foo": 1
}
POST t/type_name
{
"d": "2016-01-02T01:01:01",
"foo": 2
@eskibars
eskibars / notanalyzed.txt
Created October 28, 2016 13:10
Not analyzed example
// Add our mapping for type "type_name" to index "t"
PUT t
{
"mappings": {
"type_name" : {
"dynamic_templates": [{
"notanalyzed" : {
"match": "*",
"mapping": {
"index": "not_analyzed"
@eskibars
eskibars / err.txt
Created October 25, 2016 13:44
high shards start-up error
Shanes-MBP:elasticsearch-5.0.0 shane$ ./bin/elasticsearch
[2016-10-25T06:42:51,718][INFO ][o.e.n.Node ] [] initializing ...
[2016-10-25T06:42:51,797][INFO ][o.e.e.NodeEnvironment ] [QsdKs_f] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [6.6gb], net total_space [232.6gb], spins? [unknown], types [hfs]
[2016-10-25T06:42:51,797][INFO ][o.e.e.NodeEnvironment ] [QsdKs_f] heap size [1.9gb], compressed ordinary object pointers [true]
[2016-10-25T06:42:51,957][INFO ][o.e.n.Node ] [QsdKs_f] node name [QsdKs_f] derived from node ID; set [node.name] to override
[2016-10-25T06:42:51,959][INFO ][o.e.n.Node ] [QsdKs_f] version[5.0.0], pid[35179], build[5f7ce3c/2016-10-21T23:12:38.850Z], OS[Mac OS X/10.11.6/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_51/25.51-b03]
[2016-10-25T06:42:52,996][INFO ][o.e.p.PluginsService ] [QsdKs_f] loaded module [aggs-matrix-stats]
[2016-10-25T06:42:52,996][INFO ][o.e.p.PluginsService ] [Qs