$36 GRAYBYTE WORDPRESS FILE MANAGER $64

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib64/python2.7/Demo/curses/

HOME
Current File : /lib64/python2.7/Demo/curses//repeat.py
#! /usr/bin/python2.7

"""repeat <shell-command>

This simple program repeatedly (at 1-second intervals) executes the
shell command given on the command line and displays the output (or as
much of it as fits on the screen).  It uses curses to paint each new
output on top of the old output, so that if nothing changes, the
screen doesn't change.  This is handy to watch for changes in e.g. a
directory or process listing.

To end, hit Control-C.
"""

# Author: Guido van Rossum

# Disclaimer: there's a Linux program named 'watch' that does the same
# thing.  Honestly, I didn't know of its existence when I wrote this!

# To do: add features until it has the same functionality as watch(1);
# then compare code size and development time.

import os
import sys
import time
import curses

def main():
    if not sys.argv[1:]:
        print __doc__
        sys.exit(0)
    cmd = " ".join(sys.argv[1:])
    p = os.popen(cmd, "r")
    text = p.read()
    sts = p.close()
    if sts:
        print >>sys.stderr, "Exit code:", sts
        sys.exit(sts)
    w = curses.initscr()
    try:
        while True:
            w.erase()
            try:
                w.addstr(text)
            except curses.error:
                pass
            w.refresh()
            time.sleep(1)
            p = os.popen(cmd, "r")
            text = p.read()
            sts = p.close()
            if sts:
                print >>sys.stderr, "Exit code:", sts
                sys.exit(sts)
    finally:
        curses.endwin()

main()

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
14 Aug 2025 9.26 PM
root / root
0755
README
0.832 KB
20 Apr 2020 4.13 AM
root / root
0644
life.py
7.177 KB
10 Apr 2024 11.57 AM
root / root
0755
life.pyc
6.628 KB
10 Apr 2024 11.58 AM
root / root
0644
life.pyo
6.628 KB
10 Apr 2024 11.58 AM
root / root
0644
ncurses.py
6.492 KB
10 Apr 2024 11.57 AM
root / root
0755
ncurses.pyc
5.708 KB
10 Apr 2024 11.58 AM
root / root
0644
ncurses.pyo
5.708 KB
10 Apr 2024 11.58 AM
root / root
0644
rain.py
2.347 KB
10 Apr 2024 11.57 AM
root / root
0755
rain.pyc
2.241 KB
10 Apr 2024 11.58 AM
root / root
0644
rain.pyo
2.241 KB
10 Apr 2024 11.58 AM
root / root
0644
repeat.py
1.479 KB
10 Apr 2024 11.57 AM
root / root
0755
repeat.pyc
1.419 KB
10 Apr 2024 11.58 AM
root / root
0644
repeat.pyo
1.419 KB
10 Apr 2024 11.58 AM
root / root
0644
tclock.py
3.253 KB
10 Apr 2024 11.57 AM
root / root
0755
tclock.pyc
3.563 KB
10 Apr 2024 11.58 AM
root / root
0644
tclock.pyo
3.563 KB
10 Apr 2024 11.58 AM
root / root
0644
xmas.py
24.85 KB
20 Apr 2020 4.13 AM
root / root
0644
xmas.pyc
19.398 KB
10 Apr 2024 11.58 AM
root / root
0644
xmas.pyo
19.398 KB
10 Apr 2024 11.58 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF