Monday, December 27, 2010

Putin Orders Russian Move To GNU/Linux

From Slashdot:

"Vladimir Putin has signed an order calling for Russian federal authorities to move to GNU/Linux, and for the creation of 'a single repository of free software used in the federal bodies of executive power.' There have been a number of Russian projects to roll out free software, notably in the educational sector, but none so far has really taken off. With the backing of Putin, could this be the breakthrough free software has been waiting for?"

Here is another link to the story:

BSD Philosophy

BSD Unix started at Berkeley University shortly after a very turbulent and rebellious time at Berkeley in the late 60's.
During that time there were several major movements happening all at once. The Free Speech, Anti-War, Hippies, Free City, think for yourself, Acid test, civil rights, and a tornado of other forces that lead to several all out riots on campus.
Other influences at Berkeley are a large Asian Population and the study of eastern cultures (Chinese, Japanese and India) and Philosophy.

Many of these memes later incorporated themselves into the BSD Unix culture and Philosophy.

Respect for elders, New isn't always better

Unix and BSD Unix are old operating systems by our modern perception. But, if you were to think this was a bad thing you'd be totally wrong.

At the root of most Modern Operating Systems are design concepts first pioneered in Unix and BSD. Many way DOS, Windows NT,2000,XP, Mac OS X, NeXT OS, operate are based on UNIX concepts.

Change isn't the same as improvement

"The Great Wall of China wasn't built by swapping any bricks in and out" - John Sokol.

"The devil you know is better than the one you don't"

Unix development started more than three decades ago, and the versions of operating system available today is the product of thousands upon thousands of developers hard work and constant improvements. Along the way, Unix has pioneered some very powerful design concepts and some elgant solutions to hard problems common in computing.

"If I had more time, I would have written a shorter letter." - Mark Twain

"I have made this letter longer than usual, because I lack the time to make it short" (Je n'ai fait celle-ci plus longue parceque je n'ai pas eu le loisir de la faire plus courte) - Blaise Pascal, Lettres Provinciales (1656-1657), no. 16.

"Anyone can make something complex, but it takes a genius to make it simple" - Albert Einstein

Elimination of unnecessary complexity is a Key part of the BSD Philosophy

Much of the "Unix way" is based on the idea of abstracting interfaces into the simplest possible terms, BSD trys to take this to it's limits.

Initially, this was simply because the OS was considered experimental, and the simplest possible interface, one that wouldn't change later, .was the most easiest to construct.
This spend time upfront to think of how to "do it the easy way" methodology has evolved into a many of the most powerful design concepts in OS design. Abstraction that started in Unix is the core of many parts of a modern OS. From Files, Devices, Sockets, Modules, Processes, Memory Management, File Systems, directories, and Pipes.

Even the Internet is based on BSD technology and concepts. The BSD 4.2 OS was the first to Implement TCP/IP and part of that was the concept of network Sockets and Ports. Many other more complex network technology had been around for a while, but BSD Sockets allow for two computers to communicate in a way that uses the exact same commands as file access. Open, Read, Write, Close. It also uses another concept, Streams.

Simplicity and elegance though consistent software interfaces


elegant : adj. [common; from mathematical usage] Combining simplicity, power, and a certain ineffable grace of design. Higher praise than `clever', `winning', or even cuspy.

"The challenge is keeping it simple while providing the people with functions. This is harder to do. Anyone can make something complex." Dauphin A German Chair company

Try to understand the intent of the original authors' style and intent, and make changes consistent with this

This means not just going in slashing and hacking changes into the Kernel or User space code without researching and thinking them through first. Find a clean way to do what ever your trying to do. Spaghetti code is not tolerated.

All too often a quick and dirty little hack that was meant to be temporary become permanent and hard to fix later.

KISS, Keep It Simple, Stupid or maybe Keep it Short and Simple, I like the first one.

Working on BSD code is basically working on other people code for the most part. Most likely what ever you do, someone else will have to work on after you.

Working on someone else code is something many application programmers realy suck at. Also they think using the latest cool tricks that just came out in the latest language spec or the new compiler supports it so it's really Cool.
F*ck them! These guys need to be slapped up side the head a few times.
I see time and time again the Linux guys keep making a mess for those who need to update there code and drivers over to the latest OS version. Often is is almost as bad as a cross platform port, nothing works out the box everything is broken and it becomes a major undertaking!

The Mac OS-X darwin they are mixing C++ and Objective C into the kernel source tree! It's full of broken locks and is nearly impossible to understand anymore. Leaving some messy and hard kernel hacking to the customers having to make there code work on a pig of an OS. I hope that doesn't sound like I'm venting too much, does it?

"A program with a colorful GUI is like a woman with too much makeup. Shiny on the outside - awful on the inside."

Quote from the NET

Are you going to run a gui or from the command line etc... over SSH?
If you want a gui I would go Linux maybe Fedora, for SSH use FreeBSD...I used to be against it but I am now a convert to the Church of BSD.

Why would I ever want a GUI? It may sound odd but I have never ran X on any of the 100's of FreeBSD systems I have worked on. Command line Interfaces Rull, and for most of the stuff I do is much faster. Even this web page is edited in "VI".

We are not Linux, We were here before them; and well be here after them

So what's the difference, much of the same code get's passed between BSD and Linux Right? That's only partly true. The Licenses are incompatable between the two for starters.

"I must say the linux community is a lot nicer than the unix
community. a negative comment on unix would warrant death
threats. With linux, it is like stirring up a nest of butterflies."
             -- Ken Thompson author of C Language. 1999 
BSD vs. Linux, Any questions?

FreeBSD, OpenBSD and SuSE 6.2 Eval Review by Keith Rankin:
"The differences between FreeBSD and Linux used to be much more obvious than they are now.
Now it comes down to theology. The BSD world is still the 'high church' or Druid Unix. Blood will be spilled on a stone altar at midnite when star systems are in a certain alignment to learn the ways of this tribe. Linux is a happier world. The spirits of Captain Kirk, Peter Pan and good beer come to mind."

Hackers and the bushido code

For much of the early life of BSD Unix was spent running campus MiniComputers. PDP/11, Vax 11/750 and the like.

One way to attain elite status (enlightenment or become the master or Guru) was to "break root", break in or even just be able to crash the server.

This was not viewed as a federal offense, or even as something inappropriate but as an exciting challenge and testing the limits of the box.

For the many years it was an arms race between the OS developers and students to see if the box could be crashed by malicoius code or commands, the end result is something rock solid.

Now crashing a windows box usualy requires little more then power it up, but most BSD systems can go for years without rebooting, crashing or having it security compromised. Even on my own servers, like the one that ran the site, despite countless attempts to take out the box, it had little effect.

Part of Hacker Philosophy directly stems from these early BSD days, although not all of it. One of the thing was to not damage or sabotage, but to report and inform people of the bug or security hole. Maybe a little Kilroy was here on the administrators console ;)

Reboots, re-compiles and Re/Installations are EVIL and to be avoided at all costs.

One important thing about BSD is the belief that you should be able to stress the system in any number of ways, like open up and infinite number of files, sockets, programs, memory, or any other resource and have the system respond gracefully. But this I mean not to have a Blue Screen of Death, or Kernel Panic.

Linux groups have installfests, while BSD groups have installathons. Clearly an installfests sounds festive and much happier then an installathons that is more like a Marathon to try to race through it.

We are the one true Path, all non-believers (can go to hell) are damned to hell

This is in the tradition of all great religions.

From: Nick Moffitt , With some paraphrasing.

Tue, 22 Aug 2000 14:02:47
Basically, user groups nowadays are either:

 Lame talking-heads lecture series.

 Cowtow to the windows users installathons.

  I say that's bullsh*t, and we all know it. F*CK the newbies.

We'll hold installfests, sure, but we'll be perfectly justified in telling people to take their 386s with 15 year-old RLL drives and GO HOME. This will be a meeting of COOL PEOPLE to show off COOL STUFF!

We'll not be limited to a particular OS, either. We'll have Linux weenies, FreeBSD weenies, and cypherpunk weenies clutching their precious OpenBSD! We'll have the AMAZING GEORGE PERRY and his BEARDFUL OF FORTH!
I think that expresses the attitude fairly well...

BSD License

Do what is right and be hated by those around you. Do what is popular and be hated by history.
The BSD License allows anyone to use the code for any reason and any way with no restrictions other then credit is given to the Authors
Transparency Begets Trust - Expertise in niches, transparency in motives and thought process and owning up to mistakes publicly create a trust relationship" - Will Pate

In General people in the BSD world view people and Individuals who do not share code and improvements as pompous idiots. There are a ton of smart people in the BSD world and no one individual or company (M$) not sharing code is really going to make any difference, the reality is we probably wouldn't want there code anyhow.

Trust builds Confidence

They will loose the benefits of having 1000's of eyes screening the code for holes and bugs as well as tightening things up and making improvements.

This is very much same philosophy as the Private vs. Public research in almost any scientific field. If you keep your research to your self, then you don't get credited for it. Also your work never gets confirmed, there is a good chance of deluding yourself about how secure and bug free your code is. (take Microsoft for an example)

The BSD approach is consider by most people to be better for businesses, companies such as Apple and Microsoft benefited their users by incorporating BSD-licensed code without having to share there code or changes to this code.

When questioned, most GPL programmers did not want the work they released to be used in a manner they did not support.

The BSD philosophy seems to hold that creating and giving away code, then seeing it used by others, is victory and reward enough.

But most of the GPL supporters disapproved of allowing "others" to close off source code and hide enhancements.

Why the Church of BSD

BSD has been through many Holy Wars and has been called a religion by many people for a long time. Even it's experts are called Guru's , High Priests and Wizards. What BSD programmers do has sometimes been called VooDoo, Alchemy and Black Magic. People who violate our way of doing things are declared Heretics, and publicly flamed! We even have our own official canonical way of doing things and this is in the source code.

The Source code is our Bible.

It seems we are long over due for a formal Church of BSD.

Canonical is an adjective derived from canon. It essentially means "standard", "generally accepted" or "part of the back-story." Canonical in my context means reduced to the simplest and most significant form possible without loss of generality.
This word is usualy used by theologians and canon lawyers to refer to the canons of the Eastern Orthodox and Roman Catholic churches, adopted by ecumenical councils.

Hacker Slang - Holy Wars From
[from Usenet, but may predate it; common] n. flame wars over religious issues. The paper by Danny Cohen that popularized the terms big-endian and little-endian in connection with the LSB-first/MSB-first controversy was entitled On Holy Wars and a Plea for Peace. Great holy wars of the past have included ITS vs. Unix, Unix vs. VMS, BSD Unix vs. System V, C vs. Pascal, C vs. FORTRAN, etc. In the year 2003, popular favorites of the day are KDE vs. GNOME, vim vs. elvis, Linux vs. [Free|Net|Open]BSD. Hardy perennials include EMACS vs. VI, my personal computer vs. everyone else's personal computer, ad nauseam. The characteristic that distinguishes holy wars from normal technical disputes is that in a holy war most of the participants spend their time trying to pass off personal value choices and cultural attachments as objective technical evaluations. This happens precisely because in a true holy war, the actual substantive differences between the sides are relatively minor. See also theology.

What about Chuck?

The BSD Logo.

One another occasion a very christian individual was noticing the devil logo, I tried to explain it was a daemon, not demon or devil and didn't have any satanic meaning, again they freaked.

You have to admit, that's sort of a Satanic symbol if you ever saw one, right?

"Many people equate the word ``daemon'' with the word ``demon,'' implying some kind of Satanic connection between UNIX and the underworld. This is an egregious misunderstanding. ``Daemon'' is actually a much older form of ``demon''; daemons have no particular bias towards good or evil, but rather serve to help define a person's character or personality. The ancient Greeks' concept of a ``personal daemon'' was similar to the modern concept of a ``guardian angel'' --- ``eudaemonia'' is the state of being helped or protected by a kindly spirit. As a rule, UNIX systems seem to be infested with both daemons and demons." (p403) The earliest (and most popular) renditions of the BSD Daemon were created by John Lasseter.

That cute little red guy with the pitch fork is named Chuck

First Drawing with the Daemon Logo defines Daemon as A program or process that sits idly in the background until it is invoked to perform its task.

Historicaly though I always though of Chuck as more of a Gremlin really very much like the one portrayed in a Bugs Bunny cartoon "Falling Hare (1943)" before it was restored.

Officially Gremlins started in the 1920 at a RAF term for a low-ranking man saddled with oppressive assignments.

Gus the Airplane Military Insignia
Although this terms really take on color in World War II as a "an imaginary gnomelike creature who causes difficulties in aircraft."

Military Airplane Insignias

Also the Irish Gaelic word gruaimin, "ill-humored little fellow."

Drawing from Roald Dahl's book, "The Gremlins" Front Cover

This very much conjures up visions of these little gremlins running about secretly doing things.

From Roald Dahl's book, "The Gremlins"
"I've just found a nest of widgets," he said, and looked around in triumph. "Widgets?" said Stuffy. "Widgets? Never heard of them!"
But Jamface went on. "As I said, I've just found a nest of widgets located in the rear turret of my plane. There were twelve of them . very young ones."
"What are widgets?" asked Gus.
"It's very simple," said Jamface. "Widgets are the young of gremlins and fifinellas. No one knows until they grow up whether they are going to turn into males or females, but it's usually males; in each nest of twelve widgets only one will eventually turn into a fifinella."

The Church of BSD: Background

We are not a Satanic Cult Although we may be a cult, this has yet to be determined

One day I was at a restaurant explaining process control to one of my disciples.
I was mentioning how we have to kill the children (child processes) if they become unresponsive. Or we can even set an alarm for the children to kill themselves. That the parent need to wait (wait3) and acknowledge that the child has died or else it will become a zombie. The look of horror the woman sitting across had was unforgettable. I tried to explain it was a computer software thing but it was too late, she fled terrified, probably to call the police or something. I didn't really want to stick around too long to find out.
From: man ps Z Marks a dead process (a ``zombie'').

Hey, you just can't make up shit like this.

Don't forget that you have to Fork to Spawn Children, and the only way to Kill

On another occasion while being filmed doing a live video streaming event with Arthur C. Clarke, The camera filmed me key flying across the keyboard typing "kill 666". Just sort of odd the process ID, I didn't think much of it till It ended up in the final cut of a documentary video made about it.

And what about "chmod 666".

They say when you play a Microsoft CD backwards you can hear satanic messages...but that's nothing, if you play it forward it will install Windows! 
And what about Chuck?

 One another occasion a very christian individual was noticing the devil logo, I tried to explain it was a daemon, not demon or devil and didn't have any satanic meaning, again they freaked.

You have to admit, that's sort of a Satanic symbol if you ever saw one, right?

Read more at "What about Chuck".

BSD Unix History

Unix Started in AT&T Bell Labs in 1969. At time time is was freely shared as "scrap" The Berkely BSD 4.2 1983 OS was the first OS to support TCP/IP.
The Unix wars were the struggles between vendors of the Unix computer operating system in the late 1980s and early 1990s to set the standard for Unix henceforth. These battles are commonly held to have harmed the market acceptance of Unix and created a market gap that allowed the rise of Windows NT.

In the mid-1980s, the two common versions of Unix were BSD, from the University of California at Berkeley BSD4.2 released in 1983 , and System V, from AT&T. Both were derived from the earlier Version 7 Unix, but had diverged considerably. (This conflict was also known as the "UNIX wars" to some degree.) Further, each vendor's version of Unix was different to a greater or lesser degree.

A group of vendors formed the X/Open standards group in 1984, with the aim of forming compatible open systems. They chose to base their system on Unix.

X/Open caught AT&T's attention. To increase the uniformity of Unix, AT&T and leading BSD Unix vendor Sun Microsystems started work in 1987 on a unified system. This was eventually released as System V Release 4 (SVR4).

While this decision was applauded by customers and the trade press, other Unix licensees feared Sun would be unduly advantaged. They formed the Open Software Foundation (OSF), who released OSF/1, more closely based on BSD. AT&T and another group of licensees then formed UNIX International.

Technical issues soon took a back seat to vicious and public commercial competition between the two competing "open" versions of Unix, with X/Open holding the middle ground.

Linux kernel based on rewrite of Minux was released to the Internet in September 1991,

The first open source Unix port began in 1989 with 386BSD and first, incomplete traces of the port can be found in 4.3BSD NET/2 of 1991. It was first released in March 1992 (version 0.0) and in a much more usable version on July 14, 1992 (version 0.1).

Due to a lawsuit by AT&T, USL v. BSDi, some potentially so-called encumbered sources which existed within 386BSD were to be removed from all the derived systems, and the distribution of 386BSD was to be stopped. In late 1993

In 1993, AT&T sold Unix to Novell, who assigned trademark rights to X/Open. In 1996, X/Open and the OSF merged to form the Open Group, whose Single UNIX Specification is now the single standard for proprietary Unix. However, the damage to Unix's market share had been done.

BSD Unix

The BSD varients (FreeBSD, NetBSD, OpenBSD, etc) are UNIX based operating systems
that work on Intel PC based systems that have a reputation for being highly optimised,
highly secure and excellent (when decently configured) for keeping hackers at bay.

Linux does not compare all that well to BSD: having a reputation of being
a hacker's paradise to break into compared to BSD (FreeBSD at least).
FreeBSD (and the other BSD's) run some of the most intensely hit servers
on the globe, including It can be said that the nicest
thing you can do for a hacker is replace Windows with Linux as not only is it
potentially easier to hack (one of the benefits of open source), but the system
becomes worth hacking into. The same cannot necessarily be said with BSD based UNIX's
which are built of sterner stuff to keep hackers at bay.

Thus the BSD based operating systems of which FreeBSD is one - have a reputation of being
better designed (by gurus no less!), more secure (and more security
conscious) and more robust than most other operating systems (including
Linux - an operating system - it is claimed - "written by kiddies - for kiddies").
Refer to:
FreeBSD, OpenBSD and SuSE 6.2 Eval Review by Keith Rankin
: "The differences between
FreeBSD and Linux used to be much more obvious than they are now.
Now it comes down to theology. The BSD world is still the 'high church' or Druid Unix. Blood will
be spilled on a stone altar at midnite when star systems are in
a certain alignment to learn the ways of this tribe. Linux is a
happier world. The spirits of Captain Kirk, Peter Pan and good beer come to mind."

("Buckets of Blood" and non-alcoholic prudery is official CCP14 computer operating system policy)

Remove all but the newest packages on hosts

Remove all but the newest packages on hosts

for h in $(ls XXX* | sed 's/\(\w*\)\..*/\1/' | sort -u ); do
ls -t $h*  | tail -n +4 
done | xargs sudo rm
list just packages. 
sed 's/\(\w*\)\..*/\1/'  

this turns "XXXyyy-1.23.rpm" in to XXXyyy-1
sort -u 

then only give me unique package names.
for h

indexs through each type of package.

Then we pass each package type $h* in to a ls -t that sorts by time,
tail -n +4  

this removes the first 3 lines from what it list in the ls, just the 3 newest versions

then takes this list of files from everything before and passes it as an argument to rm

After IPv4, How Will the Internet Function?

from Slashdot:

"36 countries in the world have over 100% per-capita usage of mobile phones, and this is driving a real crunch on IPv4 addresses as more and more of these devices are data-capable. The mobile network operators are acting fast to deploy IPv6, and T-Mobile USA has had an IPv6-only trial going on for over 9 months now using NAT64 to bridge to IPv4 Internet content. It is interesting to note that the original plan for IPv6 transition, dual-stack, has failed since IPv4 addresses are effectively already exhausted for many people who want them. Dual-stack also causes many other issues and has forced the IETF to generate workarounds for end users called happy eyeballs (implying that eyeballs are not happy with dual-stack), and a big stink around DNS white-listing. How will you ensure that your network, users, and services continue to work in the address-fractured world of the future where some users have only IPv4 (AT&T ), some users have only IPv6 (mobile and machine-to-machine as well as developing countries), and other Internet nodes have both?"

Progress In Algorithms Beats Moore's Law

"Seen on the blog 'Algorithmic Game Theory,' a report to congress and the president about past and future advances in information technology notes that, while improvements in hardware accounted for an approximate 1,000 fold increase in calculation speed over a 15-year time-span, improvements in algorithms accounted for an over 43,000 fold increase."

Friday, December 24, 2010

Ubuntu blocking X11 solution

My servers are OpenSuSe and my personal machine is Ubuntu. On a local area network, I can run my X11 editor and edit files on the server. But remotely, like from home, it was not clear.

This did it. Add to /etc/ssh/ssh_config

ClearAllForwardings yes

I also explicitly set the ssh server

X11Forwarding yes

it is not clear if this is the default

Today (2010-12-29), I also noted in /etc/ssh/ssh_config

ForwardX11 yes


Tuesday, December 21, 2010

The Mysteries of the Unix Date Command.

To do any math on dates is very difficult in any language. But in the Unix/Linux shell this can be a breeze.

This is done by converting all data time in to Seconds.

In Unix this is done by counting seconds from UTC or Universal Constant Time, 1/1/1970

So once you convert in to second, you can do math as usual, then convert time back to date time.

Example of how to convert back and forth

Conversion from Seconds UTC to string
-bash-3.2$ date --date "1970-01-01 1292970890 sec utc"
Tue Dec 21 14:34:50 PST 2010

Conversion from string to Seconds UTC
-bash-3.2$ date --date "12/21/2010 14:34:50 PST" "+%s"
-bash-3.2$ date --date "Dec 21 14:34:50 PST 2010" "+%s"

Current time
-bash-3.2$ date "+%s"

Get Seconds UTC file creation date.
stat -c %Y filename
ls -l
-rw-r--r-- 1 jsokol jsokol       8 Sep 22 18:36 t
-bash-3.2$ stat -c %Y t

So for doing math on time:

Get file age

(In Bash)
Returns how many hours old
expr \( `date +%s` - `stat -c %Z $filename` \) / 3600

Return age of oldest file in directory
expr \( `date +%s` - `stat -c %Y \`ls -t | tail -1\` ` \) / 3600

Create Shell alias of this
alias oldest='expr \( `date +%s` - `stat -c %Y \`ls -t | tail -1\` ` \) / 3600'

bash process ID PID

$$, My PID
$!, My Child PID
$PPID, My Parent PID

bash command line

echo "$*"
echo "$@"
echo "$_"
echo "$#"

./test a b c
a b c
a b c

Friday, December 17, 2010

Ansi color codes in Ruby

 while x < 38 do
   while y < 48 do
     st +=  esc+"#{x};#{y}m #{x};#{y} "
   puts st+esc+"0m\a"
   x += 1
puts esc+"0m"

This output's

With a little work I am sure this can be made in to a simple function or library.
or just something you can send with a puts.

Ruby to MBox format.

I have over the past 20+ years written many scripts to deal with incoming mail.
I can process statistics from machine generated alert E-mails, rebroadcast E-mails and generate pages from them based on there content.

I was using a the IMAPClient library in Perl for this, but when my IMAP Mail server was migrate to an SSL based TLS/IMAP everything broke.

TLS encrypted port 993 RFC2595 RFC3501

After many long hours of struggling to get IMAPClient to work over SSL I just had to give up. It looks like something is just broken in that lib, I tried opening my own SSL socket then passing it to the lib, I tried having the lib itself connect to the SSL socket, no luck.

The Ruby net/imap just seems better written and it does work. Unfortunately it's lacking the message_to_file  function which I had to replace that functionality.

A small change in the scripts below could also simulate .forward also or support mail dir.
If you do that, please send me a copy  

In Perl for Non-secure IMAP

use Mail::IMAPClient;
my $imap = Mail::IMAPClient->new( Server       => 'mail.yourdomain:143',
                                   User         => 'jsokol',
                                   Password     => 'yea-right')
        or die "IMAP Failure: $@";

 foreach my $box qw( alarmpoint ) {
   my $file = "/uhome/jsokol/crapmail/". $box;

   my @msgs = $imap->search('ALL')
        or die "Couldn't get all messages\n";

   foreach my $msg (@msgs) {
     open my $pipe, "| formail >> $file"
       or die("Formail Open Pipe Error: $!");
     $imap->message_to_file($pipe, $msg);
     close $pipe
       or die("Formail Close Pipe Error: $!");

   # Now expunge the messages and close the folder


I am just learning Ruby, so please excuse some of this code.

In Ruby secure TLS/IMAP
require 'net/imap'

        server = ""
        port = 993
        ssl = true
        username = "jsokol"
        password = "yea-right"

        Net::IMAP.debug = false
        conn =, port, ssl)
        resp = conn.login(username, password)'test')['ALL']).each do |sequence|

                env = conn.fetch( sequence,"ENVELOPE")[0].attr['ENVELOPE']
                xdate =" ");

               wkday = xdate[0].sub(/,/,"")
               day = xdate[1]
               month = xdate[2]
               year = xdate[3]
               time = xdate[4]

               if (day.length < 2)
                   day = "0" + day

                box  = env.from[0].mailbox  + "@" +  env.from[0].host + "  " + wkday + " " + month + " " + day + " " + time + " " + year

                fetch_result = conn.fetch( sequence,  "RFC822")[0].attr['RFC822']
                if fetch_result
            "MAILOUT" , "a") {|file|  file.write ("From #{box}\n#{fetch_result}\n\n\n") }

       , "+FLAGS", [:Deleted]) # remove this line if you don't want to deltete these E-mails.
        conn.expunge # remove this line if you don't want to deltete these E-mails.

Google Public DNS

Few people are aware of this but Google offers a DNS service.

This is particularly useful in a number of situations.

*If you are inside a corporate firewall and want to test host DNS entries appear to the outside world.

*If you don't trust your local ISP, or their DNS is having issues.

I often run scripts to check massive blocks of IP's

#while read ADDR
for ADDR in $IPLIST; do
 DNSR=`host $ADDR | tail -1 | awk ' {print $NF}' | sed 's/3(NXDOMAIN)/NONE/'

echo  "$HOST : $ADDR $DNSR" >> ADDR-LIST.txt


Google Public DNS IP addresses

The Google Public DNS IP addresses are as follows:

Using Google Public DNS, A DNS Number for Faster Browsing

Thursday, December 16, 2010

Lua Programming

Lua is a sexy little language out of Brazil.

Ruby programming

Been learning Ruby lately. Didn't think I'd like it better then Perl But I do.

I will post some links I have found useful on this page.

Ruby Basic Tutorial

Ruby in Twenty Minutes

Ruby in 100 Minutes

Ruby 101: Substrings in Ruby

Some files space is just wasted

Recently, while testing some software that did directory tree displays, I noted 1,505,297 bytes used just to store the names for the /usr directory for Linux. Or 28000+ subdirectories.

Again, that is 1,505,297 bytes just for the directory names.


Saturday, October 02, 2010

Oil and Lube

One would think that computers are not in need of regular maintenance, in fact they are. After some time in operations - months or years, any original lubricants are gone. Recently, SVBUG was gifted several servers that had seen their prime, but were still useful. A little Oil and Lube did the trick.

Here are a couple of Tutorials on :

How to Remove and Apply Thermal Compound By Jeremy Blum (aka sciguy14)

Quiet noisy computer fans with a drop of oil by Greg Shultz


Tuesday, September 28, 2010

BSD Event Feed and RSSFeed

Looks like a semi-official BSD Events list,

The RSS Feed is on the right below the menu junk. It's also below:


Tuesday, August 31, 2010

Super Computer taking over?

In a recent story (May, 2010), SEC Chairman Admits: We’re Outgunned By Market Supercomputers, a luddite might find reason to fear big brother. But in fact a mystery remains from the so-called "Fat Finger Incident" on May 6, 2010. The incident, such that it was, trigger "a total drop of 9.16 percent from the previous day’s close".

I'm sure conspiracy theories will abound as to the reason for this - including the demise of certain individuals. More to the point of this article, it cannot be sufficiently underestimated the problems the stock market has created.

It has been reported that because modern stock trading is essential completely electronic --- that dealers look to have their computers as close to the trading computers as possible. The idea is to be able to process orders microseconds quicker than the competition.

In fact it has also been reported that traders are "snipping" as the market moves. That is, "snipping" makes a few cents, if not hundreds of a cent as the market (or a particular stock) moves in a direction. It has even been suggested that dealers are making these "few cents" on their own client's "trades". It has even been suggested that these dealers, having prior knowledge of the limits of their clients, are pushing the pricing to the limit.

This last scenario, as suggested, means the buyer is actually paying more than they would have had the closing price not been known to the dealer.

If this is true, then it appears the dealers are undermining the confidence of their own business.


Thursday, August 26, 2010

Notes on Cloud Computing

From a recent BayLisa meeting, in which the speaker failed to arrive, the topic of the night was "Cloud Computing". The first order of business was to define its meanings.

The moderator started by asking if anyone had direct experience in this or similar. I started by stating I had worked in a video-over-the-internet business in the late 90s. Then stated that "cloud computing" was marketing hype.

To make this short, this is the best definition I could write down:
Cloud Computing
Either a high-speed on-demand distributed or a high-speed on-demand clustered computing with invisible redundancy. The best uses to date appear to be optical recognition, and audio recognition. In addition, there are working businesses very reminiscent of "Thin Computing".

Friday, July 30, 2010

Happy sysadmin day everyone!

>  What about the DBAs? They need something too:

ORA-24123 feature "dbaday" is not yet implemented

24123, 00000, "feature %s is not yet implemented"
// *Cause: An attempt was made to use the specified feature, but the feature is
// not yet implemented.
// *Action: Do not attempt to use the feature.

Saturday, July 17, 2010

Apps, Apps, How many apps?

While browsing the NetBSD website I found this nice chart.


Thursday, July 08, 2010

scp recursive copy

If you've set up a copy using:

scp -r tc@cup:~/myremotestuff/* .

You may have gotten the error

scp: No match

What is not obvious is "what the error is". What has happend is scp tries to match to a local name when infact the intent is to match a remote name. Remove the wildcard (*) and all will be good.


Wednesday, March 10, 2010

How to write more reliable servers. - dealing with failures

Given enough time most Internet servers will crash. It could be a memory leak, or some unexpected behavior from a new browser, or a deliberate denial of service attack. It could even be from hardware problems such a flaky memory chips.

The question is how do you deal with this.

If you take your basic C/C++ TCP/IP server application, when it dies it dies.
Many people set up some mechanism to monitor it and page a technician to restart it. This has many drawbacks and can lead to periods of prolonged downtime if alerts are missed or crashes become frequent.

Web servers only became reliable when NCSA 1.4.1 came it. It was very well thought out and well written and most web service since have copied the mechanisms it used. NCSA used a parent process that spawn child processes to actually do the work. When a child process dies, the parent wakes up and immediately restarts them.

In my former company IBS(Internet Broadcast Systems) and later at DVBS (Digital Video Broadcast systems) we called this a keep_alive.

The simplest example can be a shells script.
while true
echo "server crashed" > log
sleep 1

With in C server code

int main(int argc, char *argv[])



    switch (pid = fork()) {
    case -1:
 printf("\nCan't fork!\n");
    case 0:
 printf("\nChild died!\n");
 goto Refork;


Friday, January 15, 2010

Linux Disable PC Speaker beeps

Runtime change

  • Check if you have the pcspkr module loaded.
#lsmod | grep pcspkr
pcspkr                  7105  0
  • Remove the module. lsmod will return nothing if the module was removed.
#rmmod pcspkr
#lsmod | grep pcspkr
  • Restore the module when done.
#modprobe pcspkr
#lsmod | grep pcspkr
pcspkr                  7105  0

Permanent change

  • Add the pcspkr module to the modprobe blacklist file.
# vi /etc/modprobe.d/blacklist
{Add the lines below to the file.}
# pcspkr - turn off pc speaker "BEEP!"
blacklist pcspkr
  • Reboot, and check if the pcspkr module was loaded. If the blacklist file kicked in then nothing will be returned.

Tuesday, January 12, 2010

Google Chrome

It's using many of the concepts I expored in my talk about the Amorphous OS, I will have put those slides back on the internet.

A big part is no local files.

Looks like it's build on a stock Linux Kernel.. I was thinking about this and they need to get ride of the paradigm of a process and replace it. 
Processes have there own time slices and memory.  They seems to have spend a lot of effort to give each browser tab it's own process, and in some circumstances they could not.

What they need to do it get rid of the whole concept and go with an object based memory model.

Where some objects are shared between processes where processes are not sandboxed memory as much as just time slices and sandboxed memory objects associated with parent objects.