pull/2/head
Steven Saus 4 years ago
parent 14a3e30d57
commit 7759fc9fec
  1. 176
      .gitignore
  2. 117
      docs/README.md
  3. 1
      docs/_config.yml
  4. 74
      docs/_layouts/default.html
  5. 15
      docs/assets/css/style.css
  6. BIN
      weather-icon.png

176
.gitignore vendored

@ -0,0 +1,176 @@
# reference, old shit
1_reference/
# macOS Junks
.DS_Store
# VSCode Junks
.vscode
.vscode/*
# Microsoft Office Junks
~$*.*
# C/C++ Junks
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Python Junks
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
share/
bin/
bin/*
include/
include/*
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
Pipfile.lock
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/

@ -0,0 +1,117 @@
# weather.sh and forecast.sh
A bash script to get the weather and forecast from OpenWeatherMap and output
to the terminal, Openbox, or HTML
![Output example](https://raw.githubusercontent.com/uriel1998/weather.sh/master/example_output.png "Example output")
## Contents
1. [About](#1-about)
2. [License](#2-license)
3. [Prerequisites](#3-prerequisites)
4. [How to use](#4-how-to-use)
5. [TODO](#5-todo)
***
## 1. About
Weather report written in Bash.
`weather.sh` gets the current weather from
[OpenWeatherMap](http://openweathermap.org/) and displays the
results to the terminal, HTML, or for an OpenBox pipe menu. It will
calculate (if appropriate) the "feel like" weather by calculating the
wind chill or heat index. A great deal of basis for this script comes
from [BashWeather](https://github.com/jdotjdot/BashWeather),
[bash-weather](https://github.com/szantaii/bash-weather),
and many more that I forgot to save the URLs of.
`forecast.sh` gets the forecast from [OpenWeatherMap](http://openweathermap.org/)
and likewise displays the results. OpenWeatherMap forecasts are at three hour
intervals (0800, 1100, 1400, etc). It displays all forecasts for the next
twenty four hours, then displays the closest time forecast for the day after
that. For example, if it's 1136 (as I'm writing this) it shows all forecasts
through the 1100 forecast the next day, then the 1100 forecast for each
subsequent day. Options and `.rc` file are *the same* as for `weather.sh`.
If you wish to show both together, simply execute:
`weather.sh && forecast.sh`
## 2. License
This project is licensed under the MIT license. For the full license, see `LICENSE`.
## 3. Prerequisites
* OpenWeatherMap API key ([http://openweathermap.org/appid](http://openweathermap.org/appid)).
* Bash shell ≥ 4.2.
* `bc` basic calculator for floating point arithmetic. Can be found in the
`bc` package on major Linux distributions.
* `curl` command-line tool for getting data using HTTP protocol. cURL can be
found in the `curl` package on major Linux distributions.
* `grep` command-line tool used for parsing downloaded XML data. `grep` can
be found in the `grep` package on major Linux distributions.
* `jq` command-line tool for parsing JSON data. `jq` can be found in the `jq`
package on major Linux distributions.
* `tr` command-line tool for parsing JSON data. `tr` can be found in the `tr`
package on major Linux distributions.
* `awk` command-line tool for parsing JSON data. `awk` can be found in the
`awk` package on major Linux distributions.
Optional: For colors in terminal, save `bashcolors` in this repository to
`.bashcolors` in your `$HOME` directory.
## 4. How to use
Run `weather.sh` or `forecast.sh` with the appropriate commandline switches
(below). If the current conditions do not qualify for the heat index or wind
chill, it is not displayed.
### weather_sh.rc
Copy (and edit, as appropriate) the `weather_sh.rc` file to `$HOME\.config\weather_sh.rc`.
* The first line is the OpenWeatherMap API key
* The second line is your default location. (See note below)
* The third line is your default degree character (either `c` or `f`)
* The fourth line is True or False depending on whether or not you want icons displayed for the weather.
### Command-line options
`weather.sh` and `forecast.sh` can be started with the following command line
options:
* `-k` Specifies OpenWeatherMap API key from the command-line.
* `-l city_name` Sets the city for manual weather lookup. (see note below)
* `-t` Output to the terminal/stdout (default if no output is specified)
* `-h` Output HTML formatted text
* `-o` Output OpenBox output
* `-y` Output Conky format (no icons)
* `-f` Use imperial (farenheit, inches Hg, mph) units; default is metric
* `-c` Use colored output in the terminal if `.bashcolors` is in the home
dir. Note that if you want to alter the colors, you will have to manually
alter the script.
_Note: If the OpenWeatherMap API key is specified from the command-line, it
will override the API key set in the file._
_Note: It is **STRONGLY** recommended to use the City ID from OpenWeatherMap
instead of a city name. Instructions on finding your city's City ID
[here](https://www.dmopress.com/openweathermap-howto/) ._
### Calling from Conky
I have a single line config for my secondary screen with the weather config
in it:
`Now: ${execi 300 weather.sh -y} Forecast: ${execi 300 forecast.sh -y}`
The conky output is currently limited via code to just the next five outputs.
## 5. Todo
* Add in sunrise/sunset
* HTML colored output
* Current location instead of hardcoded
- this is problematic due to the way the API looks up city names.

@ -0,0 +1 @@
theme: jekyll-theme-midnight

@ -0,0 +1,74 @@
<!doctype html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{% seo %}
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="{{ '/assets/js/respond.js' | relative_url }}"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lt IE 8]>
<link rel="stylesheet" href="{{ '/assets/css/ie.css' | relative_url }}">
<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div id="header">
<nav style="margin: 0 auto;">
<li class="fork" style="margin-left: 5px !important;margin-right: 5px !important;"><a href="{{ site.github.repository_url }}" target="_blank">View On GitHub</a></li>
<li class="fork" style="margin-left: 5px !important;margin-right: 5px !important;"><a href="https://gitlab.com/uriel1998/{{ site.github.repository_name }}" target="_blank">View On GitLab</a></li>
<li class="fork" style="margin-left: 5px !important;margin-right: 5px !important;"><a href="https://git.faithcollapsing.com/{{ site.github.repository_name }}" target="_blank">View On My Git</a></li>
{% if site.show_downloads %}
<li class="downloads"><a href="{{ site.github.zip_url }}">ZIP</a></li>
<li class="downloads"><a href="{{ site.github.tar_url }}">TAR</a></li>
<li class="title">DOWNLOADS</li>
{% endif %}
</nav>
</div><!-- end header -->
<div class="wrapper">
<section>
<div id="title">
<h1>{{ site.title | default: site.github.repository_name }}</h1>
<p>{{ site.description | default: site.github.project_tagline }}</p>
<hr>
<span class="credits left">Project maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></span>
<span class="credits right">Hosted on GitHub Pages &mdash; Theme by <a href="https://twitter.com/mattgraham">mattgraham</a></span>
</div>
{{ content }}
</section>
<hr />
<p><a href="https://uriel1998.github.io/" target="_blank">Steven Saus</a> injects people with radioactivity for his day job, but only to serve the forces of good.<br />Mostly.</p>
<div style="margin: 0 auto;">
<a href="http://feeds.feedburner.com/Ideatrash" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/rss-solid.svg"></a>
<a href="https://faithcollapsing.com/users/StevenSaus" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/mastodon.svg"></a>
<a href="http://www.facebook.com/pages/Steven-Saus/328725503674" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/facebook-f.svg"></a>
<a href="http://www.twitter.com/uriel1998" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/twitter.svg"></a>
<a href="https://www.instagram.com/uriel1998/" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/instagram.svg"></a>
<a href="http://www.goodreads.com/author/show/3145527.Steven_Saus" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/goodreads.svg"></a>
<a href="https://git.faithcollapsing.com" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/git.svg"></a>
<a href="https://github.com/uriel1998" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/github.svg"></a>
<a href="https://gitlab.com/uriel1998" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/gitlab.svg"></a>
<a href="http://www.linkedin.com/in/stevensaus" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/linkedin-in.svg"></a>
<a href="https://www.amazon.com/author/stevensaus" target="_blank"><img width=32px height=32px src="https://raw.githubusercontent.com/uriel1998/uriel1998/main/icons/amazon.svg"></a>
</div>
</div>
{% if site.google_analytics %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
</body>
</html>

@ -0,0 +1,15 @@
---
---
@import "{{ site.theme }}";
#header {
margin: 0 auto !important;
}
#header > nav {
margin: 0 auto;
background: none !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Loading…
Cancel
Save