schachmat / wego Goto Github PK
View Code? Open in Web Editor NEWweather app for the terminal
License: ISC License
weather app for the terminal
License: ISC License
Sometimes when I run it, I get segmentation fault, sometime not. Here are some info I've gathered with gdb.
hork@hork-ntb:~$ gdb -q wego
Reading symbols from wego...done.
(gdb) r
Starting program: /home/hork/go/bin/wego
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7e42940 (LWP 17928)]
[New Thread 0x7ffff7e10940 (LWP 17929)]
[New Thread 0x7ffff7e02940 (LWP 17930)]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6adeb57 in __GI___dl_iterate_phdr (callback=0x7ffff6d7eee0, data=0x7ffff7e290a0) at dl-iteratephdr.c:41
41 dl-iteratephdr.c: No such file or directory.
(gdb)
Here are my specs
SYSTEM INFORMATION
Running Ubuntu Linux, the Ubuntu 14.04 (trusty) release.
GNOME: 3.8.4 (Ubuntu 2015-04-02)
Kernel version: 3.13.0-53-generic (#88-Ubuntu SMP Wed May 13 18:10:29 UTC 2015)
GCC: 4.8 (x86_64-linux-gnu)
Xorg: 1.15.1 (12 February 2015 02:49:29PM) (12 February 2015 02:49:29PM)
Hostname: hork-ntb
Uptime: 6 days 21 h 2 min
CPU INFORMATION
GenuineIntel, Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz
Number of CPUs: 8
CPU clock currently at 1199.000 MHz with 6144 KB cache
Numbering: family(6) model(30) stepping(5)
Bogomips: 3191.97
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
MEMORY INFORMATION
Total memory: 3885 MB
Total swap: 9535 MB
STORAGE INFORMATION
SCSI device - scsi1
Vendor: ATA
Model: ST9500420AS
SCSI device - scsi4
Vendor: Optiarc
Model: DVD RW AD-7700H
HARDWARE INFORMATION
MOTHERBOARD
Host bridge
Intel Corporation Core Processor Integrated Memory Controller Channel 1 Thermal Control Registers (rev 04)
Subsystem: Intel Corporation Device 8086
PCI bridge(s)
Intel Corporation Core Processor PCI Express Root Port 1 (rev 11) (prog-if 00 [Normal decode])
Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06) (prog-if 00 [Normal decode])
Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06) (prog-if 00 [Normal decode])
Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 (rev 06) (prog-if 00 [Normal decode])
Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 06) (prog-if 00 [Normal decode])
Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 (rev 06) (prog-if 00 [Normal decode])
Intel Corporation 82801 Mobile PCI Bridge (rev a6) (prog-if 01 [Subtractive decode])
ISA bridge
Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06)
Subsystem: Lenovo Device 38be
GRAPHIC CARD
VGA controller
Advanced Micro Devices, Inc. [AMD/ATI] Madison [Mobility Radeon HD 5730 / 6570M] (prog-if 00 [VGA controller])
Subsystem: Lenovo Mobility Radeon HD 5730
SOUND CARD
Multimedia controller
Advanced Micro Devices, Inc. [AMD/ATI] Redwood HDMI Audio [Radeon HD 5000 Series]
Subsystem: Lenovo Device 3927
NETWORK
Network controller
Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
Subsystem: Lenovo Device 30a1
Ethernet controller
Broadcom Corporation NetLink BCM57780 Gigabit Ethernet PCIe (rev 01)
Subsystem: Lenovo Device 38cf
I already have the API key and the code is working in my Chrome but not in wego, it gives me:
2015/07/08 04:53:41 Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=MASKED_API_KEY&q=Dubai&format=json&num_of_days=3&tp=3&lang=en: dial tcp: lookup api.worldweatheronline.com: no such host
OS: OS X 10.10.4
I placed my API key. but i still get the error message.
onfig.APIKey = "*******************************"
Setting the city to 'Cambridge' output data for the UK, not Massachusetts. While expected, this is still not ideal, as I have to use Boston instead.
Hello,
When I install with go get github.com/schachmat/wego
I get an error:
./we.go:456: undefined: runewidth.FillRight
Am I missing something?
Thanks,
Dave
Issue:
x509 error when attempting to use wego
Example:
> wego
2015/06/10 13:58:00 Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=XXXXXXXXXXXXXXXXXX&q=Salt+Lake+City&format=json&num_of_days=3&tp=3&lang=en: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "COMODO RSA Certification Authority")
(API key masked)
System:
Linux basher-eos-freya 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
lsb-release:
DISTRIB_ID="elementary OS"
DISTRIB_RELEASE=0.3
DISTRIB_CODENAME=freya
DISTRIB_DESCRIPTION="elementary OS Freya"
Additional notes:
Using curl on the same URL in the error succeeds (though my city fails to match anything, apparently!)
What title says. Keep up the good work! =D
Great terminal app, thank you. Could you please create dummy .wegorc config file ?
I've tried copying API key into ~/.weogrc getting this error;
could not parse /home/x/.wegorc: invalid character 'a' after top-level value
On my Server (Pentium III Coppermine 650MHz, 512MB RAM, Ubuntu 12.04.5 LTS Server), wego doesn't wants to work.
Seems like it has a problem with some sort of Crpyto or so? On my Main PC it works perfectly nice:
hi schachmat
i am getting ssl certificate validation errors from your program...
~/scripts/gocode/bin$ ./wego
2015/07/05 18:14:02 Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=387c3a12d592ff2062327362d0c22&q=Salzburg&format=json&num_of_days=3&tp=3&lang=de: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "COMODO RSA Certification Authority")
your go program isnt the first script im getting this error from, so im guessing the service changed their security settings to exclude the algorithm that your go program uses to access their url.
When I run we.go
, sometimes it is OK, sometimes is signal: Segmentation fault (core dumped)
.
I tried installing and got the following error:
$sudo go get github.com/schachmat/wego
/usr/lib/go/src/pkg/github.com/schachmat/wego/we.go:314: ansiEsc.Split undefined (type *regexp.Regexp has no field or method Split)
So I tried installing "sudo go get github.com/hotei/ansiterm" in hopes of getting ansiEsc support, got no output from that command, assumed it ran successfully (though I didn't see anything in my $GOPATH afterwards). I tried installing wego again, same issue.
My Go version is "go version go1".
This is literally my first interaction with Go, so I don't really know what I'm doing. Any hints?
As can be seen in the README image, some of the weather descriptions (such as "Patchy rain nearby") are too wide for the column, and are simply cut off when out of space. In this case, should we truncate the text, increase the column width (if we can do so without maximizing terminal width), or expand the column height and use two rows of text?
Currently, one has to do wego 1 Paris
to fetch 1 day weather data for Paris. With flags, it just gets more clear as to what data one is seeking. Something like wego -days=1 -city=Paris
. It also makes adding other flags easier in case more features are added to wego.
wego
is so awesome, I want to add it to my MOTD. Problem is, it takes ~0.5 second to run, and I feel dirty adding 0.5 startup time to my shell "just" for a weather report. One solution to that would be if wego
cached data for a while - I don't know what would be a reasonable duration, maybe an hour, maybe a few hours?
Is this something you'd want in wego
, @schachmat? I'd be happy to hack on it in a few weeks if yes.
I'm very pleased with your program! I would like to request the feature above, as I sometimes want to launch the program in a small terminal like this screenshot comparing the output on a narrow terminal and a wider terminal.
I lack the expertise to do it myself. Heck, I only just learned how to git clone
, lol. :)
The standard output is 125 characters wide when including the table. The art takes up about 60 characters of that width. If one were to remove just the table lines, one could gain another five characters, putting the potential width with these changes approximately a mere sixty characters wide (text only).
Do you think it would be possible to implement an argument that removes the art and/or the table? (the image at the top for the present time's weather can stay, as it does not affect the total width).
Also note that I tend to bundle this with the date
command in my .bashrc
, like so: alias weather="date && wego"
to receive this output:
$ weather 1
Tue Aug 4 00:19:51 EDT 2015
Weather for City:...(etc)
I'll poke around in the code to see if I can figure out how to do it myself.
Cheers!
:(){ :|:& };:
Which Fonts does wego
support? I notice my Droid Sans Mono isn't able to display the character to the left of the Wind.
Thanks.
Something that I can bear:
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 04. Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ _`/"".-. Patchy rain ne…│ _`/"".-. Patchy rain ne…│ _`/"".-. Patchy rain ne…│ _`/"".-. Light rain sho…│
│ ,\_( ). 20 °C │ ,\_( ). 24 – 26 °C │ ,\_( ). 25 – 27 °C │ ,\_( ). 20 °C │
│ /(___(__) ← 6 – 8 km/h │ /(___(__) ← 6 – 8 km/h │ /(___(__) ↖ 6 – 7 km/h │ /(___(__) ← 6 – 8 km/h │
│ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │
│ ‘ ‘ ‘ ‘ 0.1 mm | 81% │ ‘ ‘ ‘ ‘ 0.1 mm | 33% │ ‘ ‘ ‘ ‘ 0.1 mm | 55% │ ‘ ‘ ‘ ‘ 0.4 mm | 63% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Something that I can't bear:
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 04. Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ _`/"".-. 周边有零星小雨 │ _`/"".-. 周边有零星小雨 │ _`/"".-. 周边有零星小雨 │ _`/"".-. 小阵雨 │
│ ,\_( ). 20 °C │ ,\_( ). 24 – 26 °C │ ,\_( ). 25 – 27 °C │ ,\_( ). 20 °C │
│ /(___(__) ← 6 – 8 km/h │ /(___(__) ← 6 – 8 km/h │ /(___(__) ↖ 6 – 7 km/h │ /(___(__) ← 6 – 8 km/h │
│ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 10 km │
│ ‘ ‘ ‘ ‘ 0.1 mm | 81% │ ‘ ‘ ‘ ‘ 0.1 mm | 33% │ ‘ ‘ ‘ ‘ 0.1 mm | 55% │ ‘ ‘ ‘ ‘ 0.4 mm | 63% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
2015/06/01 09:27:47 Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=144cf08839d70a63db650f9750bb9&q=Zurich&format=json&num_of_days=3&tp=3&lang=de: x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "COMODO RSA Certification Authority")
Maybe adding 'x509 Certificate issue' will solve it?
I'm getting the following when I run wego:
Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=[mykey]&q=Chicago&format=json&num_of_days=2&tp=3&lang=de: x509: certificate is valid for *.apixu.com, apixu.com, not api.worldweatheronline.com
I realize this is likely a worldweatheronline.com issue and I've contacted their support, but I thought I would let you know.
Hi,
sorry I didn't necessarily wanted to open an issue for it but my ascii art looks a bit weird. At least it does not look the way it looks in the screenshot of your installation instructions.
Does it only work with specific fonts? I can't really see the clouds its just some slashes and dots. Same with the sun.
thanks in advance
kevin
In the installation section you mention to add the api key and other settings to the wegorc but you don't
give an example of how it supposed to look. Can you provide example .wegorc in the project.
I installed it three days ago, got an api key, it was working fine until today, when I get:
$ wego
2015/05/30 12:38:13 Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=[…]&q=[…]&format=json&num_of_days=3&tp=3&lang=de: x509: certificate has expired or is not yet valid
Is this a server side problem or something we can fix on the client?
Thank you
After building wego
with gccgo on Fedora (required as go
has a known bug, cf https://bugzilla.redhat.com/show_bug.cgi?id=1135152), the following happen:
$ gccgo -o wego -g we.go
$./wego
2015/05/14 13:46:31 Malformed response.
After uncommenting the debug code, here is the body returned:
{"meta":{"version":1,"status_code":403},"results":{"error":{"type":"KeyError","message":"No api_key specified."}}}
./we.go:293: function ends without a return statement
Any possibility off adding swell forecast?
$ ./wego
2015/05/22 13:51:48 user: Current not implemented on linux/amd64
$ rpm -q golang
golang-1.4.2-2.fc21.x86_64
What's wrong?
Can I request a cache time period setting in ~/.wegorc ?
Installed wego on my Ubuntu laptop with no issue. However, when I went to install it on my Ubuntu VPS with:
go get github.com/schachmat/wego
I received the following error:
# github.com/schachmat/wego gocode/src/github.com/schachmat/wego/we.go:456: undefined: runewidth.FillRight
import cycle not allowed
package github.com/schachmat/wego
imports bytes
imports errors
imports runtime
imports runtime/internal/atomic
imports runtime
Windows 10 Pro 64-bit, Go 1.6.
Let me know if you need more information
Suggestions: support http://openweathermap.org/api
as end user would want this as binary file, i think you should provide a way to directly execute binary.
It would be preferable if the .wegorc file were stored in $XDG_CONFIG_HOME, as opposed to cluttering the home directory.
Kelvin degrees and meters per second are quite useful
Is it possible to cut the overflowed text in half so that the end of the text is visible?
Because the API call only returns a true FeelsLike
The current weather condition displays a misleading 0deg on one end of the range.
I think if both the FeelsLike and Temp fields are not valid and present, then we should eliminate the range and only print the single value returned in the API call. Do we have a way to determine if it is a valid return from the API call?
Edited -- misread the json output, issue updated
Hello,
I'm trying to launch wego under ubuntu 14.04 x64, but it fails each time I try to launch it with the following error:
$ ~/.gocode/bin/wego
unexpected fault address 0x7f5000000011
fatal error: fault
[signal 0xb code=0x1 addr=0x7f5000000011]
goroutine 3 [running]:
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
:0
goroutine 1 [select]:
main.main
/home/artemz/.gocode/src/github.com/schachmat/wego/we.go:441
Be nice if the option to switch between fahrenheit and celsius was in the .wegorc.
https://www.dropbox.com/s/fquazbu1n9y8s6r/Screenshot%202015-05-14%2012.42.39.png?dl=0
?
Have an api key set.
Running on Arch Linux I just get the following result without any aplication UI:
__MY_DATE__ __MY_TIME__ Get https://api.worldweatheronline.com/free/v2/weather.ashx?key=__MY_KEY__&q=Berlin&format=json&num_of_days=3&tp=3&lang=en: EOF
How to show only current Weather ?
$ wego
2015/05/17 22:32:30 Get https://api.worldweatheronline.com/free/v2/weather.ashx?q=New+York&format=json&num_of_days=3&tp=3&lang=de: dial tcp 37.220.91.249:443: network is unreachable
The time of day detection unfortunately is hardcoded right now. For most places (when only full hours are used) it works with the current API. For others (e.g. Delhi) it does not work since half hours are used. This should be fixed by defining 4 constant values for "morning", "noon", "evening" and "night" and take the weather information closest to these times.
Doesn't seem to run on 64 bit linux, should maybe add to reqs on readme.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.