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
// Iterate through all map tiles for a given bounds and zoom range | |
// lat-lon to tile conversions from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Derivation_of_tile_names | |
function lat2tile(lat, zoom) { | |
return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom))) | |
} | |
function lon2tile(lon, zoom) { | |
return (Math.floor((lon+180)/360*Math.pow(2,zoom))) | |
} |
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
# Restart rsyslog so it re-opens its file pointer (e.g. during logrotate postrotate script) | |
# via https://access.redhat.com/solutions/232793 | |
kill -HUP $(cat /var/run/syslogd.pid) |
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
'use strict'; | |
module.exports = function(grunt) { | |
grunt.task.registerTask('githash', function() { | |
var done = this.async(); | |
grunt.util.spawn({ | |
cmd: 'git', | |
args: ['rev-parse', '--short', 'HEAD'] | |
}, function(err, result, code) { |
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
fetch(url, {credentials: 'include'}) | |
.then((response) => { | |
if (response.ok) { | |
response.json().then(fetchSuccess); | |
} else { | |
response.json().then(fetchError); | |
} | |
}).catch(fetchError); |
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
request('/foo.js') | |
.then((body) => { | |
const bodyExported = body + 'module.exports = foo;'; | |
const Module = module.constructor; | |
const m = new Module(); | |
m._compile(bodyExported, ''); | |
console.log(m.exports); | |
}); |
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
const tf = require('@tensorflow/tfjs'); | |
const jpeg = require('jpeg-js'); | |
const axios = require('axios'); | |
async function handler(event) { | |
try { | |
// extract the model and image urls from the lambda event payload and fetch the data | |
const { modelUrl, imageUrl } = event; | |
const model = await tf.loadLayersModel(modelUrl); |
OlderNewer