diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-19 18:29:46 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-19 18:29:46 +0000 |
commit | ee0d2e6e1967294f4a62da1840b0ffdaa3124a2d (patch) | |
tree | 5c150db3c91a190b4911f19aeec9b1b2163c0c53 /konversation/scripts | |
download | konversation-ee0d2e6e1967294f4a62da1840b0ffdaa3124a2d.tar.gz konversation-ee0d2e6e1967294f4a62da1840b0ffdaa3124a2d.zip |
Added old abandoned KDE3 version of Konversation
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/konversation@1092922 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konversation/scripts')
-rw-r--r-- | konversation/scripts/Makefile.am | 4 | ||||
-rw-r--r-- | konversation/scripts/README | 55 | ||||
-rwxr-xr-x | konversation/scripts/bug | 18 | ||||
-rwxr-xr-x | konversation/scripts/cmd | 31 | ||||
-rwxr-xr-x | konversation/scripts/fortune | 53 | ||||
-rw-r--r-- | konversation/scripts/fortunes.dat | 680 | ||||
-rwxr-xr-x | konversation/scripts/gauge | 71 | ||||
-rwxr-xr-x | konversation/scripts/kdeversion | 9 | ||||
-rwxr-xr-x | konversation/scripts/mail | 70 | ||||
-rwxr-xr-x | konversation/scripts/media | 484 | ||||
-rwxr-xr-x | konversation/scripts/sayclip | 19 | ||||
-rw-r--r-- | konversation/scripts/sysinfo | 86 | ||||
-rwxr-xr-x | konversation/scripts/tinyurl | 31 | ||||
-rwxr-xr-x | konversation/scripts/uptime | 56 | ||||
-rwxr-xr-x | konversation/scripts/weather | 70 |
15 files changed, 1737 insertions, 0 deletions
diff --git a/konversation/scripts/Makefile.am b/konversation/scripts/Makefile.am new file mode 100644 index 0000000..77ce9cd --- /dev/null +++ b/konversation/scripts/Makefile.am @@ -0,0 +1,4 @@ +scriptsdir=$(kde_datadir)/konversation/scripts +scripts_SCRIPTS=bug fortune gauge uptime kdeversion cmd sayclip weather sysinfo media mail tinyurl +scripts_DATA=fortunes.dat + diff --git a/konversation/scripts/README b/konversation/scripts/README new file mode 100644 index 0000000..6efdefe --- /dev/null +++ b/konversation/scripts/README @@ -0,0 +1,55 @@ +Here are some scripts that can help you in everyday life with konvi. + +They are usually put in ~/.kde/share/apps/konversation/scripts/ and executed by +typing /exec <scriptname> in konversation. + +Since scripts are executed by system, they should have 'executable' flag on. +This is most easily achieved by running chmod +x <scriptname> + +Please add descriptions here as new scripts appear: + +bug Opens up konqueror with kde bugzilla on specified bug number. + usage: /bug 65090 + +gauge Displays funny "beer load" meter. Author: Eisfuchs, Idea: berkus. + usage: /gauge 55 + + +uptime Displays the system uptime on the current channel. + usage: /uptime + +fortune Displays a random fortune cookie + usage: /fortune + +kdeversion Displays the Qt/KDE version. + usage: /kdeversion + +cmd Prints the output of a given command. + usage: /cmd command + +sayclip Prints the contents of the clipboard on the current channel + with flood protection. Klipper must be running. + usage: /sayclip [pause-time] + +weather Displays current weather using KWeather applet. + usage: /weather + +colorizer Randomly colorizes the message. + usage: /colorize message + +media Plays the currently played media. + Supports amaroK,JuK,Noatun,Kaffeine + Usage: /media + +mail Print the number of unread emails in your inbox folder in + kmail. Kmail or kontact must be running. + Usage: /mail [folder-substring] + +google Use Google services + Usage: /google (--search) <query> # Search <query> in Google + /google --spell <word> # Spellcheck <word> using Google + /google -b|--browser <query> # Launch konqueror with google search for <query> + +qurl Display a short version of the url using qurl.net + Requires Ruby. + usage: /qurl http://some.very.long.url.com/ diff --git a/konversation/scripts/bug b/konversation/scripts/bug new file mode 100755 index 0000000..0f5ec86 --- /dev/null +++ b/konversation/scripts/bug @@ -0,0 +1,18 @@ +#!/bin/sh + +PORT=$1 +SERVER=$2 +TARGET=$3 +BUG=$4 + +if [ ! $TARGET ] +then + dcop $PORT default error "Can't write into status view." +else + if [ -z $BUG ] + then + dcop $PORT default error "You forgot the bug number!" + else + kfmclient openURL http://bugs.kde.org/show_bug.cgi?id=$4 + fi +fi diff --git a/konversation/scripts/cmd b/konversation/scripts/cmd new file mode 100755 index 0000000..ebd7112 --- /dev/null +++ b/konversation/scripts/cmd @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +# Copyright (C) 2004 by İsmail Dönmez +# Licensed under GPL v2 or later at your option + +$PORT= shift; +$SERVER= shift; +$TARGET= shift; + +my $i; +my $command; + +if( $ARGV[0] eq "yes" ){ + exec 'dcop', $PORT, 'default', 'error', 'Requested command is not executed!'; +} + +foreach $word (@ARGV) { + $command = $command." ".$word; +} + +$ARG_MESSAGE = `exec $command`; + +foreach $entry (split(/\n/, $ARG_MESSAGE)) { + chomp $entry; + $i=1; + $entry =~ s/^\//\/\//; + system 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, $entry; +} + +unless($i) { + exec 'dcop', $PORT, 'default', 'error', "Command @ARGV doesn't exist"; +} diff --git a/konversation/scripts/fortune b/konversation/scripts/fortune new file mode 100755 index 0000000..a3b61d3 --- /dev/null +++ b/konversation/scripts/fortune @@ -0,0 +1,53 @@ +#!/usr/bin/env perl +# Copyright (C) 2004 by İsmail Dönmez +# Licensed under GPL v2 or later at your option + +$PORT = shift; +$SERVER = shift; +$TARGET = shift; + +sub RANDOM_INT ($$) { + my($min, $max) = @_; + return $min if $min == $max; + ($min, $max) = ($max, $min) if $min > $max; + return $min + int rand(1 + $max - $min); +} + +open(FORTUNES,"fortunes.dat") or die("Could not open fortunes file!"); + +while (<FORTUNES>) { + chomp; + ++$TOTAL_LINES; +} + +seek(FORTUNES,0,0); + +srand; +$LINE = RANDOM_INT(0,$TOTAL_LINES - 5); + +$MESSAGE = "4Random Fortune: "; + +while (<FORTUNES>) { + $LINE_COUNT++; + + if ( !$START && $LINE_COUNT >= $LINE ) { + if ( $_ eq "\%\n" ) { + $START = 1; + next; + } + next; + } + + elsif ( $START ) { + if( $_ eq "\%\n" ) { + last; + } + else { + chomp; + s/(\s)+/$1/g; + $MESSAGE .= $_." "; + } + } +} +close(FORTUNES); +exec 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, $MESSAGE; diff --git a/konversation/scripts/fortunes.dat b/konversation/scripts/fortunes.dat new file mode 100644 index 0000000..756f18a --- /dev/null +++ b/konversation/scripts/fortunes.dat @@ -0,0 +1,680 @@ +% +Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. +% +Let's call it an accidental feature. + -- Larry Wall +% +I did this 'cause Linux gives me a woody. It doesn't generate revenue. + -- Dave '-ddt->` Taylor, announcing DOOM for Linux +% +Feel free to contact me (flames about my english and the useless of this +driver will be redirected to /dev/null, oh no, it's full...). + -- Michael Beck, describing the PC-speaker sound device +% +lp1 on fire + -- One of the more obfuscated kernel messages +% +A Linux machine! Because a 486 is a terrible thing to waste! + -- Joe Sloan, jjs@wintermute.ucr.edu +% +Microsoft is not the answer. +Microsoft is the question. +NO (or Linux) is the answer. + -- Taken from a .signature from someone from the UK, source unknown +% +In most countries selling harmful things like drugs is punishable. +Then howcome people can sell Microsoft software and go unpunished? + -- Hasse Skrifvars, hasku@rost.abo.fi, +% +Windows without the X is like making love without a partner. +Sex, Drugs & Linux Rules +win-nt from the people who invented edlin. +Apples have meant trouble since eden. +Linux, the way to get rid of boot viruses + -- MaDsen Wikholm, mwikholm@at8.abo.fi +% +Once upon a time there was a DOS user who saw Unix, and saw that it was +good. After typing cp on his DOS machine at home, he downloaded GNU's +unix tools ported to DOS and installed them. He rm'd, cp'd, and mv'd +happily for many days, and upon finding elvis, he vi'd and was happy. After +a long day at work (on a Unix box) he came home, started editing a file, +and couldn't figure out why he couldn't suspend vi (w/ ctrl-z) to do +a compile. + -- Erik Troan, ewt@tipper.oit.unc.edu +% +We are MicroSoft. You will be assimilated. Resistance is futile. + -- Attributed to B.G., Gill Bates +% +Avoid the Gates of Hell. Use Linux + -- unknown source +% +Intel engineering seem to have misheard Intel marketing strategy. The +phrase was "Divide and conquer" not "Divide and cock up" + -- Alan Cox, iialan@www.linux.org.uk +% +Linux! Guerrilla UNIX Development Venimus, Vidimus, Dolavimus. + -- Mark A. Horton KA4YBR, mah@ka4ybr.com +% +"Who is General Failure and why is he reading my hard disk?" +Microsoft spel chekar vor sail, worgs grate !! + -- Felix von Leitner, leitner@inf.fu-berlin.de +% +Personally, I think my choice in the mostest-superlative-computer wars has to +be the HP-48 series of calculators. They'll run almost anything. And if they +can't, while I'll just plug a Linux box into the serial port and load up the +HP-48 VT-100 emulator. + -- Jeff Dege, jdege@winternet.com +% +There are no threads in a.b.p.erotica, so there's no gain in using a +threaded news reader. + -- unknown source +% +/* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. +*/ +die_if_kernel("Oops", regs, error_code); + -- From linux/arch/i386/mm/fault.c +% +Linux: because a PC is a terrible thing to waste + -- ksh@cis.ufl.edu put this on Tshirts in '93 +% +Linux: the choice of a GNU generation + -- ksh@cis.ufl.edu put this on Tshirts in '93 +% +There are two types of Linux developers - those who can spell, and +those who can't. There is a constant pitched battle between the two. + -- From one of the post-1.1.54 kernel update messages posted to c.o.l.a +% +When you say "I wrote a program that crashed Windows", people just stare at +you blankly and say "Hey, I got those with the system, *for free*". + -- Linus Torvalds +% +We come to bury DOS, not to praise it. + -- Paul Vojta, vojta@math.berkeley.edu +% +Be warned that typing killall name may not have the desired +effect on non-Linux systems, especially when done by a privileged user. + -- From the killall manual page +% +Note that if I can get you to "su and say" something just by asking, +you have a very serious security problem on your system and you should +look into it. + -- Paul Vixie, vixie-cron 3.0.1 installation notes +% +How should I know if it works? That's what beta testers are for. I +only coded it. + -- Attributed to Linus Torvalds, somewhere in a posting +% +I develop for Linux for a living, I used to develop for DOS. +Going from DOS to Linux is like trading a glider for an F117. + -- Lawrence Foard, entropy@world.std.com +% +Absolutely nothing should be concluded from these figures except that +no conclusion can be drawn from them. + -- Joseph L. Brothers, Linux/PowerPC Project) +% +If the future navigation system [for interactive networked services on +the NII] looks like something from Microsoft, it will never work. + -- Chairman of Walt Disney Television & Telecommunications +% +Problem solving under Linux has never been the circus that it is under +AIX. + -- Pete Ehlke in comp.unix.aix +% +I don't know why, but first C programs tend to look a lot worse than +first programs in any other language (maybe except for fortran, but then +I suspect all fortran programs look like `firsts') + -- Olaf Kirch +% +On a normal ascii line, the only safe condition to detect is a 'BREAK' +- everything else having been assigned functions by Gnu EMACS. + -- Tarl Neustaedter +% +By golly, I'm beginning to think Linux really *is* the best thing since +sliced bread. + -- Vance Petree, Virginia Power +% +I'd crawl over an acre of 'Visual This++' and 'Integrated Development +That' to get to gcc, Emacs, and gdb. Thank you. + -- Vance Petree, Virginia Power +% +Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs. + -- Dennis Ritchie +% +If you want to travel around the world and be invited to speak at a lot +of different places, just write a Unix operating system. + -- Linus Torvalds +% +...and scantily clad females, of course. Who cares if it's below zero +outside. + -- Linus Torvalds +% +...you might as well skip the Xmas celebration completely, and instead +sit in front of your linux computer playing with the all-new-and-improved +linux kernel version. + -- Linus Torvalds +% +Besides, I think Slackware sounds better than 'Microsoft,' don't you? + -- Patrick Volkerding +% +All language designers are arrogant. Goes with the territory... + -- Larry Wall +% +And the next time you consider complaining that running Lucid Emacs +19.05 via NFS from a remote Linux machine in Paraguay doesn't seem to +get the background colors right, you'll know who to thank. + -- Matt Welsh +% +Are Linux users lemmings collectively jumping off of the cliff of +reliable, well-engineered commercial software? + -- Matt Welsh +% +Even more amazing was the realization that God has Internet access. I +wonder if He has a full newsfeed? + -- Matt Welsh +% +I once witnessed a long-winded, month-long flamewar over the use of +mice vs. trackballs... It was very silly. + -- Matt Welsh +% +Linux poses a real challenge for those with a taste for late-night +hacking (and/or conversations with God). + -- Matt Welsh +% +What you end up with, after running an operating system concept through +these many marketing coffee filters, is something not unlike plain hot +water. + -- Matt Welsh +% +...Deep Hack Mode -- that mysterious and frightening state of +consciousness where Mortal Users fear to tread. + -- Matt Welsh +% +...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and +the Ugly). + -- Matt Welsh +% +...very few phenomena can pull someone out of Deep Hack Mode, with two +noted exceptions: being struck by lightning, or worse, your *computer* +being struck by lightning. + -- Matt Welsh +% +..you could spend *all day* customizing the title bar. Believe me. I +speak from experience. + -- Matt Welsh +% +[In 'Doctor' mode], I spent a good ten minutes telling Emacs what I +thought of it. (The response was, 'Perhaps you could try to be less +abusive.') + -- Matt Welsh +% +I would rather spend 10 hours reading someone else's source code than +10 minutes listening to Musak waiting for technical support which isn't. + -- Dr. Greg Wettstein, Roger Maris Cancer Center +% +...[Linux's] capacity to talk via any medium except smoke signals. + -- Dr. Greg Wettstein, Roger Maris Cancer Center +% +Whip me. Beat me. Make me maintain AIX. + -- Stephan Zielinski +% +Your job is being a professor and researcher: That's one hell of a good excuse +for some of the brain-damages of minix. + -- Linus Torvalds to Andrew Tanenbaum +% +I still maintain the point that designing a monolithic kernel in 1991 is a +fundamental error. Be thankful you are not my student. You would not get a +high grade for such a design :-) + -- Andrew Tanenbaum to Linus Torvalds +% +We use Linux for all our mission-critical applications. Having the source code +means that we are not held hostage by anyone's support department. + -- Russell Nelson, President of Crynwr Software +% +Linux is obsolete + -- Andrew Tanenbaum +% +Dijkstra probably hates me. + -- Linus Torvalds, in kernel/sched.c +% +And 1.1.81 is officially BugFree(tm), so if you receive any bug-reports +on it, you know they are just evil lies. + -- Linus Torvalds +% +We are Pentium of Borg. Division is futile. You will be approximated. + -- seen in someone's .signature +% +Linux: the operating system with a CLUE... Command Line User Environment. + -- seen in a posting in comp.software.testing +% +quit When the quit statement is read, the bc processor + is terminated, regardless of where the quit state- + ment is found. For example, "if (0 == 1) quit" + will cause bc to terminate. + -- seen in the manpage for "bc". Note the "if" statement's logic +% +Sic transit discus mundi + -- From the System Administrator's Guide, by Lars Wirzenius +% +Sigh. I like to think it's just the Linux people who want to be on +the "leading edge" so bad they walk right off the precipice. + -- Craig E. Groeschel +% +We all know Linux is great... it does infinite loops in 5 seconds. + - Linus Torvalds about the superiority of Linux on the Amterdam Linux Symposium +% +Waving away a cloud of smoke, I look up, and am blinded by a bright, white +light. It's God. No, not Richard Stallman, or Linus Torvalds, but God. In +a booming voice, He says: "THIS IS A SIGN. USE LINUX, THE FREE UNIX SYSTEM +FOR THE 386. + -- Matt Welsh +% +The chat program is in public domain. This is not the GNU public license. +If it breaks then you get to keep both pieces. + -- Copyright notice for the chat program +% +'Mounten' wird fr drei Dinge benutzt: 'Aufsitzen' auf Pferde, 'einklinken' +von Festplatten in Dateisysteme, und, nun, 'besteigen' beim Sex. + -- Christa Keil +% +Manchmal stehe nachts auf und installier's mir einfach... + -- H0arry @ IRC +% +'Mounting' is used for three things: climbing on a horse, linking in a +hard disk unit in data systems, and, well, mounting during sex. + -- Christa Keil +% +We are using Linux daily to UP our productivity - so UP yours! + -- Adapted from Pat Paulsen by Joe Sloan +% +But what can you do with it? + -- ubiquitous cry from Linux-user partner +% +/* + * [...] Note that 120 sec is defined in the protocol as the maximum + * possible RTT. I guess we'll have to use something other than TCP + * to talk to the University of Mars. + * PAWS allows us longer timeouts and large windows, so once implemented + * ftp to mars will work nicely. + */ + -- from /usr/src/linux/net/inet/tcp.c, concerning RTT [round trip time] +% +DOS: n., A small annoying boot virus that causes random spontaneous system + crashes, usually just before saving a massive project. Easily cured by + UNIX. See also MS-DOS, IBM-DOS, DR-DOS. + -- David Vicker's .plan +% +MSDOS didn't get as bad as it is overnight -- it took over ten years +of careful development. + -- dmeggins@aix1.uottawa.ca +% +LILO, you've got me on my knees! + -- David Black, dblack@pilot.njin.net, with apologies to Derek and the +Dominos, and Werner Almsberger +% +I've run DOOM more in the last few days than I have the last few +months. I just love debugging ;-) + -- Linus Torvalds +% +Microsoft Corp., concerned by the growing popularity of the free 32-bit +operating system for Intel systems, Linux, has employed a number of top +programmers from the underground world of virus development. Bill Gates stated +yesterday: "World domination, fast -- it's either us or Linus". Mr. Torvalds +was unavailable for comment ... + -- Robert Manners, rjm@swift.eng.ox.ac.uk, in comp.os.linux.setup +% +The only "intuitive" interface is the nipple. After that, it's all learned. + -- Bruce Ediger, bediger@teal.csn.org, on X interfaces +% +After watching my newly-retired dad spend two weeks learning how to make a new +folder, it became obvious that "intuitive" mostly means "what the writer or +speaker of intuitive likes". + -- Bruce Ediger, bediger@teal.csn.org, on X the intuitiveness of a Mac interface +% +Now I know someone out there is going to claim, "Well then, UNIX is intuitive, +because you only need to learn 5000 commands, and then everything else follows +from that! Har har har!" + -- Andy Bates on "intuitive interfaces", slightly defending Macs +% +> No manual is ever necessary. +May I politely interject here: BULLSHIT. That's the biggest Apple lie of all! + -- Discussion in comp.os.linux.misc on the intuitiveness of interfaces +% +How do I type "for i in *.dvi do xdvi $i done" in a GUI? + -- Discussion in comp.os.linux.misc on the intuitiveness of interfaces +% +>Ever heard of .cshrc? +That's a city in Bosnia. Right? + -- Discussion in comp.os.linux.misc on the intuitiveness of commands +% +Who wants to remember that escape-x-alt-control-left shift-b puts you into +super-edit-debug-compile mode? + -- Discussion on the intuitiveness of commands, especially Emacs +% +Anyone who thinks UNIX is intuitive should be forced to write 5000 lines of +code using nothing but vi or emacs. AAAAACK! + -- Discussion on the intuitiveness of commands, especially Emacs +% +Now, it we had this sort of thing: + yield -a for yield to all traffic + yield -t for yield to trucks + yield -f for yield to people walking (yield foot) + yield -d t* for yield on days starting with t + +...you'd have a lot of dead people at intersections, and traffic jams you +wouldn't believe... + -- Discussion on the intuitiveness of commands +% +Actually, typing random strings in the Finder does the equivalent of +filename completion. + -- Discussion on file completion vs. the Mac Finder +% +Not me, guy. I read the Bash man page each day like a Jehovah's Witness reads +the Bible. No wait, the Bash man page IS the bible. Excuse me... + -- More on confusing aliases, taken from comp.os.linux.misc +% +On the Internet, no one knows you're using Windows NT + -- Submitted by Ramiro Estrugo, restrugo@fateware.com +% +> I'm an idiot.. At least this [bug] took about 5 minutes to find.. +Disquieting ... + -- Gonzalo Tornaria in response to Linus Torvalds's +% +> I'm an idiot.. At least this [bug] took about 5 minutes to find.. +We need to find some new terms to describe the rest of us mere mortals +then. + -- Craig Schlenter in response to Linus Torvalds's +% +> I'm an idiot.. At least this [bug] took about 5 minutes to find.. +Surely, Linus is talking about the kind of idiocy that others aspire to :-). + -- Bruce Perens in response to Linus Torvalds's +% +Never make any mistaeks. + -- Anonymous, in a mail discussion about to a kernel bug report +% ++#if defined(__alpha__) && defined(CONFIG_PCI) ++ /* ++ * The meaning of life, the universe, and everything. Plus ++ * this makes the year come out right. ++ */ ++ year -= 42; ++#endif + -- From the patch for 1.3.2: (kernel/time.c), submitted by Marcus Meissner +% +As usual, this being a 1.3.x release, I haven't even compiled this +kernel yet. So if it works, you should be doubly impressed. + -- Linus Torvalds, announcing kernel 1.3.3 +% +People disagree with me. I just ignore them. + -- Linus Torvalds, regarding the use of C++ for the Linux kernel +% +It's now the GNU Emacs of all terminal emulators. + -- Linus Torvalds, regarding the fact that Linux started off as a terminal emulator +% +Audience: What will become of Linux when the Hurd is ready? +Eric Youngdale: Err... is Richard Stallman here? + -- From the Linux conference in spring '95, Berlin +% +Linux: The OS people choose without $200,000,000 of persuasion. + -- Mike Coleman +% +The memory management on the PowerPC can be used to frighten small children. + -- Linus Torvalds +% +... faster BogoMIPS calculations (yes, it now boots 2 seconds faster than +it used to: we're considering changing the name from "Linux" to "InstaBOOT" + -- Linus, in the announcement for 1.3.26 +% +... of course, this probably only happens for tcsh which uses wait4(), +which is why I never saw it. Serves people who use that abomination +right 8^) + -- Linus Torvalds, about a patch that fixes getrusage for 1.3.26 +% +It's a bird.. +It's a plane.. +No, it's KernelMan, faster than a speeding bullet, to your rescue. +Doing new kernel versions in under 5 seconds flat.. + -- Linus, in the announcement for 1.3.27 +% +Eh, that's it, I guess. No 300 million dollar unveiling event for this +kernel, I'm afraid, but you're still supposed to think of this as the +"happening of the century" (at least until the next kernel comes along). + -- Linus, in the announcement for 1.3.27 +% +Oh, and this is another kernel in that great and venerable "BugFree(tm)" +series of kernels. So be not afraid of bugs, but go out in the streets +and deliver this message of joy to the masses. + -- Linus, in the announcement for 1.3.27 +% +When you say 'I wrote a program that crashed Windows', people just stare at +you blankly and say 'Hey, I got those with the system, *for free*'. + -- Linus Torvalds +% +Never trust an operating system you don't have sources for. ;-) + -- Unknown source +% +> Linux is not user-friendly. +It _is_ user-friendly. It is not ignorant-friendly and idiot-friendly. + -- Seen somewhere on the net +% +Keep me informed on the behaviour of this kernel.. As the "BugFree(tm)" +series didn't turn out too well, I'm starting a new series called the +"ItWorksForMe(tm)" series, of which this new kernel is yet another +shining example. + -- Linus, in the announcement for 1.3.29 +% +Seriously, the way I did this was by using a special /sbin/loader binary +with debugging hooks that I made ("dd" is your friend: binary editors +are for wimps). + -- Linus Torvalds, in an article on a dnserver +% +(I tried to get some documentation out of Digital on this, but as far as +I can tell even _they_ don't have it ;-) + -- Linus Torvalds, in an article on a dnserver +% +Q: Why shouldn't I simply delete the stuff I never use, it's just taking up + space? +A: This question is in the category of Famous Last Words.. + -- From the Frequently Unasked Questions +% +Q: What's the big deal about rm, I have been deleting stuff for years? And + never lost anything.. oops! +A: ... + -- From the Frequently Unasked Questions +% +Linux is addictive, I'm hooked! + -- MaDsen Wikholm's .sig +% +panic("Foooooooood fight!"); + -- In the kernel source aha1542.c, after detecting a bad segment list +% +Convention organizer to Linus Torvalds: "You might like to come with us +to some licensed[1] place, and have some pizza." + +Linus: "Oh, I did not know that you needed a license to eat pizza". + +[1] Licenced - refers in Australia to a restaurant which has government +licence to sell liquor. + -- Linus at a talk at the Melbourne University +% +Footnotes are for things you believe don't really belong in LDP manuals, +but want to include anyway. + -- Joel N. Weber II discussing the 'make' chapter of LPG +% +Eh, that's it, I guess. No 300 million dollar unveiling event for this +kernel, I'm afraid, but you're still supposed to think of this as the +"happening of the century" (at least until the next kernel comes along). +Oh, and this is another kernel in that great and venerable "BugFree(tm)" +series of kernels. So be not afraid of bugs, but go out in the streets +and deliver this message of joy to the masses. + -- Linus Torvalds, on releasing 1.3.27 +% +Ok, I'm just uploading the new version of the kernel, v1.3.33, also +known as "the buggiest kernel ever". + -- Linus Torvalds +% +Go not unto the Usenet for advice, for you will be told both yea and nay (and +quite a few things that just have nothing at all to do with the question). + -- seen in a .sig somewhere +% +Those who don't understand Linux are doomed to reinvent it, poorly. + -- unidentified source +% +Look, I'm about to buy me a double barreled sawed off shotgun and show +Linus what I think about backspace and delete not working. + -- some anonymous .signature +% +We apologize for the inconvenience, but we'd still like yout to test out +this kernel. + -- Linus Torvalds, announcing another kernel patch +% +The new Linux anthem will be "He's an idiot, but he's ok", as performed by +Monthy Python. You'd better start practicing. + -- Linus Torvalds, announcing another kernel patch +% +How do you power off this machine? + -- Linus, when upgrading linux.cs.helsinki.fi, and after using the machine for several months +% +Excusing bad programming is a shooting offence, no matter _what_ the +circumstances. + -- Linus Torvalds, to the linux-kernel list +% +Linus? Whose that? + -- clueless newbie on #Linux +% +Whoa...I did a 'zcat /vmlinuz > /dev/audio' and I think I heard God... + -- mikecd on #Linux +% +Some people have told me they don't think a fat penguin really embodies the +grace of Linux, which just tells me they have never seen a angry penguin +charging at them in excess of 100mph. They'd be a lot more careful about what +they say if they had. + -- Linus Torvalds, announcing Linux v2.0 +% +MS-DOS, you can't live with it, you can live without it. + -- from Lars Wirzenius' .sig +% +.. I used to get in more fights with SCO than I did my girlfriend, but +now, thanks to Linux, she has more than happily accepted her place back at +number one antagonist in my life.. + -- Jason Stiefel, krypto@s30.nmex.com +% +I mean, well, if it were not for Linux I might be roaming the streets looking +for drugs or prostitutes or something. Hannu and Linus have my highest +admiration (apple polishing mode off). + -- Phil Lewis, plewis@nyx.nyx.net +% +> What does ELF stand for (in respect to Linux?) +ELF is the first rock group that Ronnie James Dio performed with back in +the early 1970's. In constrast, a.out is a misspelling of the French word +for the month of August. What the two have in common is beyond me, but +Linux users seem to use the two words together. + -- seen on c.o.l.misc +% +"Linux was made by foreign terrorists to take money from true US companies +like Microsoft." - Some AOL'er. +"To this end we dedicate ourselves..." -Don + -- From the sig of "Don", don@cs.byu.edu +% +Shoot me again. +Just proving that the quickest way to solve the problem is to post a +whine to the newsgroups: within moments the solution presents itself to +me, and meanwhile my ass is hanging out on the Net... *sigh*... + -- Dave Phillips, dlphilp@bright.net, about problem solving via news +% +Besides, its really not worthwhile to use more than two times your physical +ram in swap (except in a select few situations). The performance of the system +becomes so abysmal you'd rather heat pins under your toenails while reciting +Windows95 source code and staring at porn flicks of Bob Dole than actually try +to type something. + -- seen on c.o.l.development.system, about the size of the swap space +% +Only wimps use tape backup: _real_ men just upload their important stuff +on ftp, and let the rest of the world mirror it ;) + -- Linus Torvalds, about his failing hard drive on linux.cs.helsinki.fi +% +One of the things that hamper Linux's climb to world domination is the +shortage of bad Computer Role Playing Games, or CRaPGs. No operating system +can be considered respectable without one. + -- Brian O'Donnell, odonnllb@tcd.ie +% +The game, anoraks.2.0.0.tgz, will be available from sunsite until somebody +responsible notices it and deletes it, and shortly from +ftp.mee.tcd.ie/pub/Brian, though they don't know that yet. + -- Brian O'Donnell, odonnllb@tcd.ie +% +'Ooohh.. "FreeBSD is faster over loopback, when compared to Linux +over the wire". Film at 11.' + -- Linus Torvalds +% +Q: Would you like to see the WINE list? +A: What's on it, anything expensive? +Q: No, just Solitaire and MineSweeper for now, but the WINE is free. + -- Kevin M. Bealer, about the WINdows Emulator +% +So in the future, one 'client' at a time or you'll be spending CPU time with +lots of little 'child processes'. + -- Kevin M. Bealer, commenting on the private life of a Linux nerd +% +By the way, I can hardly feel sorry for you... All last night I had to listen +to her tears, so great they were redirected to a stream. What? Of _course_ +you didn't know. You and your little group no longer have any permissions +around here. She changed her .lock files, too. + -- Kevin M. Bealer, commenting on the private life of a Linux nerd +% +We should start referring to processes which run in the background by their +correct technical name... paenguins. + -- Kevin M. Bealer, commenting on the penguin Linux logo +% +We can use symlinks of course... syslogd would be a symlink to syslogp and +ftpd and ircd would be linked to ftpp and ircp... and of course the +point-to-point protocal paenguin. + -- Kevin M. Bealer, commenting on the penguin Linux logo +% +This is a logical analogy too... anyone who's been around, knows the world is +run by paenguins. Always a paenguin behind the curtain, really getting things +done. And paenguins in politics--who can deny it? + -- Kevin M. Bealer, commenting on the penguin Linux logo +% +Linux: Where Don't We Want To Go Today? + -- Submitted by Pancrazio De Mauro, paraphrasing some well-known sales talk +% +The most important design issue... is the fact that Linux is supposed to +be fun... + -- Linus Torvalds at the First Dutch International Symposium on Linux +% +In short, at least give the penguin a fair viewing. If you still don't +like it, that's ok: that's why I'm boss. I simply know better than you do. + -- Linus "what, me arrogant?" Torvalds, on c.o.l.advocacy +% +<SomeLamer> what's the difference between chattr and chmod? +<SomeGuru> SomeLamer: man chattr > 1; man chmod > 2; diff -u 1 2 | less + -- Seen on #linux on irc +% +The linuX Files -- The Source is Out There. + -- Sent in by Craig S. Bell, goat@aracnet.com +% +"... being a Linux user is sort of like living in a house inhabited +by a large family of carpenters and architects. Every morning when +you wake up, the house is a little different. Maybe there is a new +turret, or some walls have moved. Or perhaps someone has temporarily +removed the floor under your bed." - Unix for Dummies, 2nd Edition + -- found in the .sig of Rob Riggs, rriggs@tesser.com +% +C is quirky, flawed, and an enormous success + -- Dennis M. Ritchie +% +If Bill Gates is the Devil then Linus Torvalds must be the Messiah. + -- Unknown source +% +Vini, vidi, Linux! + -- Unknown source +% +The good thing about standards is that there are so many to choose from. + -- Andrew S. Tanenbaum +% +I'm telling you that the kernel is stable not because it's a kernel, +but because I refuse to listen to arguments like this. + -- Linus Torvalds +%
\ No newline at end of file diff --git a/konversation/scripts/gauge b/konversation/scripts/gauge new file mode 100755 index 0000000..2befb87 --- /dev/null +++ b/konversation/scripts/gauge @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +PORT=$1 +SERVER=$2 +TARGET=$3 + +shift +shift +shift + +PERCENTAGE=$1 + +if [ ! $TARGET ] +then + dcop $PORT default error "Can't write into status view." +else + if [ ! $PERCENTAGE ] + then + dcop $PORT default error "USAGE: $0 <percentage>" + else + PERCENTAGE=`echo $PERCENTAGE | sed 's/^0\+//'` + LEFT=$(($PERCENTAGE/5)) + RIGHT=$((20-$LEFT)) + + if [[ $PERCENTAGE -lt 0 ]]; then + dcop $PORT default error "Percentage has to be bigger than 0" + exit + fi + + if [[ $PERCENTAGE -gt 100 ]]; then + dcop $PORT default error "Percentage has to be smaller than 100" + exit + fi + + + if [ $PERCENTAGE = 50 ] + then + METER="|" + else + if [[ $PERCENTAGE -lt 50 ]] + then + METER="\\" + else + METER="/" + fi + fi + + for (( i=$LEFT ; $i != 0 ; i-- )) + do + OUTPUT="$OUTPUT," + done + + OUTPUT="$OUTPUT$METER" + + for (( i=$RIGHT ; $i != 0 ; i-- )) + do + OUTPUT="$OUTPUT," + done + + OUTPUT=`echo $OUTPUT | sed 's/,/ /g'` + + OUTPUT="[$OUTPUT] $PERCENTAGE%" + + if [ $PERCENTAGE = 100 ] + then + OUTPUT="$OUTPUT *ding*" + fi + + dcop $PORT default say $SERVER "$TARGET" "Beer load $OUTPUT" + fi +fi diff --git a/konversation/scripts/kdeversion b/konversation/scripts/kdeversion new file mode 100755 index 0000000..34fef02 --- /dev/null +++ b/konversation/scripts/kdeversion @@ -0,0 +1,9 @@ +#!/bin/sh + +# Prints the KDE version. + +PORT=$1; +SERVER=$2; +TARGET=$3; + +kde-config --version | while read line; do dcop $PORT default say $SERVER "$TARGET" "$line"; done diff --git a/konversation/scripts/mail b/konversation/scripts/mail new file mode 100755 index 0000000..b5882b1 --- /dev/null +++ b/konversation/scripts/mail @@ -0,0 +1,70 @@ +#!/bin/bash + +# +# Licensed under GPL v2 or later at your option +# Copyright 2005 by John Tapsell <john.tapsell@kdemail.net> + +PORT=$1; +SERVER=$2; +TARGET=$3; + +FOLDER=$4; + + +if [ "$FOLDER" = "" ] ; then + FOLDER="inbox" +fi + + +getmails() +{ + + dcop kmail > /dev/null || { + dcop $PORT default info "Sorry kmail is not running" + exit + } + + for f in $(dcop kmail KMailIface folderList) ; do + MAILFOLDER=$(dcop $(dcop kmail KMailIface getFolder $f) "displayPath" | grep -i $FOLDER) + if [ "$MAILFOLDER" != "" ] ; then + FOUNDFOLDER=1 + MAILCOUNT=$(dcop $(dcop kmail KMailIface getFolder $f ) "unreadMessages()" ) + MAILTOTALCOUNT=$(dcop $(dcop kmail KMailIface getFolder $f ) "messages()" ) + MAILTOTALCOUNT=$(($MAILCOUNT + $MAILTOTALCOUNT)) + if [[ -z "$MAILCOUNT" ]] ; then MAILCOUNT = "0" ; fi + if [ "$MAILCOUNT" != 0 ] ; then + FOUNDEMAIL=1 + echo "Email folder %B$MAILFOLDER%B has %B$MAILCOUNT%B unread messages, out of %B$MAILTOTALCOUNT%B" + fi + fi + done + + if [[ -z "$FOUNDEMAIL" ]] ; then + if [[ -z "$FOUNDFOLDER" ]] ; then + dcop $PORT default info "No email folders were found that had a name containing '$FOLDER'" + exit + else + echo "No new emails in any folders matching '$FOLDER'" + fi + fi + +} + +if [[ -z "$3" ]] ; then + echo "Scripts are not meant to be called from the command line." + echo "This script should be installed to $KDEDIR/share/apps/konversation/scripts" + echo "Then executed with /script from the konversation" + echo + echo The output is: + getmails + exit +fi + +#LINECOUNT=$(getmails | wc -l) +#if [[ "$LINECOUNT" -gt 5 ]] ; then +# dcop $PORT default info "There are more than 5 matches. Cancelling to avoid flooding the server" +# exit +#fi + +getmails | head -n 3 | while read line; do dcop $PORT default say $SERVER "$TARGET" "$line"; done + diff --git a/konversation/scripts/media b/konversation/scripts/media new file mode 100755 index 0000000..e369262 --- /dev/null +++ b/konversation/scripts/media @@ -0,0 +1,484 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 2 of the License, or +#(at your option) any later version. + +# Copyright 2006 Eli J. MacKenzie +# Inspired by `media` (Copyright 2005 İsmail Dönmez) + + +# If you wish to customize the formatting strings, do so in this table. +# Do not change the numbers unless you're changing the logic. +# Title, artist, and album will be set once the player is queried. +# See Player.format() for how these are used. + + +#Changing these 3 values will likely cause the script to fail +Title =4 +Artist=2 +Album =1 + +#To disable self-titled (eponymous) checking, subtract 8 +SelfTitled=11 + +outputFormat="/me $intro $info [$player]" +formatStrings = { + Title+SelfTitled : "$title by $artist (eponymous)", + SelfTitled : "${artist}'s self-titled album", + Title+Artist+Album : "$title by $artist on $album", #7,15 + Title+Artist : "$title by $artist", #6,14 + Title+Album : "$title from $album", #5,13 + Album+Artist : "$album by $artist", #3,11 + Title : "$title", #4,12 + Artist : "$artist", #2,10 + Album : "$album", #1,9 +} + +#Intro defaults to first type the player supports when a specific type was not demanded +formatVariables={'audio': 'is listening to', 'video': 'is watching'} + +## Static player ranking list +## If you add a new player, you must add it here or it won't get checked when in audio-only or video-only modes. +playerRankings= { + 'video' :['kaffeine','kmplayer', 'kplayer', 'noatun', 'kdetv'], + 'audio' :['amarok', 'MPD' 'juk', 'noatun', 'kscd', 'kaffeine', 'kmplayer', 'Audacious', 'xmms', 'yammi'] +} + +## Title, album and artist fields to be quoted depending on contents +# List the possible trigger characters here. +# If you want a '-', it must be first. if you want a '^', it must be last. +SIMPLE_FIXUP = '' #I use ' ' + +# If you want to use a regex for the above, specify it here in which case it will be used +REGEX_FIXUP = '' + +# Quote chars to use: +QUOTE_BEFORE = '"' +QUOTE_AFTER = '"' + + + ############################### + ## The Real work is done below +############################# + +import os +import sys +import re +import string + +try: + APP_ID = sys.argv[1] + IRC_SERVER = sys.argv[2] + TARGET = sys.argv[3] +except IndexError: + print >>sys.stderr, "This script is intended to be run from within Konversation." + sys.exit(0) + +if (sys.hexversion >> 16) < 0x0204: + err="The media script requires Python 2.4." + os.popen('dcop %s default error "%s"' %(APP_ID,err)) + sys.exit(err) + +import subprocess + +# Python 2.5 has this ... +try: + any(()) +except NameError: + def any(data): + """Return true of any of the items in the sequence 'data' are true. + + (ie non-zero or not empty)""" + try: + return reduce(lambda x,y: bool(x) or bool(y), data) + except TypeError: + return False + +def tell(data, feedback='info'): + """Report back to the user""" + l=['dcop', APP_ID, 'default', feedback] + if type(data) is type(''): + l.append(data) + else: + l.extend(data) + subprocess.Popen(l).communicate() + +class Player(object): + def __init__(self, display_name, playerType=None): + if playerType is None: + self.type = "audio" + else: + self.type=playerType + self.displayName=display_name + self.running = False + d={} + d.update(formatVariables) + d['player']=self.displayName + self._format = d + + def get(self, mode): + data=self.getData() + if any(data): + self._format['info']=self.format(*data) + if mode and mode != self.displayName: + self._format['intro']=self._format[mode] + else: + self._format['intro']=self._format[self.type.replace(',','').split()[0]] + return string.Template(outputFormat).safe_substitute(self._format) + return '' + + def format(self, title='', artist='', album=''): + """Return a 'pretty-printed' info string for the track. + + Uses formatStrings from above.""" + #Update args last to prevent non-sensical override in formatVariables + x={'title':title, 'artist':artist, 'album':album} + if FIXUP: + for i,j in x.items(): + if re.search(FIXUP,j): + x[i]='%s%s%s'%(QUOTE_BEFORE,j,QUOTE_AFTER) + self._format.update(x) + n=0 + if title: + n|=4 #Still binary to make you read the code ;p + if artist: + if artist == album: + n|=SelfTitled + else: + n|=2 + if album: + n|=1 + if n: + return string.Template(formatStrings[n]).safe_substitute(self._format) + return '' + + def getData(self): + """Implement this to do the work""" + return '' + + def reEncodeString(self, input): + if input: + try: + input = input.decode('utf-8') + except UnicodeError: + try: + input = input.decode('latin-1') + except UnicodeError: + input = input.decode('ascii', 'replace') + except NameError: + pass + return input.encode('utf-8') + + def test_format(self, title='', artist='', album=''): + s=[] + l=["to","by","on"] + if title: + s.append(title) + else: + album,artist=artist,album + l.pop() + if artist: + s.append(artist) + else: + del l[1] + if album: + s.append(album) + else: + l.pop() + t=["is listening"] + while l: + t.append(l.pop(0)) + t.append(s.pop(0)) + return ' '.join(t) + + def isRunning(self): + return self.running + +class DCOPPlayer(Player): + def __init__(self, display_name, service_name, getTitle='', getArtist='', getAlbum='',playerType=None): + Player.__init__(self, display_name, playerType) + self.serviceName=service_name + self._title=getTitle + self._artist=getArtist + self._album=getAlbum + self.DCOP="" + + def getData(self): + self.getService() + return (self.grab(self._title), self.grab(self._artist), self.grab(self._album)) + + def getService(self): + if self.DCOP: + return self.DCOP + running = re.findall('^' + self.serviceName + "(?:-\\d*)?$", DCOP_ITEMS, re.M) + if type(running) is list: + try: + running=running[0] + except IndexError: + running='' + self.DCOP=running.strip() + self.running=bool(self.DCOP) + return self.DCOP + + def grab(self, item): + if item and self.isRunning(): + return self.reEncodeString(os.popen("dcop %s %s"%(self.DCOP, item)).readline().rstrip('\n')) + return '' + + def isRunning(self): + self.getService() + return self.running + +class AmarokPlayer(DCOPPlayer): + def __init__(self): + DCOPPlayer.__init__(self,'Amarok','amarok','player title','player artist','player album') + + def getData(self): + data=DCOPPlayer.getData(self) + if not any(data): + data=(self.grab('player nowPlaying'),'','') + if not data[0]: + return '' + return data + +#class Amarok2Player(Player): +# def __init__(self): +# Player.__init__(self, 'Amarok2', 'audio') +# self.isRunning() +# +# def getData(self): +# playing=os.popen("qdbus org.mpris.amarok /Player PositionGet").readline().strip() != "0" +# if playing and self.isRunning(): +# for line in os.popen("qdbus org.mpris.amarok /Player GetMetadata").readlines(): +# if re.match("^title", line): +# title=self.reEncodeString(line.strip().split(None,1)[1]) +# if re.match("^artist", line): +# artist=self.reEncodeString(line.strip().split(None,1)[1]) +# if re.match("^album", line): +# album=self.reEncodeString(line.strip().split(None,1)[1]) +# return (title, artist, album) +# else: +# return '' +# +# def isRunning(self): +# qdbus_items=subprocess.Popen(['qdbus'], stdout=subprocess.PIPE).communicate()[0] +# running=re.findall('^ org.mpris.amarok$', qdbus_items, re.M) +# if type(running) is list: +# try: +# running=running[0] +# except IndexError: +# running='' +# self.running=bool(running.strip()) +# return self.running + +import socket + +class MPD(Player): + def __init__(self, display_name): + Player.__init__(self, display_name) + + self.host = "localhost" + self.port = 6600 + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(0.5) + + try: + self.sock.connect((self.host, self.port)) + # just welcome message, we don't need it + self.sock.recv(1024) + self.running = True + except socket.error: + self.running = False + + def getData(self): + if not self.running: + return '' + try: + self.sock.send("currentsong\n") + data = self.sock.recv(1024) + except socket.error: + return '' + + # mpd sends OK always, so if nothing to show, we should seek for at least 3 chars + if len(data) < 4: + return '' + else: + # if there is Artist, Title and Album, get it + data=data.splitlines() + d={} + for i in data: + if ':' not in i: + continue + k,v=i.split(':',1) + d[k.lower()]=self.reEncodeString(v.strip()) + data=(d.get('title',''),d.get('artist',''),d.get('album','')) + if not any(data): + return d.get('file','') + return data + +class StupidPlayer(DCOPPlayer): + def getData(self): + data=DCOPPlayer.getData(self)[0] + if data: + if data.startswith('URL'): + # KMPlayer window titles in the form of "URL - file:///path/to/<media file> - KMPlayer" + data=data.split(None,2)[2].rsplit(None,2)[0].rsplit('/')[-1] + else: + # KPlayer window titles in the form of "<media file> - KPlayer" + data=data.rsplit(None,2)[0] + return (data,'','') + return '' + +try: + import xmms.common + class XmmsPlayer(Player): + def __init__(self, display_name): + Player.__init__(self, display_name) + + def isRunning(self): + self.running = xmms.control.is_running() + return self.running + + def getData(self): + if self.isRunning() and xmms.control.is_playing(): + # get the position in the playlist for current playing track + index = xmms.control.get_playlist_pos(); + # get the title of the currently playing track + return (self.reEncodeString(xmms.control.get_playlist_title(index)),'','') + return '' + +except ImportError: + XmmsPlayer=Player + +class AudaciousPlayer(Player): + def __init__(self, display_name): + Player.__init__(self, display_name) + + def isRunning(self): + self.running = not os.system('audtool current-song') + return self.running + + def getData(self): + if self.isRunning() and not os.system('audtool playback-playing'): + # get the title of the currently playing track + data = os.popen('audtool current-song').read().strip() + data_list = data.split(' - ') + list_length = len(data_list) + if list_length == 1: + return (self.reEncodeString(data_list[0]),'','') + elif list_length == 3: + return (self.reEncodeString(data_list[-1]),data_list[0],data_list[1]) + else: + return (self.reEncodeString(data),'','') + else: + return '' + + +def playing(playerList, mode=None): + for i in playerList: + s=i.get(mode) + if s: + tell([IRC_SERVER, TARGET, s], 'say' ) + return 1 + return 0 + +def handleErrors(playerList, kind): + if kind: + kind=kind.strip() + kind=kind.center(len(kind)+2) + else: + kind= ' supported ' + x=any([i.running for i in playerList]) + if x: + l=[i.displayName for i in playerList if i.isRunning()] + err= "Nothing is playing in %s."%(', '.join(l)) + else: + err= "No%splayers are running."%(kind,) + tell(err,'error') + +def run(kind): + if not kind: + kind = '' + play=PLAYERS + else: + if kind in ['audio', 'video']: + unsorted=dict([(i.displayName.lower(),i) for i in PLAYERS if kind in i.type]) + play=[unsorted.pop(i.lower(),Player("ImproperlySupported")) for i in playerRankings[kind]] + if len(unsorted): + play.extend(unsorted.values()) + else: + play=[i for i in PLAYERS if i.displayName.lower() == kind] + try: + kind=play[0].displayName + except IndexError: + tell("%s is not a supported player."%(kind,),'error') + sys.exit(0) + + if not playing(play, kind): + handleErrors(play, kind) + + +#It would be so nice to just keep this pipe open and use it for all the dcop action, +#but of course you're supposed to use the big iron (language bindings) instead of +#the command line tools. One could consider `dcop` the bash dcop language binding, +#but of course when using shell you don't need to be efficient at all, right? + +DCOP_ITEMS=subprocess.Popen(['dcop'], stdout=subprocess.PIPE).communicate()[0] #re.findall("^amarok(?:-\\d*)?$",l,re.M) + +# Add your new players here. No more faulty logic due to copy+paste. + +PLAYERS = [ +AmarokPlayer(), +DCOPPlayer("JuK","juk","Player trackProperty Title","Player trackProperty Artist","Player trackProperty Album"), +DCOPPlayer("Noatun",'noatun',"Noatun title",playerType='audio, video'), +DCOPPlayer("Kaffeine","kaffeine","KaffeineIface title","KaffeineIface artist","KaffeineIface album",playerType='video, audio'), +StupidPlayer("KMPlayer","kmplayer","kmplayer-mainwindow#1 caption",playerType="video audio"), +StupidPlayer("KPlayer","kplayer","kplayer-mainwindow#1 caption",playerType="video audio"), +DCOPPlayer("KsCD","kscd","CDPlayer currentTrackTitle","CDPlayer currentArtist","CDPlayer currentAlbum"), +DCOPPlayer("kdetv","kdetv","KdetvIface channelName",playerType='video'), +AudaciousPlayer('Audacious'), XmmsPlayer('XMMS'), +DCOPPlayer("Yammi","yammi","YammiPlayer songTitle","YammiPlayer songArtist","YammiPlayer songAlbum"), +MPD('MPD') +] + +# Get rid of players that didn't get subclassed so they don't appear in the available players list +for i in PLAYERS[:]: + if type(i) is Player: + PLAYERS.remove(i) + +if REGEX_FIXUP: + FIXUP=REGEX_FIXUP +elif SIMPLE_FIXUP: + FIXUP="[%s]"%(SIMPLE_FIXUP) +else: + FIXUP='' + +# It all comes together right here +if __name__=="__main__": + + if not TARGET: + s="""media v2.0.1 for Konversation 1.0. One media command to rule them all, inspired from Kopete's now listening plugin. +Usage: + "\00312/media\017" - report what the first player found is playing + "\00312/media\017 [ '\00312audio\017' | '\00312video\017' ]" - report what is playing in a supported audio or video player + "\00312/media\017 { \00312Player\017 }" - report what is playing in \00312Player\017 if it is supported + + Available players are: + """ + ', '.join([("%s (%s)"%(i.displayName,i.type)) for i in PLAYERS]) + + for i in s.splitlines(): + tell(i) + #tell("%s"%(len(s.splitlines()),)) + # called from the server tab + pass + else: + try: + kind = sys.argv[4].lower() + except IndexError: + kind = None + + run(kind) + diff --git a/konversation/scripts/sayclip b/konversation/scripts/sayclip new file mode 100755 index 0000000..06b8234 --- /dev/null +++ b/konversation/scripts/sayclip @@ -0,0 +1,19 @@ +#!/bin/sh + +# Prints the contents of the clipbaord into Konversation with flood protection. +# Klipper must be running. +# Usage: /exec sayclip [pause-time] +# Pause time defaults to 1 second. +# By Gary Cramblitt (garycramblitt@comcast.net) +# Use however you wish. + +PORT=$1; +SERVER=$2; +TARGET=$3; +PAUSETIME="1s"; +if [ -n "$4" ] +then + PAUSETIME="$4" +fi + +dcop klipper klipper getClipboardContents | while read line; do dcop $PORT default say $SERVER "$TARGET" " $line"; sleep $PAUSETIME; done diff --git a/konversation/scripts/sysinfo b/konversation/scripts/sysinfo new file mode 100644 index 0000000..d2b3851 --- /dev/null +++ b/konversation/scripts/sysinfo @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Licensed under GPL v2 or later at your option +# Copyright 2004 by Michiel de Boer <infobash@rebelhomicide.demon.nl> +# Copyright 2006 by Emil Obermayr <nobs@tigress.com> +# +# this version is stripped down to no-color +# +# get full original version at http://rebelhomicide.demon.nl/scripts/ + +PORT=$1; +SERVER=$2; +TARGET=$3; + +export LC_ALL="C" + +HN="$(hostname)" +OSKERN="$(uname -s) $(uname -r)" +if [ "$KDE_FULL_SESSION" = "true" ]; then + if [ "$KDE_SESSION_VERSION" = 4 ]; then + KDE="$(kde4-config --version | sed -n '2p' | sed 's/://;s/ *$//')" + else + KDE="$(kde-config --version | sed -n '2p' | sed 's/://;s/ *$//')" + fi +fi + +CPU=$(awk -F':' '/model name/{name=$2} + /cpu MHz/{mhz=int($2)} + /bogomips/ {bogo=int($2) +} +END{ + gsub (/ *\(tm\) */, " ", name); + gsub (/ *\(TM\) */, " ", name); + gsub (/ *Processor */, " ", name); + gsub (/ *$/, "", name); + gsub (/^ */, "", name); + printf "CPU: %s at %d MHz (%d bogomips)", name, mhz, bogo; +} +' /proc/cpuinfo ) + +HDD=$(df -lP| awk '($1~/\/dev/){ + use+=$3/1024^2; + tot+=$2/1024^2; + } + END{print "HD: " int(use) "/" int(tot) "GB"}') + +MEM=$(awk '($1=="MemTotal:"){tot=int($2/1024)} + ($1=="MemFree:"){free=int($2/1024)} + END{ +use=tot-free +print "RAM: " use "/" tot "MB"} +' /proc/meminfo) + +PROC="$(($(ps aux | wc -l)-1))" + +UPT=$(awk '{u="s"; +n=$1; +if (n>60){ + n2=n%60; + n/=60; + u="min"; + if (n>60){ + n2=n%60; + n/=60; + u="h"; + if (n>24){ + n2=n%24; + n/=24; + u="d"; + } + } + } +printf ("%d.%d%s up",n, n2, u); +}' /proc/uptime ) + +out="Sysinfo for '$HN': $OSKERN running $KDE, $CPU, $HDD, $MEM, $PROC proc's, ${UPT}" + +if [ "x$PORT" = "x" ] ; then + echo "$out" +else + if [ "x$TARGET" = "x" ] ; then + dcop $PORT default error "$out" + else + dcop $PORT default say $SERVER "$TARGET" "$out" + fi +fi diff --git a/konversation/scripts/tinyurl b/konversation/scripts/tinyurl new file mode 100755 index 0000000..14efde9 --- /dev/null +++ b/konversation/scripts/tinyurl @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# Creates a TinyURL from a long URL +# Licensed under GPL v2 or later at your option +# Copyright 2007 Terence Simpson + +PORT=$1 +SERVER=$2 +TARGET=$3 +export URL="$4" +NICK="$5" + +if test ! -z $URL; then + if test $(which curl); then + TINYURL="$(curl -s -i http://tinyurl.com/create.php?url=$URL|grep "The following URL" -A3|tail -1|awk -F\> '{print $3}'|sed 's,</b,,')" + else + TINYURL="$(wget -T10 -t2 -qO- http://tinyurl.com/create.php?url=$URL|grep "The following URL" -A3|tail -1|awk -F\> '{print $3}'|sed 's,</b,,')" + fi +else dcop $PORT default error "No url given: usage is \"/tinyurl URL [NickName]\"" + exit 1 +fi + +if test -z $TINYURL; then + dcop $PORT default error "Unable run tinyurl script, please make sure you have curl or wget installed" +else + if test ! -z $NICK; then + dcop $PORT default say $SERVER "$TARGET" "${NICK}: $TINYURL" + else + dcop $PORT default say $SERVER "$TARGET" "$TINYURL" + fi +fi diff --git a/konversation/scripts/uptime b/konversation/scripts/uptime new file mode 100755 index 0000000..8c25cfd --- /dev/null +++ b/konversation/scripts/uptime @@ -0,0 +1,56 @@ +#!/usr/bin/env perl + +# Uptime script for Konversation +# made by Magnus Romnes (gromnes@online.no) +# The script might be uncompatible with other unix variants than linux. +# only tested on Debian GNU/Linux Sid +# use the code for whatever you wish :-) + + +$PORT = shift; +$SERVER = shift; +$TARGET = shift; + +$PLATFORM = `uname -s`; +chomp($PLATFORM); +if($PLATFORM eq "FreeBSD") { + $BOOTTIME = `sysctl kern.boottime`; + $BOOTTIME =~ s/.* sec = ([0-9]+).*/\1/; + $TIMENOW = `date +%s`; + $seconds = $TIMENOW - $BOOTTIME; +} else { + $UPTIME = `cat /proc/uptime`; + if (not $UPTIME) { + exec 'dcop', $PORT, 'default', 'info', 'Could not read uptime. Check that /proc/uptime exists.'; + } + @uparray = split(/\./, $UPTIME); + $seconds = $uparray[0]; +} + +if($seconds >= 86400) +{ + $days = int($seconds/86400); + $seconds = $seconds-($days*86400); +} +if($seconds >= 3600) +{ + $hours = int($seconds/3600); + $seconds = $seconds-($hours*3600); +} +if($seconds > 60) +{ + $minutes = int($seconds/60); +} +if( $days && $hours ) { + exec 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, "Uptime: $days days, $hours hours and $minutes minutes"; +} +elsif( !$days && $hours ) { + exec 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, "Uptime: $hours hours and $minutes minutes"; +} +elsif( $days && !$hours ) { + exec 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, "Uptime: $days days and $minutes minutes"; +} +elsif( !$days && !$hours ) { + exec 'dcop', $PORT, 'default', 'say', $SERVER, $TARGET, "Uptime: $minutes minutes"; +} + diff --git a/konversation/scripts/weather b/konversation/scripts/weather new file mode 100755 index 0000000..5d3dafb --- /dev/null +++ b/konversation/scripts/weather @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2005,2007 by İsmail Dönmez <ismail@pardus.org.tr> +# Licensed under GPL v2 or later at your option + +import sys +from subprocess import * + +port = sys.argv[1] +server = sys.argv[2] +target = sys.argv[3] + +msg_template = "Current weather for %%B%s%%B : Temperature: %%B%s%%B, Pressure: %%B%s%%B, Wind: %%B%s%%B" +msg_detailed_template = "Current weather for %%B%s%%B : %%B%s%%B, Temperature: %%B%s%%B, Pressure: %%B%s%%B, Wind: %%B%s%%B" + +def printMessage(message=None): + Popen(['dcop', port, 'default', 'say', server, target, message]).communicate() + +def printError(message=None): + Popen(['dcop', port, 'default', 'error', message]).communicate() + +def getData(section, station=None): + if station: + data = Popen(['dcop','KWeatherService','WeatherService', section, station], stdout=PIPE).communicate()[0].rstrip("\n") + else: + data = Popen(['dcop','KWeatherService','WeatherService', section], stdout=PIPE).communicate()[0].rstrip("\n") + + return data + +def stationMessage(station): + city = getData("stationName", station) + temperature = getData("temperature", station) + pressure = getData("pressure", station) + wind = getData("wind", station) + detail = getData("weather", station) + detail2 = getData("cover", station) + + if detail2: + if detail: + detail = detail+', '+detail2 + else: + detail = detail2 + + if detail: + return msg_detailed_template % (city,detail,temperature,pressure,wind) + else: + return msg_template % (city,temperature,pressure,wind) + +def printWeather(index): + stations = getData("listStations").split("\n") + + if index != None: + if index <= 0: + printError("Station index should be bigger than zero!") + elif index > len(stations): + printError("Station index is out of range") + else: + printMessage(stationMessage(stations[index-1])) + else: + for station in stations: + printMessage(stationMessage(station)) + +if __name__ == "__main__": + try: + index = int(sys.argv[4]) + except IndexError: + index = None + + printWeather(index) |