LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > leehanken
User Name
Password

Notices


Rate this Entry

Old Laptop Wall Decoration

Posted 12-18-2010 at 12:18 AM by leehanken

Photo

Aim was to recycle an old Windows 98 Toshiba laptop to do something useful or fun.

- Using an installation of Slackware 13.0 and a wireless dongle.

- Script to display email inbox, facebook stream and a number of rss feeds, onto the console.

- Alternatively to play a slideshow of photos.

- Choose a radio station and play in the background, depending on the time of day.

How this was achieved:-

- To make the script start automatically:

In /etc/initab

Code:
# These are the standard console login getties in multiuser mode:
c1:1235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty1 linux
c2:1235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty2 linux
c3:1235:respawn:/sbin/agetty -n -l /usr/sbin/autologin 38400 tty3 linux
autologin.c
Code:
int main()
{
	execlp ( "login","login","-f","user",0);
}
- To get email

Code:
/usr/sbin/anacron -s -n

/usr/bin/fetchmail -f /root/.fetchmailrc -k -d 300
/etc/anacrontab

Code:
SHELL=/usr/bin/bash
PATH=/usr/sbin:/usr/bin
MAILTO=root
RANDOM_DELAY=0
START_HOURS_RANGE=0-24
1	0	clearmail	/usr/bin/cat /dev/null > /var/mail/root
.fetchmailrc

Code:
set daemon 300
poll imap.isp.com with proto IMAP
       user 'user@domain.com' there with password 'mypassword' is 'root' 
here
- To get and display rss feeds in python

Code:
import feedparser
feeds = ("http://feeds1.server.com/rss.xml","http://feed2.server.com/rss.xml")
c = 0
for feed in feeds:
	d = feedparser.parse(feed)
	for value in d.entries:
		str = value['summary_detail']['value']
		str = str.encode('ascii', 'replace')
		if (c == 0):
			print "\033[31m";
		else:
			print "\033[35m";
		print str
		c = (c + 1) % 2
print "\033[37m"
- To pipe output to console one line at a time, in C

Code:
#include <stdio.h>
#include <stdlib.h>

main()
{
	char buffer[80];
	char *ok;

	while (!feof(stdin)) {
		ok=fgets(buffer,80,stdin);
		if (ok != 0)
			printf("%s",buffer);
		system("/usr/bin/sleep 1");
	}

}
- Shell script to do all of the above

/usr/bin/go

Code:
setterm -blank 0
while true;
do 
	/usr/bin/mail -u root -H > /root/item1.txt
	/usr/bin/python /root/my/my.py > /root/item2.txt
	/usr/bin/fbcmd stream > /root/item3.txt
	/usr/bin/slowoutput < /root/item1.txt
	/usr/bin/slowoutput < /root/item2.txt
	/usr/bin/slowoutput < /root/item3.txt
done
- Startup script to decide what to do based on time

Code:
HOUR="`/usr/bin/date +\"%H\"`";
if [ "`/usr/bin/tty`" = '/dev/tty1' ];
  then
    if [[ $HOUR -lt 7 ]];
	then
	  /usr/bin/playradio1 &
    elif [[ $HOUR -gt 6  && $HOUR -lt 12 ]];
	then
	  /usr/bin/playradio2 &
    elif [[ $HOUR -gt 11  &&  $HOUR -lt 14 ]];
	then
	  /usr/bin/playradio3 &
    elif [[ $HOUR -gt 13  &&  $HOUR -lt 20 ]];
	then
	  /usr/bin/playradio4 &
    elif [[ $HOUR -gt 19 ]];
	then
	  /usr/bin/playradio5 &
    fi
elif [ "`/usr/bin/tty`" = '/dev/tty2' ];
    then
         if [[ $HOUR -lt 19 && $HOUR -gt 2 ]];
              then
                chvt 2
   		/usr/bin/go
         fi
elif [ "`/usr/bin/tty`" = '/dev/tty3' ];
    then
         if [[ $HOUR -gt 18 || $HOUR -lt 3 ]];
             then
    	         chvt 3
    	         /usr/bin/mplayer -fs -vo fbdev -loop 0 /root/slides.avi
         fi
fi
/usr/bin/playradio1

Code:
mplayer -playlist http://music.someradioserver.com/Show.asx?StreamID=10
Posted in Uncategorized
Views 2266 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    ZOMG this is really funny!
    Posted 12-18-2010 at 08:07 PM by Web31337 Web31337 is offline
 

  



All times are GMT -5. The time now is 05:19 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration