Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, June 30, 2008

Netgear Open Source Router

Ooo, I may have to get one of these!

from Lifehacker by Adam Pash

netgears-open-source-router.pngThe Netgear Open Source Router is aimed specifically at running third-party, open-source firmwares like previously mentioned Tomato or DD-WRT. We've covered installing these firmwares on supported routers here and here, but Netgear's Open Source Router is unique in that it's designed specifically to support these open-source projects; Netgear has even created a community web site where enthusiasts can contribute guides and more. The Netgear Open Source Router costs $57 from Amazon.

Sunday, June 22, 2008

Linux xscreensaver

Homepage

Documentation


Install

apt-get install xscreensaver
Now add ”[startup] {xscreensaver}” to your ~/.fluxbox/apps file.

Configuration

xscreensaver-demo

Log file output

Go to the Phosphor saver and enter this:

phosphor -root -delay 10000 -scale 2 -program "tail -n 100 /var/log/mythtv/mythbackend.log"

Linux open files

List open files by process

lsof -p processid

You can track which process is reading/writing the disk by doing:

echo 1 > /proc/sys/vm/block_dump

Then use 'dmesg' to tell you process is using the disk. Turn off tracking again with

echo 0 > /proc/sys/vm/block_dump

Linux sendemail script

Homepage

Install

mkdir /myth/bin
cd /myth/bin
tar -zxvf sendEmail-Vx.xx.tar.gz
ln -s /myth/bin/sendEmail-Vx.xx/sendEmail /usr/local/bin/sendemail
sendemail -f mythtv@mythtv -t toaddress -u "Subject Line" -m "Body of the message" -a FileNameToAttach

From a knoppmyth forum post:

I've got my Myth box setup to send me a daily email listing of each days shows that it has recorded. I'm leveraging 'sendEmail.pl” which is available here http://caspian.dotconf.net/menu/Software/SendEmail/

Here is my shell script that pulls the data from Mysql and pushes the email. It doesn't require a local SMTP server or any other whacky dodads. I just sends the mail to my ISP mailbox. Easy as pie.

#! /bin/bash
echo "" > /usr/src/sendemail/today.txt
mysql -H mythconverg < /usr/src/sendemail/dumptoday.sql >> /usr/src/sendemail/today.txt
echo "

See the full listing of recorded programs" >> /usr/src/sendemail/today.txt
echo "" >> /usr/src/sendemail/today.txt
perl /usr/src/sendemail/sendEmail.pl -f "Our DVR " -t insertTOemailaddresshere -u "Today's Shows" -s insertISPserveraddresshere -xu insertISPauthcredentialshere(opt) -xp insertISPpasswordhere(opt) -o message-file=/usr/src/sendemail/today.txt

The dumptoday.sql looks like this:

select title,starttime,description from recordedprogram where date_sub(curdate(),interval 0 day) <= starttime;

It's a quick and dirty solution so if anyone can improve on it I'd be very happy to reap the benefits.

Linux USB DVD drive

This works for an autodetected external usb dvd player.

Create mount point for the dvd.

mkdir /dvd

Add symbolic link to /dev/sr0

ln -sf /dev/sr0 /dev/dvd

Now mount the dvd.

mount -t iso9660 /dev/dvd /dvd

Edit /etc/fstab to enable automounting.

/dev/sr0 /dvd auto user,noauto 0 0

Linux smbmount

apt-get install smbfs
mkdir /myth
smbmount //mythtv/myth /myth -o username=mythtv,password=mypassword

Linux screen

What is it.

Screen is used to emulate multiple login windows inside of one terminal. It can be usefull when ssh'ing into a machine.

Linux Journal Article.

wiki

Another wiki

delicious links

screen Start screen
screen -R Reattach to a running screen
screen -x Share a running screen

This will start the screen prg and leave you with one “screen”.

Control and the “a” (Ca) key is used to tell screen that the next key is a command key.

Ca c Starts a new screen and switches to it.
Ca space Cycles the screens
Ca ” Shows all of the active screens and allows you to pick one
Ca ? Shows the quick help
Ca t Shows a title bar or status bar view of the processor load
Ca A Change the name of the screen (that is shown when Ca ”)
Ca Cr Toggle word wrap
Ca d Detach from the running screen

Linux mplayer

bash command to generate a valid playlist file

find /myth/music/direcoryname -name "*.mp3" -print > my.playlist

Now add this to your ~/.lircrc file

begin
remote = grayHauppauge
prog = irexec
button = green
repeat = 3
config = killall mplayer; mplayer -shuffle -quiet -playlist /myth/music/favorite.playlist
config = killall mplayer; mplayer -shuffle -quiet -playlist /myth/music/all.playlist
end

Every time the green button is pressed lirc runs the “config”ed command. This ineffect switches the playlists.

The playlist and gallery respond to the same button presses, i.e. next, prev, stop, etc. controlling one but not the other is troublesome. Maybe defining the number keys to do next/prev song would work.

Note that for the irexec to connect to lirc it must be running. The knoppmyth (and maybe other) start script is

/usr/local/bin/launch_irx.sh

* -playlist * -shuffle * -quiet

Forum Post for info on setting the mplayer command line to mplayer -fs -zoom -ao alsa -quiet -vo xv $s

Adding the -ao alsa line significantly boosted the volume.

Linux Mail

Mime headers

Want to send mail using /usr/bin/mail that has html encoding? Then use the -a switch.

sh commandwithoutput | mail -s "Subject here" -a "Content-Type: text/html;" user@yourmail.com

If you want this output from the crontab then you must pipe the output of each command as above.

* * * mythtv sh /myth/bin/emailrecordings | mail -s "Daily myth recordings" -a "Content-Type: text/html;" user@yourmail.com

Linux hdparm

Report of the settings on the drive.

hdparm -i /dev/hda

Set dma on and mode to ultra66 mode.

hdparm -d1 -X66

Time reads and reports on throughput.

hdparm -t /dev/hda

Firefox

about:config

Minimize the cache when minimizing the browser.

config.trim_on_minimize = true

Some good info can be found here if you ignore the kde stuff.

Install was easy.

apt-get update  apt-get install mozilla-firefox

Linux Cron

To nice a cron process

*/5 * * * * /usr/bin/nice -n 19 command

To point its output to /dev/null

*/5 * * * * /usr/bin/nice -n 19 command > /dev/null 2>&1

Linux backups

backup howto

And another

sudo telinit 1

now login as root user

dd if=/dev/hda of=/dev/hdc bs=2M&

Want to see the status of the dd command? Record the PID from the line above and

kill -USR1 PID