CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Posted by jpope on Wed 20th Jan 05:04 (modification of post by jpope view diff)
diff | download | new post

  1. #!/bin/bash
  2.  
  3. ##############################################################
  4. ## #! Forums Active Topics Pipe Menu                        ##
  5. ##                                                          ##
  6. ## v 1.0 by jpope 01.18.2010                                ##
  7. ##   - based on conky config by mrpeachy @                  ##
  8. ##     http://crunchbanglinux.org/forums/post/51330/#p51330 ##
  9. ##                                                          ##
  10. ## v 1.1 by jpope 01.19.2010                                ##
  11. ##                                                          ##
  12. ##############################################################
  13.  
  14. ## Settings ##################################################
  15. browser=$(echo firefox-3.5)
  16. maxthreads=5
  17. ##############################################################
  18. DIR=$(echo /home/$(whoami)/tmp/)
  19. tmpfile=$(echo forumspipemenu.html)
  20. forumlink=$(echo http://crunchbanglinux.org/forums/search/recent/)
  21. curl $forumlink > $DIR$tmpfile
  22. #tempfile=$(echo file://$DIR$tmpfile)
  23. tempfile=$DIR$tmpfile
  24. th=1
  25. pipeopen=$(echo "echo <openbox_pipe_menu>")
  26. pipeclose=$(echo "echo </openbox_pipe_menu>")
  27. title=$(echo "echo <separator label=\"CRUNCHBANGLINUX.ORG FORUM ACTIVITY\"/>")
  28. itemforums=$(echo "echo <item label=\"Goto Recent Topics -->\">")
  29. itemforums_execute=$(echo "echo $browser $forumlink")
  30. item_close=$(echo "echo </item>")
  31. actionexe=$(echo "echo <action name=\"Execute\">")
  32. actionexe_close=$(echo "echo </action>")
  33. execute=$(echo "echo <execute>")
  34. execute_close=$(echo "echo </execute>")
  35. separator=$(echo "echo <separator/>")
  36.  
  37.     $pipeopen
  38.         $title
  39.             $itemforums
  40.                 $actionexe
  41.                     $execute
  42.                         $itemforums_execute
  43.                     $execute_close
  44.                 $actionexe_close
  45.             $item_close
  46.         $separator
  47.         while [ $th -le $maxthreads ]; do
  48.             topic=$(less $tempfile | grep -n '</span> <a href' | sed -n $th\p | awk -F'/">' '{print $2}' | awk -F'</a>' '{print $1}' | sed "s|&#039;|'|g" | fold -sw 40)
  49.             t_link=$(less $tempfile | grep -n '</span> <a href' | sed -n $th\p | awk -F'href="' '{print $2}' | awk -F'">' '{print $1}')
  50.             timestamp=$(less $tempfile | grep -n '<li class="info-lastpost' | sed -n $th\p | awk -F'>' '{print $6 $9}' | sed -e 's|</a| |' | sed -e 's|</cite||' | sed -e 's/Today/Last post at/')
  51.             ts_link=$(less $tempfile | grep -n '<li class="info-lastpost' | sed -n $th\p | awk -F'href="' '{print $2}' | awk -F'">' '{print $1}')
  52.  
  53.             item_topic=$(echo "echo <item label=\"$th) $topic\">")
  54.             item_topic_link=$(echo "echo $browser \"$t_link\"")
  55.             item_timestamp=$(echo "echo <item label=\"$timestamp\">")
  56.             item_timestamp_link=$(echo "echo $browser \"$ts_link\"")
  57.  
  58.             $item_topic
  59.                 $actionexe
  60.                     $execute
  61.                         $item_topic_link
  62.                     $execute_close
  63.                 $actionexe_close
  64.             $item_close
  65.             $item_timestamp
  66.                 $actionexe
  67.                     $execute
  68.                         $item_timestamp_link
  69.                     $execute_close
  70.                 $actionexe_close
  71.             $item_close
  72.         $separator
  73.         th=$(( $th + 1 ))
  74.         done
  75.     $pipeclose
  76. echo $(rm $DIR$tmpfile)

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me