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
| Promise = require('bluebird'); | |
| resolveSrv = Promise.promisify(require('dns').resolveSrv); | |
| function fetchMarathonServiceBaseUrl(serviceName){ | |
| var dns_url = ['_' + serviceName, "_tcp.marathon.mesos"].join('.'); | |
| return resolveSrv(dns_url).then(function(addresses){ | |
| // TODO: take an address at random ? | |
| // should we use some logic to choose addresses? | |
| var internalUrl = "http://" + addresses[0].name + ":" + addresses[0].port; |
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 littleEndian = (function() { | |
| var buffer = new ArrayBuffer(2); | |
| new DataView(buffer).setInt16(0, 256, true /* littleEndian */); | |
| // Int16Array uses the platform's endianness. | |
| return new Int16Array(buffer)[0] === 256; | |
| })(); | |
| console.log(littleEndian ? 'little' : 'big'); |
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
| fs = require 'fs' | |
| toFloatArray = (list) -> | |
| buffer = new ArrayBuffer(4 * list.length) | |
| dataView = new DataView buffer | |
| offset = 0 | |
| addNextValue = (value) -> | |
| dataView.setFloat32 offset, value, true | |
| offset += 4 | |
| addNextValue val for val in list |
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
| license: gpl-3.0 |
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
| call apoc.periodic.iterate(' | |
| load csv from "https://raw.githubusercontent.com/wess/iotr/master/lotr.txt" as row fieldterminator \'"\' | |
| with row | |
| unwind row as text | |
| RETURN text',' | |
| WHERE text is not NULL | |
| with reduce(t=tolower(text), delim in [",",".","!","?",\'"\',":",";","\'","-","#","*","(",")","[","]","/","`","and","the","not","but","for","with","from"] | replace(t,delim,"")) as normalized | |
| // Remove all short words (length <2) | |
| with [w in split(normalized," ") WHERE w IS NOT NULL and size(trim(w)) > 2 | trim(w)] as words | |
| where words is not null and size(words) > 1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # start from golang image based on alpine-3.8 | |
| FROM golang:1.10-alpine3.8 AS dev-build | |
| # add our cgo dependencies | |
| RUN apk update && apk add --update ca-certificates cmake make g++ openssl-dev git curl pkgconfig | |
| # clone seabolt-1.7.0 source code | |
| RUN git clone -b v1.7.0 https://github.com/neo4j-drivers/seabolt.git /seabolt | |
| # invoke cmake build and install artifacts - default location is /usr/local | |
| RUN mkdir /seabolt/build | |
| WORKDIR /seabolt/build | |
| # CMAKE_INSTALL_LIBDIR=lib is a hack where we override default lib64 to lib to workaround a defect |
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
| # PYTHON 3.6+ is required | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| from functools import partial | |
| import os | |
| import time | |
| import kthread | |
| from pyngrok import ngrok | |
| PORT = 8000 |
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
| value | text | |
|---|---|---|
| 1 | one | |
| 2 | two | |
| 3 | three | |
| 4 | four | |
| 5 | five | |
| 6 | six | |
| 7 | seven | |
| 8 | eight | |
| 9 | nine |
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 | |
| set -e | |
| # Example usage: `cd web && PORT=8000 ./serve.sh` | |
| # Default to 8080 if no PORT is specified | |
| PORT="${PORT:-8080}" | |
| # Check which python major version is available and start a simple http server accordingly | |
| if [[ "$(python -c 'import sys; print(sys.version_info[0])')" == "3"* ]]; then |
OlderNewer