SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1701 2015-01-31 09:57:13

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

lol  I've no idea what you're talking about  tongue


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

Be excellent to each other!

#1702 2015-02-01 01:03:17

Mpok
Member
Registered: 2014-12-06
Posts: 28
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Hello,
I have some BAD news and some GOOD news…

The BAD :
I didn't wrote a SINGLE LINE since beginning of January… yikes Got some personal pbms which took me out the keyboard  neutral

The GOOD :
I've tested yesterday the 'principle' of my dev : "reducing the 'exec' in conky files". It works !!
Was on my 'general' conky (standard one : infos, partitions, mem, cpu, net). Reducing 28-40 processus to ~10 IS valuable ! lol
And for :

TeoBigusGeekus wrote:

All the scripts are light; we're talking about downloading a web page with wget and parsing it with a few bash lines to isolate the necessary info for conky to collect.

Sorry my friend, but they ARE NOT light.
=> And that's why i would like to help with my contribution. If u mind…
On your script, for the 'display only' , u launch 46 processus…  :8 => I launch 0 processus for the same work (as the values are already in memory). The gain is obvious…  smile
On update process, the gain is less obvious, but still is. Even on the 'init' process (which is MUCH MORE complete in my way, with the config file parsing), i think i gained (not tested).
So : "light", NO… Just admit it.
(Note : i don't want to have an argue with u… What i say is these scripts could be 'over updated'. Agreed ?)

On my dev :
- Parsing is 90% done. The rest needs tests (mean different times and locations).
- Conkyrc is "Current + Today/Tonight".

What i've gone at the moment is there (image).
test lua
It"s a melt between 'Current' in English (close to yours…) and 'Today/Tonight' in French (as i wanted to check offset).

My pbms & questions :

  • seems lua cannot return the value '0' ?? Seems a bug or smthg i didn't noted. The only soluce i found is to return the string "Nul" (as u can see on the image, Current UV Index).

  • what about widh ? I first tend to reproduce ur conkyrc, Still, we have some diffs : i don't have 'RealFeel' for today/night, BUT i have several other values (Storms, Rain, Snow, etc…).
    => In order to print these infos, AND to prevent a LONG window, I NEED a 400 px window (let's see on the image, it's already tight with 400px). Is that a pbm ? (urs is 350)

=> Next week (not before Feb, 9) : version alpha 1 - just init, testing

Last edited by Mpok (2015-02-01 01:54:21)

Offline

#1703 2015-02-01 10:06:00

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

I was talking about my scripts: they ARE light.
My conkyrcs? Perhaps not so.
It had previously occured to me that I could create (within the script) a text file with all conky info gathered together (in conky format) and then call the text file from within conky with only one exec command.
But I don't like this approach as it takes away the user's freedom to create a final conky screen of their liking: my contribution is one or more text files with weather info in them. The users can do whatever they want with them.

I don't want to argue no more, I just wish you good luck and I hope to see your light Lua scripts as soon as possible.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1704 2015-02-20 08:10:21

Mpok
Member
Registered: 2014-12-06
Posts: 28
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sorry for the late answer…

I didn't argue ever, just pointing facts (as i follow my own way) : ur scripts/conkyrc COULD BE IMPROVED…
That's just it. And that's the goal of this forum, no ? Taking things, and trying to contribute in improvements or different ways…

TeoBigusGeekus wrote:

I was talking about my scripts: they ARE light.

I don't think so neutral . Can i've a different view from yours ?
It's NOT A BIG DEAL, tho. Except from the beginning (the $addr1 and $addr2, which could be done WITHOUT any 'echo' or 'sed'), the last IS pretty ok. Still, reading the SAME file for 14 times (for "Current Condition") is not optimized, no ? A "sed script" would be better (one sed, one reading).
=> So, it's minor (as the 'wget' takes much more time than the benefit), BUT i had to point it out.

TeoBigusGeekus wrote:

My conkyrcs? Perhaps not so.
It had previously occured to me that I could create (within the script) a text file with all conky info gathered together (in conky format) and then call the text file from within conky with only one exec command.
But I don't like this approach as it takes away the user's freedom to create a final conky screen of their liking: my contribution is one or more text files with weather info in them. The users can do whatever they want with them.

Thks to recognize smile . If for the 'sh' scripts we were on 3-5% improvement, we're here on 80-90 % !!! tongue
Agree with u about ur 'false-good' idea : grouping features are always bad for users's freedom.
=> I propose a mix : there are "all conky info gathered together" BUT IN MEMORY (that's the crucial point in my dev). And users can choose to use them or not in their conkys (as yours). BUT as it is in memory, NO PROCESS needed to retrieve them… (that's the improvement wink ).

=> Conclusion :

  • As a Dev, we should admit critics about our code, which can always been improved or changed. That's the basics of 'free-programming'. I DO code "in emergency mode" and blame myself later. Even my "best-coded" prgs have sometimes some bugs. It's the way it goes.

  • As this topic is yours, TeoBigusGeekus, it's up to u to decide if u want my help or not on that subject. I will NOT mind if u say no. I can understand u want to preserve ur topic from different "ways" (i admit it's a TOTALLY DIFFERENT way).  Maybe should have to create a new topic ? Seems ok for me.

Offline

#1705 2015-02-20 10:43:33

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Chill out man!
No reason for arguing whatsoever... lol

Do whatever you want, but with my present hectic schedule I don't think I can follow your admitedly totally different way of doing things. So it would be unfair to you to restrict yourself in this thread; creating a new one will make sure that more people will be able to notice your work  wink


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1706 2015-02-20 12:46:46

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

/mod hat off - personal comments

As a user and supporter of Teo's weather scripts, I also run v9000 - a pure LUA weather script, use to run conkyForecast and pretty well any other weather script out there I think I can rightfully say Teo's scripts are very light on resources.

Every day I boot to 13 conkys - four are in windows - I read them and close them - usually until the next boot that leaves 9 conkys running.
Two are Teo's "1b1_int.conky" scripts, a full one of Desktop 1 for me and a small one for my wife on Desktop 4

So here I am, iceweasel is open, claws-mail is open and Thunar open twice and my CPU average is sitting at 6% as seen on the right.
2015_02_20_08_38_02_58x878_Sector11.jpg

When I open my v9000 all LUA script I watch my cpu usage climb to 14-15% - that's why it's in a window - read it close it.
2015_02_20_09_03_00_1920x1080_Sector11.jpg
Other LUA conkys I have here still push things to double digits: 2015_02_20_09_16_47_1920x1080_Sector11.jpg

Teo's scripts serve their purpose, nice light, highly configurable and come in a variety of flavours - weather fonts - images - RSS feeds, different sites - and even a nice moon script.

There is even one TeoBigusGeekus script that isn't here in his thread, it exists because I asked for it.
2015_02_20_09_33_56_1920x1080_Sector11.jpg
Current conditions around the world from a Chinese weather site.  Looks like I'll have to tweak that one - the 'night' shade seems to be off.

Teo, to the best of my knowledge, doesn't have LUA on his machine, he uses one of his scripts with a weather font.  The rest of his scripts here, at least from my requests, exist because of requests from other users - Hey Teo, how about XYZ weather site.

@ Mpok  And to be totally honest here, I have been waiting patiently to see something from you, something I can see on my desktop with weather in it.  Maybe a new thread is a better idea.  Start one ... put something out that works and I'll be there with bells on.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1707 2015-02-20 15:54:54

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

Teo, to the best of my knowledge, doesn't have LUA on his machine, he uses one of his scripts with a weather font.

I confirm that: the distro I use (Arch) doesn't support lua in its official conky package (Keep It Simple Stupid); in order to have lua one has to use the conky-lua AUR package.

Other than that, S11, you're the ONE conky master, I tip my hat to you. I've seen your conkys throughout time, but never all of them together.
That's what I'd call "conky extravaganza"!!!  lol


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1708 2015-02-20 18:10:55

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

lol  lol  lol all at once  lol  lol  lol
OH THAT'S TOO GOOD! Teo, my friend, you have only ever seen the scrapings of the surface.

I'd need 100 desktops and still never get "all" the conkys I have here up and running.

  1. ~/ - has 25 directories dedicated to conkys (ALL of your scripts are there - OOTB)

  2. /media/5/ -  has 15 ... but two of those are HUGE

    1. ~/media/5/Conky - my main area

      • - 73 Sub directories - most with other sub-directories (all of yours are here too - tweaked to work here)

      • - 231 conkys

    2. ~/media/5/conky - my test/play area

      • - 179 sub-directories - again like above, many with other sub-directories

      • - 706 - conkys

and then in /media/5/zip-tar-gz/ I have another 12 directories with things like "archived" conky setups, see: ~/media/5/conky, found around the net, all the .deb versions of conky since I started using it (2007), including a release: conky_2.0-git20121020 that I don't use.  I still have all releases of conkyForecast that Mark put out even though it doesn't work anymore (call it historical archive)  lol  In fact I have ALL of Mark's conky apps here - all python scripts.  I still use conkyMail and conkyMisc (conkySlideshow, conkyDatetimeDiff, conkyDateDiff conkyDaysDiff, ConkyText and ConkyLatLong)

Something "rarely" seen ... my system at boot up:
Desktop_1.jpg<- 1 - Desktop - 2-> Desktop_2.jpg

Desktop_3.jpg<- 3 - Desktop - 4 -> Desktop_4.jpg
Desktop 1 - my main work area.
Desktop 2 - just because
Desktop 3 - play with conkys here
Desktop 4 - my wife's playground.
At the time I took the screenshots I had: iceweasel (6 tabs - one online radio: 104.5 CHUM FM), claws-mail, thunar, gimp and mirage running

conkyMisc has some neat stuff and they work in a terminal as well:

 20 Feb 15 | 15:05:48 ~
    $ conkyLatLong
-34.612999 / -58.470001
 
 20 Feb 15 | 15:06:00 ~
    $ conkyLatLong -i
34°36"46.7964'S / 58°28"12.0036'W
 
 20 Feb 15 | 15:06:07 ~
    $ conkyDaysDiff 20000101
5529
 
 20 Feb 15 | 15:06:51 ~
    $ conkyDatetimeDiff -s 20000101
15 yrs 1 mth  19 days
 
 20 Feb 15 | 15:07:11 ~
    $ 

Of course LatLong is only as accurate as your current ISP is on the net - a guesstimate - kinda like 'weather' - not an exact science.

@ Mpok - Trust me - If you build it - I will test/bend/fold and mutilate it and support it if I like it!  wink

EDIT:  Teo: You do know that Mark's apps (Kaivalagi) are in an AUR someplace don't you? They are all python scripts.

Last edited by Sector11 (2015-02-20 18:17:22)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1709 2015-02-20 21:19:14

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

EDIT:  Teo: You do know that Mark's apps (Kaivalagi) are in an AUR someplace don't you? They are all python scripts.

Yeah, yeah I know, he's an Archer as well.

I do admire your creativity mate; I'd never seen your desktop(s) before...


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1710 2015-02-20 21:38:21

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Is or was?  Hmmmmmmmm must email him again  big_smile

Thank you ... I'm retired - lots of free time helps.  I think that's the only time I've ever posted all my desktops in one place.  big_smile
I know for the most part they go against the KISS principle you like ... but I like to play   wink


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1711 2015-02-20 22:48:05

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

... but I like to play   wink

Thank God for that...  wink


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1712 2015-02-21 18:59:01

bobc
Member
From: Chicago
Registered: 2014-12-11
Posts: 17

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Mine is not as pretty, but has lots of functionality that can run on slow laptops with minimal memory or cpu usage.  In this pic is running on my best laptop 2 processors and 4 gb RAM under Slacko 5.7.0 with 50 chrome tabs/windows open...

SAU29IC.png?1

Last edited by bobc (2015-02-21 19:02:53)


This is a neat site and seems to have lots of useful questions and answers.  I'm just learning linux and like to learning by doing.  Sometimes I really don't know, LOL.

Offline

#1713 2015-02-22 10:28:41

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Simple and informative. Nice  cool


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1714 2015-02-22 11:27:09

bobc
Member
From: Chicago
Registered: 2014-12-11
Posts: 17

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

The hard parts were doing the color coded bars for cpu usage, ram, swap, and space avail, and the routine that pares down the NWS 7 day text forecast down, first expanding it to long lines, then phrase by phrase, abbreviating to get it shorter so that when it gets word wrapped it takes many fewer lines, so there is space for the color coded calendar. 

Somehow I need to make it beep do something to get my attention before battery power gives out, though, perhaps with sound or popup windows.  I also need to build in my low swap space warning system, but on this machine with everything running from a 32 gb SSD its not really needed.

I also need to learn how to do temp files properly.  My current 7 day forecast script uses 8 or 9 temp files to massage the data leaving a trail of debugging breadcrumbs, but to be honest, I don't know enough about linux architecture to know where they should be put or named.  Every program seems to do things differently it seems.

Both the conky and scripts are very efficient for older cpu's because the conky interval is wide and the weather ones wider, and I'm downloading the text file which is quite small.  I think it would be too tight to try to get the current and 7 day, both day and in pics onto the screen at one time, so I haven't attempted it.  I suppose if I was to lose my calendar it would be possible at that point, especially with my trimmed down text, which I could abbreviate more if I used picture icons...

Here is the conky itself:

# Update interval in seconds
update_interval 5

text_buffer_size 6000
max_specials 600

# set to yes if you want Conky to be forked in the background
background yes

short_units yes

cpu_avg_samples 2
net_avg_samples 2

out_to_console no

# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font 6x10
#font 7x13
 font 8x12
#font 7x12
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
#font -artwiz-snap-normal-r-normal-*-*-100-*-*-p-*-iso8859-1

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Sans:size=10

# Create own window instead of using desktop (required in nautilus, pcmanfm and rox desktops)
own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar

# Text alpha when using Xft
xftalpha 0.8

#on_bottom no

# mail spool
#mail_spool $MAIL

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 445 845
maximum_width 545

# Gap between borders of screen and text
# x = distance from right edge
# y = distance from top edge
gap_x 18
gap_y 2

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
#border_margin 10

# border width
border_width 2

# color scheme
color0 black
color1 red
color2 green
color3 yellow
color4 blue
color5 magenta
color6 cyan
color7 white
# hot pink
#color8 #FF078B
# flourecent orange
#color9 #FF9C07

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer right

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# boinc (seti) dir
# seti_dir /opt/seti

# stuff after 'TEXT' will be formatted on screen
TEXT
###${font Sans:size=10}${color2}Host: 
${font Sans:size=16}${color #FF078B}${nodename}  ${font Sans:size=10}${alignr 39}${color2}Date: ${color}${time %c}
${color2}CpuAvg: ${color}${freq_g}Ghz ${machine} - ${color}${cpu}%            ${color2}System/kernel: ${color}$sysname $kernel
${color2}  Cpu 1: ${color}${cpu cpu1}% \
${if_match ${cpu cpu1} <= 50}\
${color green}${cpubar cpu1 9}\
${else}\
	${if_match ${cpu cpu1} <= 80}\
${color orange}${cpubar cpu1 9}\
	${else}\
${color red}${cpubar cpu1 9}\
	${endif}\
${endif}
${color2}  Cpu 2: ${color}${cpu cpu2}% \
${if_match ${cpu cpu2} <= 50}\
${color green}${cpubar cpu2 9}\
${else}\
	${if_match ${cpu cpu2} <= 80}\
${color orange}${cpubar cpu2 9}\
	${else}\
${color red}${cpubar cpu2 9}\
	${endif}\
${endif}
${color2}Bat:   ${color}${battery BAT0}\
${if_match "$battery_short"<"D"}\
	${if_match ${battery_percent BAT0} <= 40}\
${color red} ${battery_bar 9 BAT0}${color2}\
	${else}\
		${if_match ${battery_percent BAT0} <= 80}\
${color orange} ${battery_bar 9 BAT0}${color2}\
		${else}\
${color green} ${battery_bar 9 BAT0}\
		${endif}\
	${endif}\
${else}\
	${if_match ${battery_percent BAT0} <= 40}\
${blink ${color red} ${battery_bar 9 BAT0} }${color2}\
	${else}\
		${if_match ${battery_percent BAT0} <= 80}\
${color orange} ${battery_bar 9 BAT0}${color2}\
		${else}\
${color green} ${battery_bar 9 BAT0}\
		${endif}\
	${endif}\
${endif}
${color2}Ram : ${color}$mem${color}/${color}$memmax ${color}- $memperc% \
${if_match ${memperc} <= 50}\
${color green}${membar 9}\
${else}\
	${if_match ${memperc} <= 80}\
${color orange}${membar 9}\
	${else}\
${color red}${membar 9}\
	${endif}\
${endif}
${color2}Swap: ${color}$swap${color}/${color}$swapmax ${color}- ${color}$swapperc%    \
${if_match ${swapperc} <= 25}\
${color green}${swapbar 9}\
${else}\
	${if_match ${swapperc} <= 60}\
${color orange}${swapbar 9}\
	${else}\
${color red}${swapbar 9}\
	${endif}\
${endif}
${color2}Root:${color} ${fs_free /}Free ${color}= ${fs_free_perc /}%       \
${if_match ${fs_free_perc} <= 25}\
${color red}${fs_bar 9}\
${else}\
	${if_match ${fs_free_perc} <= 50}\
${color orange}${fs_bar 9}\
	${else}\
${color green}${fs_bar 9}\
	${endif}\
${endif}
${color2}Wireless: ${color}${wireless_essid wlan0} ${color2}IP:${color} ${addr wlan0} ${color2}spd: ${color} ${wireless_bitrate wlan0} ${color2}strength: ${color3} ${wireless_link_bar 9 wlan0}
${color2}Processes: ${color}$processes  ${color2}Running: ${color}$running_processes ${color2}Uptime: ${color}$uptime   ${color2}wlan0 Up/Dn ${color}${upspeed wlan0}${color2}/${color}${downspeed wlan0}
${color2}Name                 PID    CPU%  MEM%                            ${color2}eth0 Up/Dn ${color}${upspeed eth0}${color2}/${color}${downspeed eth0}
${color} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color2}News Headlines:
${color}${execi 60 conky-rss.sh http://feeds.abcnews.com/abcnews/topstories 9 2}
${font Sans:size=10}${color2}NWS Current Weather and Forecast:
${font Sans:size=10}${color3}${execi 300 getweatherc.sh KORD}
${font Sans:size=8}${color}${execi 1200 getweather7d.sh il/ilz014.txt}
${font Ubuntu Mono:bold:size=15}${color2}                         ${time %B} ${time %Y}
${color3}${font Ubuntu Mono:bold:size=15}${execpi 600 DJS=`date +%_d`; cal | sed '1d' | sed '2s/^/\${color}/' | sed 's/^/                         /g' | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color2}'"$DJS"'$color'/}

The conky-rss.sh script to get the rss news feed

#!/bin/bash
# RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0
#
# This script is designed to output story titles for most any RSS Feed.
#
# This script depends on curl.  Please ensure it is installed and in your $PATH
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: http://curl.haxx.se/
#
# Usage:
# .conkyrc:	${execi [time] /path/to/script/conky-rss.sh URI LINES TITLENUM}
#	URI = Location of feed, ex. http://www.gentoo.org/rdf/en/glsa-index.rdf
#	LINES = How many titles to display (default 5)
#	TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2)
#
# Usage Example		
#		${execi 300 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4 2}

#RSS Setup - Don't change unless you want these values hard-coded!
uri=$1							#URI of RSS Feed
lines=$2						#Number of headlines
titlenum=$3						#Number of extra titles

#Script start
#Require a uri, as a minimum
if [[ "$uri" == "" ]]; then
	echo "No URI specified, cannot continue!" >&2
	echo "Please read script for more information" >&2
else
	#Set defaults if none specified
	if [[ $lines == "" ]]; then lines=5 ; fi
	if [[ $titlenum == "" ]]; then titlenum=2 ; fi

	#The actual work
	curl -s --connect-timeout 30 $uri |\
	sed -e 's/<\/title>/\n/g' |\
	grep -o '<title>.*' |\
	sed -e 's/<title>//' |\
	sed -e 's/<!\[CDATA\[//g' |\
	sed -e 's/\]\]>//g' |\
	head -n $(($lines + $titlenum)) |\
	tail -n $(($lines))
fi

The script to get current weather conditions

#!/bin/bash

station="$1.xml"
wdir='/tmp/weather'

update_xml() {
	if [ ! -e "$station" ]; then
		wget -q http://w1.weather.gov/xml/current_obs/${station}
		[ -e "$station" ] && touch "${station}"
	else
		# dtime: time the .xml file was downloaded
		# otime: time the weather data was observed
		# ctime: current time (time this script is being run)
		dtime=$(stat -c %Y $station)
		otime=$(date -d "$utime" +%s)
		ctime=$(date +%s)

		if (( "$otime" + 4507 < "$ctime" )); then
			if (( "$dtime" + 307 < "$ctime" )); then
				wget -q -O "$station" http://w1.weather.gov/xml/current_obs/${station}
				[ -e "$station" ] && touch "${station}"
			fi
		fi
	fi
}

from_xml() { xmllint -xpath "//$1" - <<< "$xml" | sed 's/<[^>]*>//g'; }
	
[ -d "$wdir" ] || mkdir -p "$wdir"
cd "$wdir" || exit 1

xml=''
[ -r $station ] && xml="$(< $station)"
( update_xml >/dev/null 2>&1 ) &

if [ -n "$xml" ]; then
	location=$(from_xml "location")
	# if we just want the city the location is in
	#locationx=$(from_xml "location")
    #location="$(echo "$locationx" | cut -f1 -d",")"
	utime=$(from_xml "observation_time_rfc822")
	otime=$(date -d "$utime" '+%a %b %e %R')
	#date +"%Y/%m/%d %H:%M"
	#Invoking date with no format argument is equivalent to invoking `date '+%a %b %e %H:%M:%S %Z %Y''. 
	weather=$(from_xml "weather")
	temperature=$(from_xml "temp_f")
	humid=$(from_xml "relative_humidity")
	wind_dir=$(from_xml "wind_dir")
	case "$wind_dir" in
		"North") wind_dir="N" ;;
		"South") wind_dir="S" ;;
		"East") wind_dir="E" ;;
		"West") wind_dir="W" ;;
		"Northwest") wind_dir="NW" ;;
		"Northeast") wind_dir="NE" ;;
		"Southwest") wind_dir="SW" ;;
		"Southeast") wind_dir="SE" ;;
	esac
	wind_speed=$(from_xml "wind_kt")
	baro_pressure=$(from_xml "pressure_in")

###	echo "$location"
	printf '%s, %s %s F, wind %s %s kt in %s, NWS station %s\n' "$otime" "$weather" "$temperature" "$wind_dir" "$wind_speed" "$location" "$1"
###	echo "$location"
###	printf 'Weather: %s %s°F\n' "$weather" "$temperature"
###	printf 'Barometric Pressure: %s inches\n' "$baro_pressure"
###	printf 'Wind: %s at %s knots\n' "$wind_dir" "$wind_speed"
###	printf 'Humidity: %s%%\n' "$humid"
###	echo "Updated: $(date -d "$utime" 2>/dev/null )"
else
	echo "ERROR: No weather data available for $1..."
fi

And the script to get and massage the NWS 7 day text forecast

#!/bin/bash
# getweather7d.sh - gets weather forecast text file
#
# bobc Feb 10, 2015 written
#   TODO - use legit temp files
#
# usage: getweather7d.sh il/ilz014.txt
#   files are stored by state, so need to pass combined state and filename 
#
#   delete first 11 lines and last 2 lines to get actual forecast text 
if [ "$1" = "" ]; then
    echo "ERROR, usage: getweather7d.sh il/ilz014.txt"
else
	curl_retryn=0
    curl -s http://weather.noaa.gov/pub/data/forecasts/zone/$1 > ~/.getweather7d.tmp.txt
	if [ $? -ne 0 ]; then
		while [ curl_retryn -le 3 ]
		do
			sleep 10
			curl_retryn=`expr $curl_retryn + 1`
			curl -s http://weather.noaa.gov/pub/data/forecasts/zone/$1 > ~/.getweather7d.tmp.txt
			if [ $? -ne 0 ]; then
				continue
			fi
			curl_retryn=0
			break
		done
	fi
	if [ $curl_retryn -ne 0 ]; then
		echo "ERROR, getweather7d.sh curl failed to get weather for $1"
	else
		# ~/.getweather7d.tmp.txt now contains text of 7 day forecast, remove 1st 2 lines and 1st 11 lines, 
		#      delete 1st char of 1st line 
		cat ~/.getweather7d.tmp.txt | sed '$ d' | sed '$ d' | sed '1,11 d' | sed -e '1s/^.//' > ~/.getweather7d.tmp2.txt
		# lines are wrapped at xx chars, so need to unwrap and then rewrap at yy chars
		# change all newline 0a characters into and all . to b
		tr '\n' 'a' < ~/.getweather7d.tmp2.txt > ~/.getweather7d.tmp3.txt
		tr '.' 'b' < ~/.getweather7d.tmp3.txt > ~/.getweather7d.tmp4.txt
		# ab combos are real newlines, and change all ... to -
		cat ~/.getweather7d.tmp4.txt | sed -e "s/ab/\n/g" | sed -e "s/bbb/-/g" > ~/.getweather7d.tmp5.txt
		# change b back to. and make a into spaces
		tr 'b' '.' < ~/.getweather7d.tmp5.txt > ~/.getweather7d.tmp6.txt
		tr 'a' ' ' < ~/.getweather7d.tmp6.txt > ~/.getweather7d.tmp7.txt
		cat ~/.getweather7d.tmp7.txt | sed -e "s/^/--/g" | sed -e "s/ PERCENT/%/g" | sed -e "s/TEMPERATURES/TEMPS/g" \
		| sed -e "s/BELOW ZERO/BELOW/g" | sed -e "s/ABOVE ZERO/ABOVE/g" | sed -e "s/ ABOVE//g" | sed -e "s/ ZERO/ 0/g" \
		| sed -e "s/SUBURBS/BURBS/g" | sed -e "s/DOWNTOWN/CITY/g" \
		| sed -e "s/MPH WITH GUSTS UP/MPH, GUSTS/g" | sed -e "s/GUSTS UP TO/GUSTS TO/g" | sed -e "s/CHILLS/CHILL/g" \
		| sed -e "s/WINDS/WIND/g" | sed -e "s/LOWS/LOW/g" | sed -e "s/HIGHS/HIGH/g" | sed -e "s/BITTERLY/BITTER/g" \
		| sed -e "s/NUMEROUS SNOW SHOWERS/SNOW/g" | sed -e "s/SNOW SHOWERS/SNOW/g" | sed -e "s/RAIN SHOWERS/RAIN/g" \
		| sed -e "s/ACCUMULATION/ACCUM/g" \
		| sed -e "s/ADVISORY IN EFFECT FROM/ADVISORY FROM/g" \
		| sed -e "s/PRECIPITATION/PRECIP/g" > ~/.getweather7d.tmp8.txt  
# fmt -t -c -w 80 test6.txt > test7.txt
		fold -s -w 80 ~/.getweather7d.tmp8.txt | sed -e '26,$d' > ~/.getweather7d.tmp9.txt 
		# print lines to std output, conky will get result and display
		cat ~/.getweather7d.tmp9.txt
	fi
fi

Last edited by bobc (2015-02-22 11:41:29)


This is a neat site and seems to have lots of useful questions and answers.  I'm just learning linux and like to learning by doing.  Sometimes I really don't know, LOL.

Offline

#1715 2015-02-22 15:46:21

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

bobc wrote:

The hard parts were doing the color coded bars for cpu usage, ram, swap, and space avail, and the routine that pares down the NWS 7 day text forecast down, first expanding it to long lines, then phrase by phrase, abbreviating to get it shorter so that when it gets word wrapped it takes many fewer lines, so there is space for the color coded calendar.

I can show you how to shorten your code that adds colour to the bars - really nice idea that - a visual warning!

bobc wrote:

Somehow I need to make it beep do something to get my attention before battery power gives out, though, perhaps with sound or popup windows.  I also need to build in my low swap space warning system, but on this machine with everything running from a 32 gb SSD its not really needed.

No need to have sound or popup windows  - since you're using conky with colours to give you visual affects add another ${if_match} with a "Hey, I'm going down for the count here - Plug me in NOW!" message.
My modified version of your conky - on the right.  I have no battery so that's fudged in ... and your 7d weather didn't work for me also I have no swap here ... again fudged in.  The warning is using ${cpu cpu1} >= 10} and ${cpu cpu1} <= 10} since I don't have a:

${battery_percent BAT0}

to play with.
2015_02_22_11_55_43_1920x1080_Sector11.jpg 2015_02_22_11_56_40_1920x1080_Sector11.jpg
Just by moving your calendar to the left edge and adding the warning to ${alignr 10}  wink

Also note the alignment of the oputput of:

Name                 PID    CPU%  MEM%
bobc wrote:

I also need to learn how to do temp files properly.

Can't help here.

bobc wrote:

Both the conky and scripts are very efficient for older cpu's because the conky interval is wide and the weather ones wider, and I'm downloading the text file which is quite small.  I think it would be too tight to try to get the current and 7 day, both day and in pics onto the screen at one time, so I haven't attempted it.  I suppose if I was to lose my calendar it would be possible at that point, especially with my trimmed down text, which I could abbreviate more if I used picture icons...

Teo's weather scripts are light  the one I use draws 1-2% with nothing else running except iceweasel (8 tabs open) and my tint1 systray.
I like the "picture" icons, there are also the font ones.
2015_02_22_12_22_28_1920x1080_Sector11.jpg
I added a CPU Average to that at the bottom so you can see it.

No since this isn't reallt Teo's weather help, and it pretty well unsolicited, if you want some help tweaking it, say so but I'll post the help in
» The New Monster Conky Thread.  Now I have to run ... let me know.

OH yea, one final thing, adding something I learned from Teo:

# Default colors and also border colors
default_color white

draw_shades yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

helps you see your conky on light backgrounds.

THANKS Teo!  Don't think I ever thanked you for that little idea!


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1716 2015-02-22 16:45:16

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Anytime mate!


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1717 2015-02-24 14:57:04

Mpok
Member
Registered: 2014-12-06
Posts: 28
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

@ Mpok  And to be totally honest here, I have been waiting patiently to see something from you, something I can see on my desktop with weather in it.  Maybe a new thread is a better idea.  Start one ... put something out that works and I'll be there with bells on.

Yep…
I know i have been on a "sleeping way" 8.(
Still have a working dev. Deserve some "minor things" to be publicated (on a NEW thread, as we agreed above; gonna reference this thread obviously; and still use ur Icons directory).
I have some pbms to "translate" my French working to an English (int.) version. But it is a matter of days…

I still don't leave this thread before SHARING IMPROVEMENT. smile
Let's take the 'only beginning' of the 1b1 sh script :

#!/bin/bash

#put your Accuweather address here
address="http://www.accuweather.com/[WHATEVER_WE_HAVE]/weather-forecast/[ID]"

loc_id=$(echo $address|sed 's/\/weather-forecast.*$//'|sed 's/^.*\///')
last_number=$(echo $address|sed 's/^.*\///')

curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"

addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
addr2="$addr1"?day=6

And now replace it by :

#!/bin/bash

#put your Accuweather address here
address="http://www.accuweather.com/[WHATEVER_WE_HAVE]/weather-forecast/[ID]"

# Construct address
add_current=${address/weather-forecast/current-wheather}
add_first_days=${address/weather-forecast/daily-wheather-forecast}
suf=${add_first_days##*/}
id=${suf%\"}
last=${suf//[0-9]}
add_last_days="${add_first_days/%$suf/$id?day=6}"$last

# Testing
echo $add_current
echo $add_first_days
echo $add_last_days

You can test (even 'time' this, with 1000 times to have a good result)… It's BETTER. big_smile
=> 9 processus launched vs. 0wink And my dev is NOT totally optimized (the $suf is just there to threat the '"').

U can understand WHY i'm in a process of optimizing all this stuff… lol

Offline

#1718 2015-02-24 22:37:52

bobc
Member
From: Chicago
Registered: 2014-12-11
Posts: 17

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sorry for not realizing this was a thread about Teo's scripts, and until I read the first page I thought it was a thread about any conky related scripts for weather or moon phases.

It looks like most of the sites are trying to avoid giving out an weather info unless you are getting it via their pages with adds etc., so I'm trying to use the NWS, especially since I'm in the US anyway, and the others seem to be trying to make it difficult or at least are definitely not trying to make it easy at all, and I would expect they won't care at all about the repercussions changing their pages would have on people like us.

So given that I see you download the NWS Forecast XML file, and way down at the bottom, I see current conditions embedded in a huge line.  Do you have a script to parse current conditions out of the xml file?  I see you parse out the forecast, but not the location or current conditions.

Its interesting how you stop and then start the conky during the time you are getting and calculating the weather info.

I would be interested to see better ways to do things, but I was trying to find ways that are readable, easily comprehend-able, and therefore easily tweaked.


This is a neat site and seems to have lots of useful questions and answers.  I'm just learning linux and like to learning by doing.  Sometimes I really don't know, LOL.

Offline

#1719 2015-02-24 23:02:50

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Mpok wrote:

U can understand WHY i'm in a process of optimizing all this stuff… lol

Actually I don't know what I am looking for.  I made a back up copy of 1b1 changed the code you said to change ...
and I see this:
2015_02_24_20_01_34_1920x1080_Sector11.jpg

Your thread?


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1720 2015-02-24 23:24:20

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

bobc wrote:

Sorry for not realizing this was a thread about Teo's scripts, and until I read the first page I thought it was a thread about any conky related scripts for weather or moon phases.

I would be interested to see better ways to do things, but I was trying to find ways that are readable, easily comprehend-able, and therefore easily tweaked.

Personally I don't think Teo had any problem with your post.  I didn't.  I see your next question is about Teo's NWS script.  big_smile  So I'll leave that for now.

I'll post some tips, for your conky, in the main conky thread and come back there and post a link.

Here's your link.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#1721 2015-02-25 11:50:07

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

bobc wrote:

So given that I see you download the NWS Forecast XML file, and way down at the bottom, I see current conditions embedded in a huge line.  Do you have a script to parse current conditions out of the xml file?  I see you parse out the forecast, but not the location or current conditions.

I'll try and look at it as soon as I can.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1722 2015-02-25 14:40:45

bobc
Member
From: Chicago
Registered: 2014-12-11
Posts: 17

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Teo,

If you don't already have a script with it done, its ok.  I just am not good working with sed, awk or grep due to the snytax being so difficult, so whenever possible I try to find existing scripts that I can modify because I'd have zero chance of ever coming up with the syntax myself.


This is a neat site and seems to have lots of useful questions and answers.  I'm just learning linux and like to learning by doing.  Sometimes I really don't know, LOL.

Offline

#1723 2015-02-25 19:37:16

TeoBigusGeekus
#! Die Hard
From: /Greece/Kastoria
Registered: 2012-04-28
Posts: 963

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Right, I think I omitted that info because it's not consistent, ie. the info changes with different locations in the US and therefore it's not exploitable.
By the way, the NWS script is my favourite script: it's been almost the same since 2009 - talking about consistency (hear that weather.com and accuweather?). Too bad it's only for the USA...

As for sed, grep, etc., the commands are not complicated. What makes them challenging are regular expressions. If you get a grip of them, then the actual commands are nothing.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1724 2015-02-27 02:06:19

bobc
Member
From: Chicago
Registered: 2014-12-11
Posts: 17

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

I looked at the regular expressions link.  Thanks for posting it.  I wasn't aware of most of those options.  Its no wonder it takes a ton of effort to make any sense of what their purpose is.  I'm sure if I had been using them all along it would eventually become second nature, but the ones I worked with before were simpleton by comparison.

Its a shame the NWS didn't implement the same features across the board.  Thanks for letting me know before I spent a lot of time on it.


This is a neat site and seems to have lots of useful questions and answers.  I'm just learning linux and like to learning by doing.  Sometimes I really don't know, LOL.

Offline

Help fund CrunchBang, donate to the project!

#1725 2015-03-04 21:35:04

Mpok
Member
Registered: 2014-12-06
Posts: 28
Website

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:
Mpok wrote:

U can understand WHY i'm in a process of optimizing all this stuff… lol

Actually I don't know what I am looking for.  I made a back up copy of 1b1 changed the code you said to change ...
and I see this:
http://s20.postimg.org/uf8katia1/2015_02_24_20_01_34_1920x1080_Sector11.jpg
Your thread?

@Sector11 : u didn't understand what i meant. Or i didn't expressed myself good enough tongue .

What i meant, is that the ".sh" part i replaced (just the fisrt lines) is WELL BETTER than the original. Times 100 to get it (bash only, NO CONKY INVOLVED).
=> It's just a MINOR improvement (reducing 80%, but of 3% of the global). neutral
But it's just he beginning…  smile

Note : as "my thread", as u said, it's up to u (Sector11). Prove me u undestood the improvement (that ".sh" part is the first test…), and i will first-publish HERE (the article is done, in French. Still have to translate it, even in code).
As for now,  u can undesrtand my way is to publish elsewhere… (there's no support out here).
=> I will, 'whatever", put a link on that topic (and thus referenced it on my publish).

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo