Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
884c24fbd4
|
|||
|
e267e7e41b
|
|||
|
b79c359475
|
|||
|
c2f187cfdf
|
|||
|
26ccdacf66
|
|||
|
3ad87f085e
|
|||
|
831dce0656
|
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,9 +1,7 @@
|
|||||||
*.csv
|
|
||||||
*.html
|
|
||||||
*.txt
|
*.txt
|
||||||
|
|
||||||
api-keys-fish.sh
|
api-keys*.sh
|
||||||
dark-sky.json
|
*.json
|
||||||
|
|
||||||
# node {{{ -
|
# node {{{ -
|
||||||
|
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "csi.js"]
|
|
||||||
path = csi.js
|
|
||||||
url = https://github.com/LexmarkWeb/csi.js
|
|
||||||
1
csi.js
1
csi.js
Submodule csi.js deleted from 2d99a233a5
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "<table>" ;
|
|
||||||
print_header=true
|
|
||||||
while read INPUT ; do
|
|
||||||
if $print_header;then
|
|
||||||
# echo "<tr><th>$INPUT" | sed -e 's/:[^,]*\(,\|$\)/<\/th><th>/g'
|
|
||||||
echo "<tr><th>${INPUT//,/</th><th>}</th></tr>" ;
|
|
||||||
print_header=false
|
|
||||||
else
|
|
||||||
echo "<tr><td>${INPUT//,/</td><td>}</td></tr>" ;
|
|
||||||
fi
|
|
||||||
done < dark-sky.csv ;
|
|
||||||
echo "</table>"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
source api-keys-fish.sh
|
|
||||||
# IBM
|
|
||||||
set curl_url "https://api.darksky.net/forecast/$DARK_SKY_KEY/43.8180904,-79.3350555?exclude=minutely%2Cdaily%2Calerts%2Cflags&units=auto"
|
|
||||||
|
|
||||||
curl --request GET --url $curl_url > dark-sky.json
|
|
||||||
node dark-sky.js > dark-sky.csv
|
|
||||||
./csv-to-html.sh > dark-sky.html
|
|
||||||
121
dark-sky.js
121
dark-sky.js
@@ -1,46 +1,131 @@
|
|||||||
const log = console.log
|
const log = console.log
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const {table} = require('table')
|
const {table, getBorderCharacters} = require('table')
|
||||||
|
// const argv = require('yargs').argv
|
||||||
|
|
||||||
const HOURS_AHEAD = 12
|
const TABLE_CONFIG = {
|
||||||
|
// columns: {
|
||||||
|
// 0: { alignment: 'center' },
|
||||||
|
// 1: { alignment: 'center' },
|
||||||
|
// 2: { alignment: 'center' },
|
||||||
|
// },
|
||||||
|
border: getBorderCharacters(`ramac`)
|
||||||
|
}
|
||||||
|
const HIDE_PRECIP_LESS_THAN = 10
|
||||||
|
// const CREDIT_MSG = "Powered by Dark Sky: https://darksky.net/poweredby/"
|
||||||
|
// const CREDIT_MSG = "https://darksky.net/poweredby • https://smol.gq/wthr-src\n"
|
||||||
|
const CREDIT_MSG = "darksky.net/poweredby • smol.gq/wthr-src\n\n"
|
||||||
|
|
||||||
// https://medium.com/@osiolabs/read-write-json-files-with-node-js-92d03cc82824
|
// https://medium.com/@osiolabs/read-write-json-files-with-node-js-92d03cc82824
|
||||||
const jsonReader = (filePath, cb) => {
|
const jsonReader = (filePath, cb) => {
|
||||||
fs.readFile(filePath, (err, fileData) => {
|
fs.readFile(filePath, (err, fileData) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
log(err)
|
||||||
return cb && cb(err)
|
return cb && cb(err)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const object = JSON.parse(fileData)
|
const object = JSON.parse(fileData)
|
||||||
|
// log(filePath, object['latitude'])
|
||||||
return cb && cb(null, object)
|
return cb && cb(null, object)
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
log(err)
|
||||||
return cb && cb(err)
|
return cb && cb(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonReader('./dark-sky.json', (err, weatherInfo) => {
|
const round5 = x => { return Math.ceil(x / 5) * 5 }
|
||||||
if (err) {
|
|
||||||
console.log(err)
|
const updateTempHigh = (temp, index, tempHigh) => {
|
||||||
return
|
// +1 to offset header
|
||||||
|
return (temp > tempHigh[0]) ? [temp, index + 1] : tempHigh
|
||||||
}
|
}
|
||||||
|
|
||||||
const tableConfig = {
|
const updateTempLow = (temp, index, tempLow) => {
|
||||||
columns: {
|
return (temp < tempLow[0]) ? [temp, index + 1] : tempLow
|
||||||
0: { alignment: 'center' },
|
|
||||||
1: { alignment: 'center' },
|
|
||||||
2: { alignment: 'center' },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getWeatherTable = (jsonFile, loc, orientation) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
jsonReader(jsonFile, (err, weatherInfo) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
}
|
}
|
||||||
const infoList = [['H', '°C', '%P']]
|
|
||||||
for (let i = 0; i < HOURS_AHEAD; i++) {
|
let output = loc + '\n'
|
||||||
|
// value, index
|
||||||
|
let tempHigh = [-100, -1]
|
||||||
|
let tempLow = [100, -1]
|
||||||
|
|
||||||
|
weatherInfo['hourly']['data'][0] = weatherInfo['currently']
|
||||||
|
if (orientation == 'v') {
|
||||||
|
const infoList = [['H', '°C', 'R','%P']]
|
||||||
|
for (let i = 0; i < 12; i++) {
|
||||||
const hourInfo = weatherInfo['hourly']['data'][i]
|
const hourInfo = weatherInfo['hourly']['data'][i]
|
||||||
const date = new Date(hourInfo['time'] * 1000)
|
const date = new Date(hourInfo['time'] * 1000)
|
||||||
infoList.push([date.getHours(),
|
const temp = Math.floor(hourInfo['apparentTemperature'])
|
||||||
Math.floor(hourInfo['apparentTemperature']),
|
tempHigh = updateTempHigh(temp, i, tempHigh)
|
||||||
Math.floor(hourInfo['precipProbability'])])
|
tempLow = updateTempLow(temp, i, tempHigh)
|
||||||
|
const precipProbability = round5(hourInfo['precipProbability'] * 100)
|
||||||
|
const precipText = ((precipProbability < HIDE_PRECIP_LESS_THAN)
|
||||||
|
? '' : precipProbability)
|
||||||
|
infoList.push([
|
||||||
|
date.getHours(),
|
||||||
|
temp,
|
||||||
|
((hourInfo['summary'].includes('Rain')) ? 'Y' : ''),
|
||||||
|
precipText,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
infoList[tempHigh[1]][1] = `${infoList[tempHigh[1]][1]}+`
|
||||||
|
infoList[tempLow[1]][1] = `${infoList[tempLow[1]][1]}-`
|
||||||
|
output += table(infoList, TABLE_CONFIG)
|
||||||
|
} else {
|
||||||
|
// horizontal
|
||||||
|
const hoursList = ['H']
|
||||||
|
const tempsList = ['°C']
|
||||||
|
const rainList = ['R']
|
||||||
|
const precipList = ['%P']
|
||||||
|
for (let i = 0; i < 16; i += 2) {
|
||||||
|
const hourInfo = weatherInfo['hourly']['data'][i]
|
||||||
|
const date = new Date(hourInfo['time'] * 1000)
|
||||||
|
const temp = Math.floor(hourInfo['apparentTemperature'])
|
||||||
|
tempHigh = updateTempHigh(temp, i/2, tempHigh)
|
||||||
|
tempLow = updateTempLow(temp, i/2, tempHigh)
|
||||||
|
hoursList.push(date.getHours())
|
||||||
|
tempsList.push(temp)
|
||||||
|
rainList.push((hourInfo['summary'].includes('Rain')) ? 'Y' : '')
|
||||||
|
const precipProbability = round5(hourInfo['precipProbability'] * 100)
|
||||||
|
precipList.push((precipProbability < HIDE_PRECIP_LESS_THAN)
|
||||||
|
? '' : precipProbability)
|
||||||
|
}
|
||||||
|
tempsList[tempHigh[1]] = `${tempsList[tempHigh[1]]}+`
|
||||||
|
tempsList[tempLow[1]] = `${tempsList[tempLow[1]]}-`
|
||||||
|
output += table([hoursList, tempsList, rainList, precipList],
|
||||||
|
TABLE_CONFIG)
|
||||||
|
}
|
||||||
|
resolve(output)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// log(table(infoList, tableConfig));
|
const formatTimeUnit = unit => { return ((unit < 10) ? '0' : '') + unit }
|
||||||
log(infoList.map(row => { return row.join() }).join('\n'))
|
|
||||||
|
const getTablePromises = [
|
||||||
|
getWeatherTable('./markham.json', 'Markham', 'h'),
|
||||||
|
getWeatherTable('./markham.json', 'Markham', 'v'),
|
||||||
|
getWeatherTable('./toronto.json', 'Toronto', 'h'),
|
||||||
|
getWeatherTable('./toronto.json', 'Toronto', 'v'),
|
||||||
|
]
|
||||||
|
Promise.all(getTablePromises).then(tables => {
|
||||||
|
const mText = tables[0]
|
||||||
|
const mvText = tables[1]
|
||||||
|
const tText = tables[2]
|
||||||
|
const tvText = tables[3]
|
||||||
|
const writeErrorHandler = error => { if (error) { throw error } }
|
||||||
|
fs.writeFile('mt.txt', CREDIT_MSG + mText + '\n' + tText, writeErrorHandler)
|
||||||
|
fs.writeFile('mtv.txt', CREDIT_MSG + mvText + '\n' + tvText, writeErrorHandler)
|
||||||
|
fs.writeFile('m.txt', CREDIT_MSG + mText, writeErrorHandler)
|
||||||
|
fs.writeFile('mv.txt', CREDIT_MSG + mvText, writeErrorHandler)
|
||||||
|
fs.writeFile('t.txt', CREDIT_MSG + tText, writeErrorHandler)
|
||||||
|
fs.writeFile('tv.txt', CREDIT_MSG + tvText, writeErrorHandler)
|
||||||
})
|
})
|
||||||
|
|||||||
14
dark-sky.service
Normal file
14
dark-sky.service
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Fetch local weather
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/home/kevin/weather/dark-sky.sh
|
||||||
|
User=kevin
|
||||||
|
Group=kevin
|
||||||
|
Environment=PATH=/usr/bin:/usr/local/bin
|
||||||
|
Environment=NODE_ENV=production
|
||||||
|
WorkingDirectory=/home/kevin/weather
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
15
dark-sky.sh
Executable file
15
dark-sky.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
source api-keys.sh
|
||||||
|
|
||||||
|
# takes (coords, location_name) as parameters
|
||||||
|
update-weather-json() {
|
||||||
|
curl_url="https://api.darksky.net/forecast/$DARK_SKY_KEY/$1?exclude=minutely%2Cdaily%2Calerts%2Cflags&units=auto"
|
||||||
|
curl --request GET --url $curl_url > $2.json
|
||||||
|
# echo "curl --request GET --url $curl_url > $2.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
# update-weather-json "43.8180904,-79.3350555" "markham"
|
||||||
|
# update-weather-json "43.6596426,-79.3976676" "toronto"
|
||||||
|
|
||||||
|
node dark-sky.js
|
||||||
10
dark-sky.timer
Normal file
10
dark-sky.timer
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Fetch local weather
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
# OnCalendar=6,12,18,00:00
|
||||||
|
OnCalendar=*:0
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
1171
github-pandoc.css
1171
github-pandoc.css
File diff suppressed because it is too large
Load Diff
10
index.html
10
index.html
@@ -1,10 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script src="csi.js/csi.min.js"></script>
|
|
||||||
<!-- <script src="http://livejs.com/live.js" charset="utf-8"></script> -->
|
|
||||||
<link rel="stylesheet" href="github-pandoc.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div data-include="dark-sky.html"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
130
package-lock.json
generated
130
package-lock.json
generated
@@ -33,6 +33,21 @@
|
|||||||
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
|
||||||
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg=="
|
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg=="
|
||||||
},
|
},
|
||||||
|
"camelcase": {
|
||||||
|
"version": "5.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
|
||||||
|
},
|
||||||
|
"cliui": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
||||||
|
"requires": {
|
||||||
|
"string-width": "^3.1.0",
|
||||||
|
"strip-ansi": "^5.2.0",
|
||||||
|
"wrap-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"color-convert": {
|
"color-convert": {
|
||||||
"version": "1.9.3",
|
"version": "1.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||||
@@ -46,6 +61,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||||
},
|
},
|
||||||
|
"decamelize": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
|
||||||
|
},
|
||||||
"emoji-regex": {
|
"emoji-regex": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
@@ -61,6 +81,19 @@
|
|||||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
|
||||||
},
|
},
|
||||||
|
"find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"get-caller-file": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
|
||||||
|
},
|
||||||
"is-fullwidth-code-point": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||||
@@ -71,16 +104,66 @@
|
|||||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||||
},
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.15",
|
"version": "4.17.15",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||||
},
|
},
|
||||||
|
"p-limit": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
|
||||||
|
"requires": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
||||||
|
},
|
||||||
|
"path-exists": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
||||||
|
},
|
||||||
"punycode": {
|
"punycode": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||||
},
|
},
|
||||||
|
"require-directory": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
|
||||||
|
},
|
||||||
|
"require-main-filename": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
||||||
|
},
|
||||||
|
"set-blocking": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||||
|
},
|
||||||
"slice-ansi": {
|
"slice-ansi": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
|
||||||
@@ -127,6 +210,53 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"which-module": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
||||||
|
},
|
||||||
|
"wrap-ansi": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^3.2.0",
|
||||||
|
"string-width": "^3.0.0",
|
||||||
|
"strip-ansi": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"y18n": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w=="
|
||||||
|
},
|
||||||
|
"yargs": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-ssa5JuRjMeZEUjg7bEL99AwpitxU/zWGAGpdj0di41pOEmJti8NR6kyUIJBkR78DTYNPZOU08luUo0GTHuB+ow==",
|
||||||
|
"requires": {
|
||||||
|
"cliui": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0",
|
||||||
|
"find-up": "^3.0.0",
|
||||||
|
"get-caller-file": "^2.0.1",
|
||||||
|
"require-directory": "^2.1.1",
|
||||||
|
"require-main-filename": "^2.0.0",
|
||||||
|
"set-blocking": "^2.0.0",
|
||||||
|
"string-width": "^3.0.0",
|
||||||
|
"which-module": "^2.0.0",
|
||||||
|
"y18n": "^4.0.0",
|
||||||
|
"yargs-parser": "^13.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"yargs-parser": {
|
||||||
|
"version": "13.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
|
||||||
|
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
|
||||||
|
"requires": {
|
||||||
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"author": "Kevin Mok",
|
"author": "Kevin Mok",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"table": "^5.4.6"
|
"table": "^5.4.6",
|
||||||
|
"yargs": "^14.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
todo.md
Normal file
24
todo.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Todo
|
||||||
|
- deliver text/HTML depending on User-Agent in header
|
||||||
|
- https://nginx.org/en/docs/http/ngx_http_browser_module.html
|
||||||
|
- https://www.nginx.com/resources/wiki/modules/user_agent/
|
||||||
|
- https://www.whatsmyua.info/api/v1/ua
|
||||||
|
- colors
|
||||||
|
- ANSI escape codes
|
||||||
|
- https://github.com/gabx/archlinux/blob/master/etc/scripts/colortest
|
||||||
|
- icons
|
||||||
|
|
||||||
|
# Done
|
||||||
|
- display both locations
|
||||||
|
- location text
|
||||||
|
- table orientation
|
||||||
|
- credit Dark Sky
|
||||||
|
- "Powered by Dark Sky: https://darksky.net/poweredby/"
|
||||||
|
- Dark Sky image
|
||||||
|
- https://darksky.net/dev/docs/terms
|
||||||
|
|
||||||
|
# Archived
|
||||||
|
- fetch on load
|
||||||
|
- Lua os.execute in Nginx
|
||||||
|
- fetch JSON in JS
|
||||||
|
- generate table dynamically
|
||||||
Reference in New Issue
Block a user