Custom Search

Saturday, May 16, 2009

Youtube Without Flash


Check it out:

HQTube for Greasemonkey

Youtube live streaming without flash, gnash, etc. Yes, it works,
at least so far in Seamonkey for me. Haven't tried it yet with
Firefox but, going from past experience, Firefox is easier to
work with than Seamonkey and better supported in regards
to add-on's, but I choose Seamonkey because it's just faster.
At least it always has been for me.

Audio is working great, no stuttering or distortion, and video
streaming over my broadband connection is good, no jerkiness
or distortion there either.

Before doing anything else, if you don't have them installed
already, install the mplayer and mplayerplug-in packages.

Whether you're using Firefox or Seamonkey, you'll need to
install Greasemonkey. For Firefox, check out:

Greasespot

If you're using Seamonkey, you'll have to install xsidebar.
You can get it at:

xSidebar :: Seamonkey Add-ons

Then you can get the Seamonkey modified Greasemonkey
version at:

mozdev.org - xsidebar: modifiedmisc: Greasemonkey

Here's what's in my ~/.mplayer/mplayerplug-in.conf:

vo=gl
cachesize=512
cache-percent=5
profile=plugin

Here's what's in my ~/.mplayer/config:

[plugin]
autosync=0
mc=0
correct-pts=yes

Those are straight out of the installation instructions for the
HQTube for Greasemonkey script. So far I haven't had
to change that or add anything else.

Caveat:
Right now the script only works with Youtube.

Labels: , , , , ,

Friday, November 14, 2008

Customizing Seamonkey's Toolbar

How to Customize the SeaMonkey Toolbar | eHow.com

I thought this had some pretty good tips in it
for Seamonkey, which is my favorite browser.
Much faster than Firefox, at least in my browsing
experiences.

Wednesday, July 09, 2008

SSH & Samba Write-up

I solved a windows network connectivity problem I was
having when I was using a socks 5 proxy through an ssh
tunnel to my OpenBSD box for safer browsing. I'd leave
the windows box running but not use it, sometimes for
hours, and more often than not, overnight. When I'd try
to get anywhere with the browser I no could. I still had
connectivity with the OpenBSD box, but that was it. I put
in a batch file that cleans up the local area connection
on the windows box and run it from windows scheduler
every 6 hours and it solved the problem. The addendum,
batch file, and link to the network article that helped me
are at the bottom of my original write-up at:

SSH & Samba

Labels: , , , , , ,

Friday, July 04, 2008

Fluxbox Article

I've got a new write up on switching desktop wallpaper in
fluxbox automatically on a scheduled basis by using a script
and a cronjob to call it. I also made some additions to my
.kshrc file exporting some values into the environment for
when I login to the system that can be tested against and
also tell fluxbox which one of my wallpaper files to load
when it's starting.

Fluxbox Desktop

Labels: , , , , , , , ,

Saturday, May 31, 2008

Recent Web Site Updates

I finally got a couple of pages up I'd been wanting to
despite a bunch of interruptions. One is on installing
and configuring Conky to display system info on your
desktop. It also shows how to pull in other information
like weather reports and some system info that I couldn't
get with Conky's regular functions, due to either my own
misunderstanding of the instructions, or else something in
my chipset that's incompatible with the program. Probably
some of both.

ADDENDUM: 2008-06-06
Pertaining to Conky above, I've added some info to the page
that shows how I'm now getting stock market data to display.

ADDENDUM: 2008-06-13
Again, pertaining to Conky above, added some info on how I
kludged together a script to filter out my daily Accuweather
forecast email message, format it and scp it from that box to
the box I'm using conky on to be displayed below the current
conditions feed I get from NOAA's weather site.

The other write up is on creating a file to be used as a
persistent table for OpenBSD's PF packet filter firewall,
how to automatically concatenate IP addresses of would
be intruders to the file using scripts that run on a schedule
from a cronjob, and then flush the one table that does the
collecting and reload the persistent file back into its own
table. This makes it truly persistent, since rebooting has no
effect. You don't have to start back all over again with loads
of intrusion attempts in your logs.The pages are at:

Conky
PF with a Cumlative Table

ADDENDUM: 2008-07-04
Again I've added some more to the conky article above.
This addition describes how I run 2 instances of conky
and change one of them depending on the time of day and
the day of the week, since one configuration uses stock
market data and weather, while the other for the times
when the market is closed just displays the weather.
The change is accomplished using 2 short shell scripts
and 2 cronjobs. The last part of the entry shows how I
clean stale values from the environment in case I close
X but don't log out of the system, and then restart X.
From the value that gets exported from .xinitrc conky
determines which configuration file to use by comparing
that value with a small text file containing appropriate
times to load the file with stock market data. If it's
after hours or on the weekend when X restarts, it loads
just the weather version of conky on the one side of the
screen. The other conky running on the right side of the
screen doesn't change. It always shows system information.

Labels: , , , , , ,

Tuesday, May 06, 2008

4.3 Upgrade & New Pages on Web Site

4.3 OpenBSD is out and I've got one box upgraded so far. Had a
couple of problems which you can read about at:

Denny’s OpenBSD Newbies blog

Should be clear to see they were my fault. :-)

I also put up a couple of new pages under the tips & tricks section.
One on using colors in xterm and one on quick remote printing over ssh.

Xterm and Color

Quick Printing Over SSH

Labels: , , , , , , ,

Wednesday, April 16, 2008

New Page on Web Site

Added a new page on my web site pertaining to using external
mailto links in Firefox with older text email programs like
mutt and pine. You can read it at:

Firefox and External Mailto Links

Only a couple of weeks until OpenBSD 4.3 is released! Yay! Time to do the upgrade dance. Only thing I hate doing is messing with
nut on my one box. Took me a long time to figure it out. Even
after I thought I had it right, turned out I didn't and I had to do
some more reading and work on it. I've put off upgrading from
4.1 to 4.2, partly because of the libexpat issue, but mostly from
laziness and taking advantage of of the OpenBSD development
team's kindness in providing security patches back 2 release
versions. I'd say that last reason probably makes up 90% of my
reason for being an upgrade laggard. :-)

I've had good success in getting pf and ssh working well with
my windows box and also with pure-ftpd. I especially love
the bruteforce rule capabilities!

That's it for now. Stay safe, stay secure. Use OpenBSD. That'll
take care of most of your security right there!

Labels: , , , ,

Monday, March 24, 2008

Three New Pages on Web Site

Saturday, February 23, 2008

Web Site Update

Finally made good my threat and added a new page on using
SSH, Samba, and Cygwin on Windows to forward ports for secure
browsing, file management, and so forth, from Windows boxen
to OpenBSD boxen. Includes a howto on generating passwordless
SSH RSA keys which is what I believe is safer than typing in
cleartext passwords. Page is at:

SSH & Samba

I also added a link to a site where you can pick up binary updates
for OpenBSD. When I checked it there were currently 3 available,
4.0, 4.1 and 4.2. Here's the link again:

Binary Updates for OpenBSD

powered by performancing firefox

Labels: , , , , , ,

Wednesday, February 06, 2008

My Web Site Server Error Messages

I ran into the familiar "Forbidden You don't have permission thing"
myself the other day when I was testing links for typos. All I can
say is, there must've been a server problem at the time. As soon
as I got the message about it happening to someone else, I tested
the links again from this blog and they're all working. So that's
why I say it must've been a server problem. If anyone experiences
this again, please leave me a comment. I certainly want it to be
accessible to to all visitors.

powered by performancing firefox

Labels:

Monday, February 04, 2008

Updates

I updated my blog entry of Saturday, September 01, 2007 titled
"More Multimedia" pertaining to some things I found recently
to help when you get errors using mplex to recombine *.m2v and
and *ac3 files together again for final mpeg output. Includes a link
to the article at:

http://polarwave.openbsd101.com/dvd.html

powered by performancing firefox

Labels:

Thursday, January 24, 2008

Web Site Updates

I've put up some new stuff on the web site.

  • New feeds at Feeds Page
  • New entry on Blog about Samba and Firefox over SSH.

powered by performancing firefox

Labels: , , , ,

Monday, January 07, 2008

Recent Web Site Update

I was reading an article by Dru Lavigne at:

Hack #51. Get the Most Out of FTP

I used the info on .netrc along with a script I put together to
login anonymously automatically, get a directory listing of the
packages and diff it against a earlier existing directory listing
in my home directory to see if any packages had been updated.
It was fun as I went along, learing more about scripting and
command line ftp.
More Packages

powered by performancing firefox

Labels: , , , ,

Wednesday, January 02, 2008

New Updates on Web Site

Added some pages to the new web site. There's help there on
vim, mutt, getting help on OpenBSD mailing lists, NTPD, dump
and restore, working with packages, and a page on scripting
help and .profile aliases to keep from opening the same program
twice.
Polarwave's Tips & Tricks

powered by performancing firefox

Labels: , , , , , , , ,

Wednesday, December 19, 2007

New Subdomain

Well, it's not my own domain, but a subdomain serves the purpose
and was a very nice gesture of the owner of the domain. I've begun
putting up tips and tricks for newbies there for OpenBSD. Going to
be some work and will take time, but time I got. Now money, that's
another story. :-) Site is at:
http://polarwave.openbsd101.com

powered by performancing firefox

Labels:

Monday, September 17, 2007

Maintenance Scripts

These probably aren't the most professional system maintenance
scripts ever written, but they get the job done. The first one,
logroll.sh, does just what it says. It rolls over my procmail
and getmail logs, saving them with the date appended and starts
a new log like so:

#!/bin/sh
#
# Script to rotate ~/.procmail/.procmail-log and
# ~/.getmail/log every week so they don't start to
# take on huge proportions.
#
cp ~/.procmail/.procmail-log \
~/.procmail/`date +"%Y%m%d"`.procmail-log.txt
#
echo > ~/.procmail/.procmail-log
#
cp ~/.getmail/log ~/.getmail/`date +"%Y%m%d"`.log.txt
echo > ~/.getmail/log

There's a harder way which I tried first, not thinking, where
the log is copied with the date appended, then delete the log,
then recreate with touch, then chmod to 0600. Lot of work and
unnecessary. All you have to do is copy it with the date and
then echo nothing into it like 'echo >'. Still the same file
as before, just nothing in it, starting over fresh.

The next one is for root, to backup changes in /etc and /var/db
without having to do a dump, just using rsync:

#!/bin/sh
#
# Weelky rsync changes in /etc/ & /var/db to /data2/backups
#
/usr/local/bin/rsync -arvvgt /etc/ /data2/backups/etc && \
/usr/local/bin/rsync -arvvgt /var/db/ /data2/backups/db/

The double 'vv' is for very verbose to give lots of info.

The last script's comments make it pretty self explanatory.
Just a way to keep track of what you've installed lately.

#!/bin/sh
#
# Script lists /var/db/pkg & outputs it to a file with
# the date appended. Then it diffs it against the previous
# list from the week before & outputs the differences to a
# separate file with the date appended. Then it takes the
# most recent list wth date appended & copies/overwrites
# the previous weeks listing to be current.
#
cd /data2/backups
ls -al /var/db/pkg > `date +"%Y%m%d"`pkgs.txt
diff pkgs.inst.list.txt `date +"%Y%m%d"`pkgs.txt > \
`date +"%Y%m%d"`chgs.txt

mv pkgs.inst.list.txt `date +"%Y%m%d"`previous.week.pkgs.txt
cp `date +"%Y%m%d"`pkgs.txt pkgs.inst.list.txt

powered by performancing firefox

Labels:

Sunday, September 16, 2007

CUPS Printing Problems

Been a rough week and a half. For a long time now I just
used OpenBSD to print mostly plaintext documentation to
a windows shared printer. Now I'd like to be able to print
other stuff too. Graphics, web pages, etc. I installed cups,
samba, and pnm2ppa which built okay on my system but it's
not included in the ports and packages. I downloaded it
from http://www.superbhosting.net/sourceforge.php and built
it on my OpenBSD 4.1 box. I already had foomatic-rip and
foomatic-gwrapper in /usr/local/bin so I renamed them to
stop any confusion, since cups installs foomatic-rip when
you install it cups. I finally figured out how to print to
my windows shared printer with it, but that was just the
tip of the iceberg. I couldn't stop the shearing problem
no matter what I tried when I'd try to print a web page.
And, it was running off the bottom of the page despite the
fact I had it set for letter, not a4 mode. I finally went
into firefox's page setup, unchecked the box that says to
fit to page, and manually set it to 75 percent, and told
it to print images and colors. Also, when you configure
cups from the browser interface at localhost:631 under the
printer options section, I told it to use the ordered mode
under the dithering algorithm instead of Floyd Steinberg
which promises higher quality, and set the bidirectional
printing to on for faster speed, although it says without
it you'll get better quality. Now I'm still getting some
shearing on some letters, but not too much. When I print
just a text web page like at the rfc web site, it comes
out pretty good. I'll have to learn how to do more stuff
with it from the command line. Maybe I can tweak it some
more. I downloaded a new HP-DeskJet_722C-pnm2ppa.ppd for
pnm2ppa to use for my 722C printer. The cupsd daemon man
page says the default is to run in the background as a
daemon, so all I added this to /etc/rc.local:

if [ -x /usr/local/sbin/cupsd ]; then
/usr/local/sbin/cupsd
fi

And, to run samba as a daemon, I added:

if [ -x /usr/local/libexec/smbd ]; then
/usr/local/libexec/smbd -D
fi

if [ -x /usr/local/libexec/nmbd ]; then
/usr/local/libexec/nmbd -D
fi

That did the trick. They start up fine on boot. Anyone
reading this who has some experience with the shearing
problem with cups, foomatic-rip, and pnm2ppa, please
share it if you have time. That's it for today.

powered by performancing firefox

Labels:

Saturday, September 01, 2007

More Multimedia

DVD Ripping and Burning Tips

I usually use 1 of 2 methods for finding out
what's on a dvd. First, I run

lsdvd

to see how many titles and chapters are on the dvd,
and I look for the main title. More often than not,
it's the first one, but not always. Good example was
one I ran across that had five 24 minute episodes and
then one large file with all 5 in it. When I played
the dvd with mplayer, I saw on the menu you could
choose each individual episode, or you could choose
the menu listing 'play all'. The combined file was
too large for a single-layer dvd, but I could rip each
individual episode and put 3 on one dvd and the other
2 on a 2nd dvd. Here's how I did it, starting with
episode 1:

mplayer dvd://1 -dumpaudio -dumpfile episode1.ac3
mplayer dvd://1 -dumpvideo -dumpfile episode1.m2v
mplex -f 8 -o episode1.vob episode1.ac3 episode1.m2v

So, in the above scenario, title one was just one episode,
not the main movie file with all the episodes in it.

The other program I use to check the dvd is streamanalyze,
part of the streamdvd package, which includes lsdvd, at
least in the OpenBSD version of it. Do this:

streamanalyze -i /dev/rcd0c -t 1
(assuming title 1 is the main title)

That'll show you what's in title 1. File formats look like:

Videostream id's always start with '0xen' where n is the
track number. In most cases a video dvd contains only one
video stream '0xe0' but multiangle videos might contain
more video streams.

Audiostream id's always start with '0x8n' where n is the
track number. Most video dvd's contain multiple audiostreams
in different languages, director comments, etc. There's a
special case for mpeg audiostreams that are pretty rare for
find. If you have a dvd containing mpeg audiostreams and want
to select one of them, use '0xcn' as an identifier where n is
the tracknumber (also special, counting starts from 1).

Subpicturestream id's always start with '0x2n' where n is
the track number. Most video DVDs contain multiple subpicture
streams in different languages.

The above info on streamanalyze and streamdvd can be found
in readme files installed with the programs. On my OpenBSD
box, the readme are in:

/usr/local/share/doc/streamdvd/README.streamanalyze
/usr/local/share/doc/streamdvd/README.streamdvd

* NOTE *
You can use streamdvd to rip and shrink a dvd movie, but be
forewarned, YMMV! I did okay with it on smaller movies, and
even on shrinking some larger ones, but when it came to
extracting particular streams rather than just everything, the
program choked up on me more often than not. It may have
something to do with the way it interfaces with dvdauthor:

dvdauthor -t -o /path/to/save -f 'streamdvd -i /dev/rcd0c \
nbsp&;nbsp&;nbsp&;nbsp&;-t 1-s 0xe0,0x80,0x20 -c 1-9 |'

That's a good example. It's trying to get title 1, the main
video, the first audio, and the first subtitle, chapters 1
through 9. That's what the docs say. But, it always seems to
run into problems. That's why I turned to mplayer in the first
place.

Before leaving this section, tcprobe deserves mention. It's
part of transcode but can be used independently for medium
and print information. The command

tcprobe -i foo.avi
will print interesting information about the avi file itself
and its video audio content. It has some interesting switches
you can tack ontothe command. As always in the 'nix' world, try

man 1 tcprobe. Yep, READ THE FINE MANUAL! ;)

Before doing any ripping, if you see the main title is really a
whopper, like 8GB or so, you can rip the movie in 2 parts with
mplayer. Let's say

lsdvd reports there are 24 chapters in the main title. To split
the dvd:

mplayer dvd://1 -chapter 1-12 -dumpstream -dumpfile movie1st.vob
mplayer dvd://1 -chapter 13-24 -dumpstream -dumpfile movie2nd.vob
But, if you see your movie will fit on a single-layer dvd, or
that it looks close anyway, just do this:

mplayer dvd://# -dumpstream -dumpfile movie.vob

To play the movie with english subtitles, do this:

mplayer -sid 0 movie.vob

If your movie won't fit on a single-layer dvd, but it doesn't
look too awfully big, after you've ripped it, do the following:

Extract audio:
tcextract -i movie.vob -t vob -x ac3 -a 0 > audio.ac3

Extract video:
tcextract -i movie.vob -t vob -x mpeg2 > movie.m2v

If you need subtitles use spububmux from dvdauthor and ifo_dump
from libdvdread-utils. Check for color palette:

ifo_dump /dev/rcd0c 1 |grep Color |sed 's/Color ..: \
00//' > palette.yuv

Generate picture PNG in format 4.12
spuunmux -s 1 -p palette.yuv movie.vob
This command generates PNG files and command file sub.xml
Calculate the exact shrinkage factor with this formula:
requant_factor = (video_size / (4700000000 - audio_size)) * 1.04
* NOTE: This worked perfectly for me first time out. YMMV *

Now use the factor derived from the formula above to
shrink the video:

tcrequant -i movie.m2v -o new.m2v -f (shrinkage factor)

*NOTE*
From everything I've read on shrinking, you shouldn't
go larger than a 1.5 factor. It degrades the quality too
much. If after running the formula above you find the
factor exceeds 1.5, you should probably split the movie.

Now recombine new.m2v with the audio file audio.ac3:
mplex -f 8 -o new.mpg new.m2v audio.ac3

*UPDATE*
There's a newer version of this article up on my web site
with additional information about how to handle mplex errors.
I think it comes about because of the newer copy protection.
I know when I first added this article to my blog, I wasn't
having those sort of problems with mplex. I could be wrong,
though. Feel free to leave a comment. When you get to the page,
search for "Nasty DVD's". Article is here:

DVD's - Analyze Rip Burn

At this point, you can insert subtitles.
spumux sub.xml < new.mpg > new.vob

Now that you've got your movie ripped and/or shrunk, you
setup the dvd file structure with dvdauthor. First, create
dvd.xml and name it whatever you want. Just be sure to have
an .xml extension

<dvdauthor>
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="new.vob" />
</pgc>
</titles>
</titleset>
</dvdauthor>

Pass the xml file to dvdauthor for authoring:
dvdauthor -o /path/you/saved/to -x dvd.xml


Dvdauthor creates 2 subdirectories below where you're at,
AUDIO_TS & VIDEO_TS. Let's say you're in /data/dvdfiles.

* NOTE *
I don't know if I can stress the value of dvd rewritables
enough! Catch some on sale and get them. They'll save you
coasters and frisbees, for sure. I got some half-priced
recently by watching the Sunday ads. Of course, you can
take your changes on eBay. I haven't run into hardly any
problems in three years. 'X' Those are crossed fingers. ;)
Anyway, here's some info on rewritables:

To blank a dvd-rw that already has been written to, and
really wipe everything off of it, do:

dvd+rw-format -blank=full /dev/rcd0c

That does a full blanking. This will take about one hour
on 1x media. A fast blanking can be done by:

dvd+rw-format -blank /dev/rcd0c

On to the burning.

To create an image to burn, do this:

mkisofs -dvd-video -udf -o new.iso /data/dvdfiles/

To burn the image, do this:

growisofs -Z /dev/rcd0c=new.iso

To skip the last 2 steps & burn directly to dvd, do this:

growisofs -dvd-compat -dvd-video -udf -Z /dev/rcd0c \
/data/dvdfiles
(Assuming /dev/rcd0c is your burning device and
/data/dvdfiles is theoutput directory of dvdauthor)

or, for the directory containing AUDIO_TS and VIDEO_TS:

growisofs -dvd-compat -Z /dev/rcd0c -dvd-video .

(and don't forget the . on the end)

* NOTE on burning devices *
On other 'nix' type systems, your burning device might be and
probably is something other than /dev/rcd0c but I'm writing as
an OpenBSD user, and that's what my device is.

gopher://sdf.lonestar.org/00/users/dancer68/multimedia/
dvdripping.txt.txt
(the double extension's NOT a typo)

As a side note, here's an alternative to streaming with vlc using
nc or netcat:

On your streaming client, type this first:

$ nc -l 1234 | mplayer -cache 8192 -

Then walk to your streaming server and push the file
down the network's throat.

Filename is just an example.

$ cat Aerosmith-Amazing.mpg | nc 192.168.1.5 1234

If the streaming client IP is 192.168.1.5...

That is all. It works. Really cool. :)

If you're on the client end, you could still use vlc to do
the same thing I just outlined with vlc to save the stream.

Some links that helped me:

http://www.brandonhutchinson.com/Burning_Video_DVDs_
in_Linux.html

http://www.ericdugas.com/howtos/ripDVDWithMplayer/
ripDVDWithMplayer.php

http://www.dizwell.com/prod/node/47

http://forum.freespire.org/archive/index.php/t-2978.html

http://www.linuxquestions.org/linux/answers/Applications_GUI_
Multimedia/DVD9_to_DVD5_guide

http://wiki.videolan.org/index.php/VLC_command-line_help

http://digg.com/software/How_to_Rip_DVDs_with_VLC

powered by performancing firefox

Labels:

Sunday, August 19, 2007

Drive Free Space Script

I originally got this script from:

http://64.233.169.104/search?q=cache:aIS0abHfbL4J:
techrepublic.com.com/i/tr/downloads/home/
milton_ingram_scripts.pdf+milton_ingram_scripts
&hl=en&ct=clnk&cd=1&gl=us&lr=lang_en&client=firefox-a

That's in html for convenience. There's also a pdf file:

http://techrepublic.com.com/i/tr/downloads/
home/milton_ingram_scripts.pdf

I changed it around a little. My way reads in gigabytes and I
dressed up the right side under 'Mounted on' to align left to
make it neater and look like the regular output of df.
You'll have to play around with the heading spacing on
Filesystem, Total, Used, and so forth. I'm no good at
html and besides, the formatting of this template on
my blog wouldn't allow the lines to appear as they do
in the script anyway. For instance, the ==== lines have
29 cut off the end to make it fit here. Any questions, I
can always send the script to anyone interested. I just
liked it since it helps me keep track of how much free
space I have.

#!/bin/ksh
# Generate a readable disk free listing
# MWI 0310
#
echo "======================================= "
echo "File System Report in GB :" `date`
echo "======================================= "
echo "Filesystem Total Used Avail Capacity Mounted on "
echo "======================================= "
df -k | sort -k6 |awk '$1!="swap" && $1!="Filesystem" \
{tt+=$2;tu+=$3;tr+=$4;printf "%-9s %10.2f %10.2f %10.2f %9s \
%-13s\n", $1, $2/1048576, $3/1048576, $4/1048576, $5, $6} \
END{printf "\nTotal GB %10.2f %10.2f %10.2f\n", tt/1048576, \
tu/1048576, tr/1048576 }'
echo "======================================= "

powered by performancing firefox

Labels:

Friday, August 17, 2007

Multimedia on OpenBSD

Been a while since a posting. Been trying to learn how to
rip and burn dvds. When the content is equal or smaller
than single-layer size, 4.7GB, it's been a breeze, using
dvdbackup. But, a marjority of dvd content is larger than
that. In that case, I've mostly used streamanalyze, lsdvd
and tcprobe to look into the dvd structure; streamdvd and
dvdauthor to rip and then restructure the content to be
burned. For burning, I've been using growisofs. There have
been instances where nothing worked for me. I could rip the
dvd but not just the one title with just its chapters and
audio, so I never even got to the point where I could shrink
it to fit on a single-layer. Streamdvd choked on the dvd's
structure, sometimes dumping its core.

I've had good luck with radio programs. I love to listen
to several that come on late at night, but if I have to get
up early, that's out. So, I have a small program I call from
a cronjob in a script with the url of the program. It takes
an integer after it for the number of minutes it should run
mplayer, streaming in the audio and dumping it to mp3. Here's
the code for it. Just compile it with gcc. Name the outfile
whatever you want.

------------------

#include
#include
#include
#include
#include
#include

extern char *__progname;

/* This program self destructs after a specified time */
int main(int argc, char **argv) {

int ret;
long minutes;
struct timeval t, t2;
pid_t child;
if (argc < 3) {
printf("Usage: %s \n",
__progname);
exit(128);
/* NOT REACHED */
}


if ( (child = fork()) != 0) {
/* I am the parent process */
minutes = strtol(argv[1], NULL, 10);
sleep(60 * minutes);


/* I am done! */
kill(child, SIGINT);
exit(0);

} else {
/* I am the child */
execv("/usr/local/bin/mplayer", argv + 1);

exit(0);
}
}

------------------

Here's an example script to call from a cron job
to record your radio program, assuming you named
the compiled output of the above code to streamdump.
And, make sure it's in your path, like mine is ~/
or somewhere like /usr/local/bin.

------------------

#!/bin/sh
#
# script called from a cronjob to save an audiocast
~/streamdump 120 -dumpstream mms://adressofstream \
-dumpfile /data/xxx/mp3/show/`date +"%Y%m%d"`xxx.mp3
#

Streamdump runs mplayer 120 minutes, dumps the stream
into the dumpfile switch which saves the output to a
directory in mp3 format. the `date +"%Y%m%d"` adds the
date on the frontend of xxx.mp3 to make your shows
easier to keep track of. In the url, it may be something
other than mms like http or whatever. You'll have to find
that out from where you're streaming from.

------------------

That's it from the coast for right now. Have to get
started trying a different print setup on my bsd boxes.
I've always been lazy before, being setup to just print
text via a network shared printer on my windows box.
Anything graphic I did directly from the windows box.
I have a Deskjet 722C printer. It was part of a short-
lived series of printers HP put out. The only driver
I've ever had that works with it has been:

HP-DeskJet_722C-pnm2ppa.ppd

Got that from linuxprinting.org a long while back.
Here's what my /etc/printcap has looked like up until
now:

# $OpenBSD: printcap,v 1.4 2003/03/28 21:32:30 jmc Exp $
lp|windows line printer:\
:rp=HPDeskJet:\
:rm=dancer:\
:af=/etc/foomatic/HP-DeskJet_722C-pnm2ppa.ppd:\
:if=/usr/local/bin/foomatic-rip:\
:sd=/var/spool/output:\
:mx#0:\
:sh

But, I can't print from firefox or the gimp like this.
So, I'm going to try installing apsfilter and see how
it goes. I once read an old nix hand's opinion of bsd
printing, describing it as a convoluted zen-like
experience. ;) That's pretty much been my experience!

powered by performancing firefox

Labels:

Friday, July 13, 2007

The Joys of Procmail

Procmail, possibly from the root word proctology. ;) Had one heck of a time setting it up with mutt and getmail but it's a done deal, up and running finally. I'm putting in the configuration below. Possibly someone having the problems I did will be googling and find it. We can only hope. I want to stress the importance, too, of the order in which the below values are placed. Pay attention to that when you're creating your own configuration. And do not put anything in you don't need. Also, VERBOSE=off stopped a good amount of the problems I was having when I'd run getmail and it'd call procmail. Procmail choked on the output. Once verbose was turned off, things got immediately better.

VERBOSE=off
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/.procmail-log
MAILDIR=$HOME/Mail
DEFAULT=$MAILDIR/inbox
LOCKFILE=$HOME/.lockmail
COMSAT=no
PER=(mypersonal@gmail\.com|mypersonal@linux\.org)
FBSDQUESTIONS=(owner-freebsd-questions@freebsd\.org)
FBSDSTABLE=(owner-freebsd-stable@freebsd\.org)
FBSDCVSALL=(owner-cvs-all@freebsd\.org)
OBSDALL=(owner-misc@openbsd\.org)
OBSDSEC=(owner-security-annouce@openbsd\.org)

:0
*$ ^From:.*$PER
per/

:0
*$ ^From:.*$FBSDQUESTIONS
fbsd/

:0
*$ ^From:.*$FBSDSTABLE
fbsd/

:0
*$ ^From:.*$FBSDCVSALL
fbsd/

:0
*$ ^From:.*$OBSDALL
obsd/

:0
*$ ^From:.*$OBSDSEC
obsdsec/

I have lots of individual entries below the section listed, but for brevity's sake, that's all I'm putting in for now. You'll have to read the "fine" manual to see other ways to filter. There are lots and it can get really complicated. Here's how I have getmail setup:

[options]
verbose = 0
read_all = false
delete = true
message_log = ~/.getmail/log

[retriever]
type = SimplePOP3Retriever
server = myispmailserver
username = myusername
password = mypassword

[destination]
#type = Maildir
#path = /home/dennyboy/Mail/
type = MDA_external
path = /usr/local/bin/procmail
unixfrom = true

Setting up .muttrc is a real joy too. ;) I'll have to recount that some other time. It goes without saying there's a lot of reading. It pays to to read the instructions. People in the mailing lists are notoriously recalcitrant about helping you if they think you haven't really tried on your own, especially when it comes to reading the man pages and installed docs. Rightfully so, too. I worked on this mess, on and off, for over a week. I finally did ask on the openbsd misc mailing list, but just like when you were back in grade school doing your math for the teacher, you need to "show your work". I got a really good answer and after a little editing with vim, I finally had everything working in a short time.

powered by performancing firefox

Labels: , , ,

Friday, June 15, 2007

OpenBSD 4.1 Install

Finally some time to do it! I recently acquired an old Dell 2.2 Celeron. At the time I got it, it had Windows XP on it, along with AOL and only 384M of ram. And, it hadn't been defragged in who knows how long. Slower than molasses! I yanked the hard drive, used a special usb to ata adapter line to back everything up to dvd for the people who gave me the box, put the hard drive back along with a new 160G second hard drive, added a Diamond Stealth 256M video card with an extra pci mounted fan to keep it cool, and fianlly added memory for a total of 1.5G. Tried running Fedora 6 on it for a while and it was real nice, but I just couldn't stay away from OpenBSD. Got my new cd's, installed 4.1, configured X, actually built java 1.5 without mishap, and added most of my favorite programs. Still have to finish setting mutt and getmail up. I promised a friend I would try to wean myself off old reliable pine and fetchmail. Also trying to get started on C programming since that's the backbone of bsd. Also applied all the latest patches. I still have to hook my old Epson scanner up and install the sane-backends and frontends along with the gimp and xsane. Hopefully that'll go off without a hitch like the rest has. Nice to be able to rebuild my kernel in about 15 minutes as opposed to before on my old PIII 800 where it takes about about 35 to 40 minutes. I shared a lot of good articles off my Google Reader, so check them out.

powered by performancing firefox

Friday, June 01, 2007

Mount Partitions to Restore Backups

I've been asking myself what do I do if a partition gets corrupted? Yeah, I do dumps regularly to another disk, but when you boot from an OpenBSD install cd there's no matching /dev/wd1d there. There are no devices with wd1, only wd0. There's MAKEDEV but it says that the operation isn't permitted when I type ./MAKEDEV wd1d. What's going on here? I don't have to worry about being root, this is an installation cd. Actually I've shelled out of the install routine. Let's do ls -l and see what we get. I'll be darned, MAKEDEV is not executable. chmod +x MAKEDEV and that solves that problem.

Once again, I type ./MAKEDEV wd1d and hit enter. This time there's no error message. Another quick ls -l shows all kinds of wd1 listings now including wd1d. Now I mount -r /dev/wd1d /mnt and no error message. Let's see what mount shows. Cool, wd1d is mounted. I do a ls -l on it and sure enough, there's my /data partition on the hard drive where all the dumps are stored.

Now if a partition gets corrupted, all I have to do is boot up on the cd, make the device, run newfs on the corrupted partition, mount the partition with the backups on it as shown above, mount the newly formatted partition in write mode, change directory into it and restore the appropriate dump. Life is good!

Someone may say you don't need the cd to boot from, you just boot the bsd.rd kernel, and that's okay, that is if your / partition isn't the corrupted one. Also, remember, restore is in /sbin. I don't think there's anything wrong with using the cd to work from. That is, unless you didn't install off a cd and don't have one. I think it's a good idea to keep one one hand.

This is probably kindergarden stuff for most of the guys on the OpenBSD mailing list, but for me it's like when the apple hit old Isaac on the head! It's a revelation! ;) I'm putting this up here in hopes someday some poor newbie having the same problem googles around and finds it. That'd be cool.

Everytime I do a fresh install of OpenBSD, I create a wd1a partition on a 2nd hard drive the same size as my root partition on the primary hard drive and label it altroot. In root's crontab, right below my env settings SHELL, PATH, and HOME, I enter ROOTBACKUP=1. That way, every day the system will backup /root to /altroot. Alternately, you can edit /etc/daily.local and enter the same ROOTBACKUP=1 line.

In either case, you also have to remember to enter the partition info in /etc/fstab. The format is a little different too, than the format the others partitions use: /dev/wd1a /altroot ffs xx 0 0

powered by performancing firefox

Friday, March 23, 2007

All Hail the Supreme Nerd God!

Yes, that's me! ;) By some fluke of fate, I scored even higher than my most revered BSD Guru, Dru Lavigne! Blind, outhouse luck is what I say! ;) Here's my reward:

I am nerdier than 96% of all people. Are you nerdier? Click here to find out!

More will follow. Long time since the my last entry, the interim being fraught with computer rescues for others, system rebuilds for myself, experimentation with Fedora Linux, a new (newer than any of my old boxes) computer given to me for testing new stuff, hardware crashes, and so on. Been an interesting time for sure!

powered by performancing firefox

Saturday, February 03, 2007

YouTube - Installing OpenBSD in 5 minutes

I thought this was a fitting link for my blog. Pretty
cool video!

YouTube - Installing OpenBSD in 5 minutes

powered by performancing firefox

Friday, February 02, 2007

February Update

January was a busy month. I had put off updating OpenBSD too
long and finally got around to it towards the latter part of
of the month. Read the upgrade faq at:

OpenBSD Upgrade Guide

Doesn't help when you don't pay attention to detail, which is
what I was guilty of. I left out a few important steps that you
always have to do. Since I figured I should probably start over
from scratch and had a good backup (what, you don't backup?),
I downloaded a snapshot and installed it. Everything went fine
and about a week later, I tried it again just to see if I was
just plain lucky the first time. Once again, rock solid OpenBSD
came through. Since then, I've gotten into a lot of cd burning
since my significant other got me involved in replicating some
Vietnamese Buddhist cd's to be donated to the temple. I put the
original cd in and ran:

cdparanoia -B

to copy all the tracks into the directory I was in. Then:

sudo cdrecord -v speed=12 driveropts=burnfree /dev/rcd0c -audio -pad *wav

The hard part was using the labeling program on the windows box.
Reason being, I wanted to get the Vietnamese words along with the
diacritics right on the label. I tried several Vietnamese keyboard
programs, and then found out I could insert special symbols right
from the fonts with the labeling program. After that, print the
labels and put them on the cd's. Done! Also did quite a bit of
playing around with ffmpeg and grip. There are still licensing
issues with flash, so I decided to give gnash a try. It does okay
on simple and older flash stuff, but tends to choke and dump core
on other newer and either more complicated or poorly put together
flash files. It's still in development, so that's to be expected.
Been using gvim a lot and loving it. Great editor!
I've recently put up some stuff on my gopherspace; helpfiles, etc.
For those running IE, you have to go through a proxy, and any html
files will have to viewed by choosing view source or saving it to
disk. Hey, if you're diehard windows, you can always install cgywin!

My Gopherspace

For others running Firefox, Seamonkey, Netscape, Lynx, etc., go to:

My Gopherspace

There are lots of other things I've been trying, but as usual, I'm
up burning the midnight oil and have other projects early in the
morning, so that's it for now.

powered by performancing firefox

Thursday, November 30, 2006

Geek Awareness

I've been sitting here after midnight, doing what seems, upon
reflection, geeky things. I've been listening to jazz, reading
some social comment stuff, studying the Lyx introduction
and tutorial since I'm interested in doing some publishing,
running an ssh mission over to an XP box to see if certain
files were installed in Cygwin like what I'm using on this
OpenBSD box, using Snownews to read RSS feeds from
various OpenSource projects around the Web , especially
from Dru Lavigne's Blog , accessing it with Lynx , my
text-based browser, registered at the LXF (Linux Format)
web site and retrieved my new password once again using
SSH to login to my Unix shell account and use Pine to
read my email at SDF , and so on.

I remember back in the early 90's when I was just starting
out with computers and trying to get everything I could free,
since money is always an item to consider when you're still
raising a family. Now, with all the resources listed above,
I'm slowly but surely weaning myself away from Microsoft ,
not because I don't like the system or the people developing
and selling it, but once again due to the expense of keeping
up with it, as opposed to relying almost solely on opensource
to get my computing done. But hey, maybe one of these days
I'll have more money again and invest in a brand new shiny
Vista cd or dvd set! Keyword here is "MAYBE". ;)

powered by performancing firefox

Saturday, November 25, 2006

Keeping Up with Packages

I like to follow the OpenBSD advice that it's better
to install their binary packages, rather than build
programs from ports, unless there's a particular need
not covered by a package. That being said, I wanted
an easy way to keep abreast of package updates and
additions without subscribing to any more mail lists
than I already have, so I kludged up a script to run
from a cronjob every morning. Then I could check it
when I was up and about. Some folks read the paper.
Not me. ;) The script runs something like this:

----------------------------------------------------
#!/bin/sh
# just a script to update my package index file
# without a bunch of typing! ;)
#
wget ftp://ftp.openbsd.org/pub/OpenBSD/3.9/packages/i386/
index.txt && mv index.txt index.`date +"%Y%m%d%H%M%S"`.txt
#
----------------------------------------------------

Wget fetches the file index.txt, and then uses mv with
the date function to create a unique file that can be
diffed against older versions. Simple but effective.
Too bad the funnies don't come with it. ;)

powered by performancing firefox

Friday, November 17, 2006

Cygin Login Errors from OpenBSD Box

Updated Cygwin on my XP box. Thought because it stopped
several times before finishing and having to choose a
different server, that that had something to do with it.
Apparently not. Searched the Cygwin mailing list archives
and found the following:

Fixing /etc/profile

You just copy C:\cygwin\etc\defaults\etc\profile over
C:\cygwin\etc\profile and restart cygwin. After that,
everything goes back to normal. Just another day in puter
paradise. Speaking of which, I'm always bragging about
how I never have to reboot OpenBSD all the time like I
do "Winblows". ;) Sitting here this morning, reading
the news in Firefox on the OpenBSD box, and BOOM, down
she went! I've read all sorts of problems and responses
in the OpenBSD mailing lists with spontaneous reboots,
and nobody wants to think their hardware's crapping out,
but in my experience, that's almost always what's caused
it on any of my boxes. Case in point: Same box, last year
maybe, or earlier this year, everytime I'd drag a large
file across from XP to some dir on the OpenBSD box, it'd
reboot. Upon careful examination of the mobo, turned out
to be some leaking capacitors. Changed out the mobo and,
while I was at it, put in a new power supply too. It sure
didn't last very long. All boxes here are hooked into UPS's,
which is a prerequisite around this area. The power company
is always dropping power off, especially since Katrina came
to see us in 2005. I guess it's a moot point, though. I've
always had good luck with power supplies, but I guess I
just got a bad apple out of the barrel last time.

powered by performancing firefox

Thursday, November 16, 2006

OpenBSD - Create & Burn ISO's

This is a subject that confused me early on, so I thought it might help someone to gather some common facts and links in one spot.

After you've got your sources in place, in my case
/data/user/openbsd4.0/i386
you can create your iso image. Here's what I did:

cd /data/user/openbsd4.0/
mkisofs \
-v \
-r \
-T \
-J \
-V "OpenBSD-4.0-Release" \
-b i386/cdrom40.fs \
-c boot.catalog \
-o /data/user/OpenBSD-4.0-Release.iso \
-A "OpenBSD 4.0 Release" \
.

Don't forget that last dot. It'll befuddle you
and kick your butt if you do!

Now you're ready to burn the iso image to a cd.
I like to use a cd rewritable the first time just
in case I screw things up, so I don't waste a cd.
This is what I did:

sudo cdrecord blank=fast dev=/dev/cd0c:0,0,0
(your hardware configuration may differ)
sudo cdrecord -v dev=/dev/rcd0c /data/user/OpenBSD-4.0-Release.iso

My cd is setup in /etc/fstab. Yours might not be.
Here's how mine is setup:

/dev/cd0a /mntcd1 cd9660 ro,noauto 0 0

I mounted it like so to check if everything got burned right:

sudo mount /mntcd1

Everything checked out, so the cd's ready to boot from
and start the upgrade process. In case you don't have
your cd in /etc/fstab, using my hardware config as an
example, I could mount it like so:

sudo mount -r -t cd9660 /dev/cd0a /mntcd1
or
sudo mount_cd9660 /dev/cd0a /mntcd1

Here are some links you can check out:

How to make a bootable OpenBSD CD
OpenBSD Upgrade Guide
OpenBSD 4.0 Installation Guide

As a last thought, I know there were a lot of sudo's
in my examples. Setting up individually permitted tasks
in /etc/sudoers can be a chore. As an alternative, root
can choose to allow everyone in the wheel group to do just
about anything by changing the following:

# Uncomment to allow people in group wheel to run all commands
# %wheel     ALL=(ALL)     ALL
(Uncomment means to remove the leading #)

And, if root really wants to live dangerously:

# Same thing without a password
# %wheel     ALL=(ALL)     NOPASSWD: ALL

Always check your man pages. Everyone hates to be told
"RTFM you damned lazy troll newbie" or something to that
effect. ;) In the preceding example, you could read up on:
"man sudo" or "man sudoers"
Hope the preceding helps someone out along the way.
Please leave a comment if I've screwed something up here.
I have been known to do that on occasion. ;) And, please
leave a comment if it helped you. It's encouraging, from
time to time. That's it for today.

powered by performancing firefox