Google Cloud OAuth app with redirect URI http://localhost:8080.
{| # Restish + Gmail CLI | |
| Complete setup for using restish CLI with Gmail API. | |
| ## Files | |
| - `restish` - This overview | |
| - `paginate` - Pagination handler | |
| - `CONFIGURATION.md` - OAuth setup |
| #! /bin/bash | |
| set -eo pipefail | |
| AWS_PARAMS=("$@") | |
| NEXT_TOKEN="" | |
| OUTPUT="{}" | |
| deep_merge() { |
| /* | |
| I need to monitor my UK border crosses for residential purposes. | |
| This script will calculate whenever I moved more than 5 degrees, either on lat or long, from one datapoint to the other, since the start of 2017. | |
| */ | |
| // First of all, go to Google Takeout and fetch your Location data. | |
| // Then, for each day, extract the last position for the day with the following command (using gojq) | |
| // cat Records.json | gojq -r '[.locations[] | select((.timestamp | sub("\\.[0-9]+";"") | strptime("%Y-%m-%dT%H:%M:%SZ")) | mktime >= 1483228800) | {latitudeE7, longitudeE7, accuracy, source, timestamp}] | group_by(.timestamp[:10]) | map(max_by(.timestamp)) | map({latitude: (.latitudeE7 / 10000000), longitude: (.longitudeE7 / 10000000), accuracy: .accuracy, source: .source, timestamp: .timestamp})' > grouped.json | |
| // *** You might want to change the Unix timestamp after mktime to filter on your needs |
| // TestSubject.js | |
| const ExternalDependency = require('./ExternalDependency') | |
| module.exports = class TestSubject { | |
| constructor () { | |
| this.externalDependency = new ExternalDependency() | |
| } | |
| isExternalDependencyMocked () { | |
| return this.externalDependency.isMocked |
| module.exports = function CustomError(message) { | |
| this.name = this.constructor.name | |
| this.message = message | |
| Error.captureStackTrace(this, this.constructor) | |
| } | |
| module.exports.prototype.inspect = function () { | |
| return this.stack | |
| } |
| //file substack.js | |
| module.exports = function() { | |
| console.log('main entry point'); | |
| }; | |
| module.exports.details = function() { | |
| console.log('more detailed functionality'); | |
| }; | |
| function getDatasetfromJsonData(jsonData){ | |
| return jsonData[0].scores; | |
| }; | |
| function getLabels(dataset) { | |
| return Object.keys(dataset) | |
| }; | |
| function getData(dataset) { | |
| return Object.keys(dataset).map(function(key) { |
| // ...IN THE CALLER | |
| import JSONDataConverter from './JSONDataConverter'; | |
| <RadarChart data={JSONDataConverter(data)} width={width} height={height} redraw /> |
| var JSONDataConverter = (function () { | |
| var getDatasetfromJsonData = function(jsonData){ | |
| return jsonData[0].scores; | |
| }; | |
| var getLabels = function(dataset) { | |
| return Object.keys(dataset) | |
| }; | |
| var getData = function(dataset) { |