Convert fish script to Bash
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
*.txt
|
*.txt
|
||||||
|
|
||||||
api-keys-fish.sh
|
api-keys*.sh
|
||||||
*.json
|
*.json
|
||||||
|
|
||||||
# node {{{ -
|
# node {{{ -
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/fish
|
|
||||||
|
|
||||||
source api-keys-fish.sh
|
|
||||||
|
|
||||||
# takes (coords, location_name) as parameters
|
|
||||||
function update-weather-json
|
|
||||||
set curl_url "https://api.darksky.net/forecast/$DARK_SKY_KEY/$argv[1]?exclude=minutely%2Cdaily%2Calerts%2Cflags&units=auto"
|
|
||||||
curl --request GET --url $curl_url > $argv[2].json
|
|
||||||
# echo "curl --request GET --url $curl_url > $argv[2].json"
|
|
||||||
end
|
|
||||||
|
|
||||||
update-weather-json "43.8180904,-79.3350555" "markham"
|
|
||||||
update-weather-json "43.6596426,-79.3976676" "toronto"
|
|
||||||
|
|
||||||
node dark-sky.js > dark-sky.txt
|
|
||||||
@@ -70,5 +70,6 @@ logTablePromises = [
|
|||||||
logWeatherJson('./markham.json', 'Markham'),
|
logWeatherJson('./markham.json', 'Markham'),
|
||||||
logWeatherJson('./toronto.json', 'Toronto')]
|
logWeatherJson('./toronto.json', 'Toronto')]
|
||||||
Promise.all(logTablePromises).then(results => {
|
Promise.all(logTablePromises).then(results => {
|
||||||
log(`${CREDIT_MSG}\n\nLast updated: ${new Date().toLocaleTimeString()}`)
|
const now = new Date()
|
||||||
|
log(`${CREDIT_MSG}\n\nLast updated: ${now.getHours()}:${now.getMinutes()}`)
|
||||||
})
|
})
|
||||||
|
|||||||
16
dark-sky.sh
Executable file
16
dark-sky.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/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 > dark-sky.txt
|
||||||
|
# node dark-sky.js
|
||||||
11
todo.md
11
todo.md
@@ -1,5 +1,4 @@
|
|||||||
# Todo
|
# Todo
|
||||||
- add to my site
|
|
||||||
- deliver text/HTML depending on User-Agent in header
|
- deliver text/HTML depending on User-Agent in header
|
||||||
- https://nginx.org/en/docs/http/ngx_http_browser_module.html
|
- https://nginx.org/en/docs/http/ngx_http_browser_module.html
|
||||||
- https://www.nginx.com/resources/wiki/modules/user_agent/
|
- https://www.nginx.com/resources/wiki/modules/user_agent/
|
||||||
@@ -7,10 +6,6 @@
|
|||||||
- colors
|
- colors
|
||||||
- ANSI escape codes
|
- ANSI escape codes
|
||||||
- https://github.com/gabx/archlinux/blob/master/etc/scripts/colortest
|
- https://github.com/gabx/archlinux/blob/master/etc/scripts/colortest
|
||||||
- fetch on load
|
|
||||||
- Lua os.execute in Nginx
|
|
||||||
- fetch JSON in JS
|
|
||||||
- generate table dynamically
|
|
||||||
- icons
|
- icons
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
@@ -21,3 +16,9 @@
|
|||||||
- "Powered by Dark Sky: https://darksky.net/poweredby/"
|
- "Powered by Dark Sky: https://darksky.net/poweredby/"
|
||||||
- Dark Sky image
|
- Dark Sky image
|
||||||
- https://darksky.net/dev/docs/terms
|
- 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