Author Topic: watchcat --- LINUX "fun-tility"  (Read 4896 times)

0 Members and 1 Guest are viewing this topic.

Offline Colonel_Panic

  • Newbie
  • Posts: 54
    • View Profile
watchcat --- LINUX "fun-tility"
« on: November 07, 2021, 02:07:18 am »
I think any Linux guy has seen or heard of (or runs, lol) "conky"

its a cool... "thing to watch" that people "design" cool looks for.
really neat, like a executive magnetic sculpture.

anyways, I couldnt figure out where CONKY "gets" the thermal temperatures and stuff like that.
so... I found "CPU stuff" and PROCesses ifo and stuff, so, I made a little...
in WINDOWS it would be similar to a task VIEWer I suppose.

EDIT: I plan to add stuff if i can later on. I plan on the user can enter "watch these" entries, and...

those ones? I want to HIGHLIGHT with either color or graphics, or... both?
anyways, this is just silly fun, and, I am learning to get bytes out of "weird special linux files"
which is why I am doing this. Learning where stuff is in Linux. Cant hurt I figure.

LINUX executable...
 
* watchcat (Filesize: 1.4 MB, Downloads: 218)
« Last Edit: November 07, 2021, 04:27:34 pm by Colonel_Panic »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #1 on: November 07, 2021, 04:56:28 am »
Sorry, Colonel.

It 'almost' ran... Error message:

Line 20 (in main module)
File not found,

Running with 64 bit Linux Mint 20.2 Cinnamon
Logic is the beginning of wisdom.

Offline Colonel_Panic

  • Newbie
  • Posts: 54
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #2 on: November 07, 2021, 04:07:34 pm »
oopsie.

these are my first few "deploys".
apologies.

this is funny...

Code: QB64: [Select]
  1.  
  2. Open "/home/sedstar/Desktop/qb64/programs/CONKY/procbase" For Input As #3
  3.  
  4.  
==========================
ha, was up late, forgot it has a file dependency.
let me re-deploy like I do my other one...
« Last Edit: November 07, 2021, 04:12:48 pm by Colonel_Panic »

Offline Colonel_Panic

  • Newbie
  • Posts: 54
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #3 on: November 07, 2021, 04:28:24 pm »
I *think* I fixed the original post attachment download.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #4 on: November 07, 2021, 04:41:48 pm »
Cool. Ran like a charm... Thank you. :)
Logic is the beginning of wisdom.

Offline Colonel_Panic

  • Newbie
  • Posts: 54
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #5 on: November 07, 2021, 05:07:15 pm »
coolness...

got code ?

Code: QB64: [Select]
  1. Screen _NewImage(80 * 8, 45 * 16, 32)
  2. Color _RGB32(255, 255, 0)
  3. dlay = 1
  4. Dim fil$(1024)
  5. workingDirectory$ = _CWD$ + "/"
  6. ChDir "/proc/"
  7. 'Input "strip="; strip
  8. iterate:
  9. t = 0
  10. Open "cpuinfo" For Input As #3
  11. For c = 1 To 8
  12.   Line Input #3, x$
  13.   cp$ = Right$(x$, Len(x$) - InStr(x$, ":"))
  14.   Print cp$
  15.   'If c = 8 Then Print Using "###### Mhz"; Int(Val(cp$))
  16. '_Delay dlay ': Cls
  17. S$ = "dir -p --format=single-column > " + workingDirectory$ + "procbase"
  18. t7 = Shell(S$)
  19. Open workingDirectory$ + "procbase" For Input As #3
  20. again1:
  21.   Line Input #3, x$
  22.   If Val(x$) > 0 Then t = t + 1: fil$(t) = x$
  23.   GoTo again1:
  24.   Close #3
  25. 'Print t
  26. _Delay dlay: Cls
  27. Print Using "###### Mhz"; Int(Val(cp$))
  28. Print "       Name:           Umask:  State:          Tgid:   Ngid:   Pid:    PPid:"
  29. Print "       -----           ------  ------          -----   -----   ----    -----"
  30. For v = 1 To t
  31.   'Print fil$(v);
  32.   'On Error GoTo around_this:
  33.   If _FileExists(fil$(v) + "status") Then
  34.     Open fil$(v) + "status" For Input As #3
  35.     For w = 1 To 7
  36.       Line Input #3, d$
  37.       d$ = Right$(d$, Len(d$) - InStr(d$, ":"))
  38.       If w = 1 Then
  39.         If Len(d$) < 15 Then d$ = d$ + String$(15 - Len(d$), " ")
  40.         If Len(d$) > 15 Then d$ = Left$(d$, 15)
  41.         Print d$; " ";
  42.       End If
  43.       If w > 1 Then Print _Trim$(d$); " ";
  44.     Next w: Print
  45.   End If
  46.   '  around_this:
  47.   Close #3
  48.   If v / 39 = Int(v / 39) Then
  49.     _Delay dlay
  50.     Cls
  51.     Print Using "###### Mhz"; Int(Val(cp$))
  52.     Print "       Name:           Umask:  State:          Tgid:   Ngid:   Pid:    PPid:"
  53.     Print "       -----           ------  ------          -----   -----   ----    -----"
  54.   End If
  55.  
  56. _Delay dlay
  57. If InKey$ = "" Then GoTo iterate:
  58.  

Offline Colonel_Panic

  • Newbie
  • Posts: 54
    • View Profile
Re: watchcat --- LINUX "fun-tility"
« Reply #6 on: November 07, 2021, 05:31:58 pm »
PROGRAM NOTES:
================

--- this little program makes a FILE, named 'procbase'
--- it will always make this tiny text database right in the same folder
--- it makes, and re-makes, the same little file constantly

--- this is not, repeat: *NOT* how this is supposed to be done!
--- next time i go over this? I will change the format, to where I will SHELL out a CAT/dd with >
-------- this will essentially copy and reformat this file, relocating it at the same time
-------- whats the big deal? I am not supposed to be OPENing this file and LINE INPUTing out of it like this
-------- if you follow this example, you will run into spots where you get weird EOF and other errors
-------- once i CAT and dd the relocated copy up front? *then* I will have a file I can "prance around in" w/o weird errors


what you are seeing? is a BASIC programmer (me) slowly fumbling around, learning to program in a LINUX environment
I am trying to get used to "playing with" special files. Just dont get the idea you *should* do this, this way...
you should (probably) CAT/dd > the file, then play.