Wednesday, December 31, 2014

Remote to the RPi.

It is challenging to have to provide a keyboard and a mouse to multiple machines, so why not remote into them. The Raspberry pi is an exemplary system for using remotely.To set this up you will want to remotely log into the RPi to set up xrdp.

 ssh pi@

pi@oerpi02 ~ $ sudo apt-get install xrdp

That is all for the RPi side, so all you have to do is log in remotely.

Fire up you remote desktop viewer.

Enter in the appropriate settings.

Type in login and password. And viola you have a remote connection,

Some people have found this post also useful:

Keeping medical records.

Keeping medical records is very important. Of course, your doctor's office will keep records, but you will want to keep your own set. Was looking at this software for doctor's offices so they can keep records. It is so detailed, that you would enriched if you used this program yourself. The program is called openemr and is available from (perfect for a doctors office). The have version for several operating systems.  The version that interested me the most was the web version, so you could install it on your own private server and everyone on the network can use it.

We setup what is known as a virtual site so that it co resides with other websites from the same server (just like the pros do it).  What is interesting os that you can keep a record of office visits. You can even printout records for  just one visit or print the whole month out.

Of course you can add any member of the family maybe add or setup up accounts for relatives that you care about.

Of course, the financial records are important, especially at tax time.

Some people might think it is a bit overdoing it, but wait till you want to get at the information and you will really appreciate the software. Have only scratched the surface of what can be done. Check it out!

Tuesday, December 30, 2014

Let's build a tunnel.

Ever want to access your own site with a bit of privacy? Tunnelling can be a way to do that. It does require user rights on the intended machine to be the host. If yoy look at a web site, you see the normal url something.something. sitetype. In this case we are just going to oeorgan1. Bue what we would like to do is try to encrypt the connection between the two machines.

One traditional way to do it is using the secure shell (SSH) , but you could probably also use a program called putty.  Here is the simplest version:

ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
[-D port] [-e escape_char] [-F configfile] [-i identity_file] [-L
[bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port] [-R
[bind_address:]port:host:hostport] [-S ctl_path] [user@]hostname

 $ sudo ssh  -L 80:localhost:80 eddie@oeorgan1

But if we did this it would open a prompt that I do not want.

if we use the -N will still let us in but there is no command prompt generated.

 What we have done is point our localhost to another computer as if it was our own. So now if we use localhost as the url in the browser it shows the web page of the system we are connected to.

So now any communication should be encrypted between the two machines. You can still go to other websites.

When we are done we can terminate the connection with a <ctrl>C.

So now if we go to localhost after refreshing the connection, the normal page should come up.

Reverse SSH Tunneling Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can with reverse SSH tunneling. This document will show you step by step how to set up reverse SSH tunneling. The reverse SSH tunneling should work fine with Unix like systems. Let's assume that Destination's IP is (Linux box that you want to access).  You want to access from Linux client with IP  Destination ( <- |NAT| <- Source ( 1. SSH from the destination to the source (with public ip) using command below:

$ ssh -R 19999:localhost:22 sourceuser@

* port 19999 can be any unused port.

2. Now you can SSH from source to destination through SSH tuneling:

$ ssh localhost -p 19999

3. 3rd party servers can also access through Destination (  Destination ( <- |NAT| <- Source (
<- Bob's server 3.1 From Bob's server:

$ ssh sourceuser@

3.2 After the sucessful login to Source:

$ ssh localhost -p 19999

* the connection between destination and source must be alive at all time.

Tip: you may run a command (e.g. watch, top) on Destination to keep the connection active.

Typical session: (typo1 is the server)


          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::210:5aff:fe19:fd88/64 Scope:Link
          RX packets:858 errors:0 dropped:0 overruns:0 frame:0
          TX packets:750 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:387860 (378.7 KiB)  TX bytes:99206 (96.8 KiB)
          Interrupt:9 Base address:0x4800

          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::210:5aff:fe19:fd88/64 Scope:Link
          RX packets:858 errors:0 dropped:0 overruns:0 frame:0
          TX packets:750 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:387860 (378.7 KiB)  TX bytes:99206 (96.8 KiB)
          Interrupt:9 Base address:0x4800
eddie@typo1:~$ ssh -R 19999:localhost:22 eddie@
eddie@'s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic i686)

 * Documentation:

No mail.
Last login: Tue Dec 30 21:01:52 2014 from dsl
eddie@typo1:~$ ssh -R 19999:localhost:22 eddie@
eddie@'s password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-43-generic i686)

 * Documentation:

No mail.
Last login: Tue Dec 30 21:01:52 2014 from dsl

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:  Bcast:  Mask:
          RX packets:19375 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17998 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7997509 (7.9 MB)  TX bytes:4431653 (4.4 MB)

lo        Link encap:Local Loopback 
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:129 errors:0 dropped:0 overruns:0 frame:0
          TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:18101 (18.1 KB)  TX bytes:18101 (18.1 KB)

eddie@oelt02:~$ ssh localhost -p 19999
eddie@localhost's password:
Linux typo1 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Tue Dec 30 03:16:31 2014


Monday, December 29, 2014

Networking testing tools.

No matter how much wireless networking there is, you have to have at least a small amount of hardwire. There are some tools that might be nice to have if you are using more than the minimal amount of cabling (aka hardwire).

The tone generator helps you trace where a wire is routed through. Personally, in all my years as a tech, I think we used only just once.

When trying to see if a network wall outlet was live, I used an end tester. you would use the tester coupled to a patch cable (short length of network cable).

If things are working correctly, all four lights should be lit. Though with this unit, have seen a few false positives.If all the light are not lit, it can be a bad female plug or some fault down the line. Generally has only one port.

To test a single cable. Connect both ends to the tester.  You would not connect it to a network or it will get damaged. You will need access to both ends of a cable to test.

Generally these tools are used when preparing a cable. The unit will generally check one wire in the cable at a time. If the lights do not show in sequence then one or both ends of the cable have to be redone. If lights do not show up is also a symptom of a bad cable.

If all is well then you need to check to see if there is data coming down the line. There are some expensive tools, but usually a laptop with basic networking software tools will do just fine.  Generally, when you hook to a network, the network will send data in the form of TCPIP. It will want to give a network address to use (sort of a phone number).  So we can find out by hooking the laptop whether that data has been sent.
If you are not getting an ipaddress you might see something like this:

 $ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          UP BROADCAST MULTICAST  MTU:1200  Metric:1
          RX packets:77134 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59943 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:66488832 (66.4 MB)  TX bytes:9327481 (9.3 MB)

Then if the network is sending you an ipaddress, it might look something like this:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          inet addr: Bcast:  Mask:
          RX packets:77146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59990 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:66490251 (66.4 MB)  TX bytes:9340858 (9.3 MB)

In this case the network address is and everyone should be able to reach you at that network address.  But is the network available? You can use the ping command to see if a site is available. You get  to see Google network phone number.

$ ping -c1
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=53 time=30.0 ms

--- ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 30.036/30.036/30.036/0.000 ms
You can go one step further and see what places are on the way to google

$ traceroute

or you can go to the web..

Lastly, you use special programs to see what kind of information is on the network. These are known as packet sniffers. One such program is Wireshark. These tools can also be used for wireless.

Ethernet packing sniffer interfaces:

Also see:

Sunday, December 28, 2014

Generic ipxe boot

Talked about using ipxe before, so I will not repeat all that here. Found this generic ipxe boot data file. You may need to do some adjustments. You can also cut just what you need to use.


# To access this file via http use following redirection:

# choose cpu architecture
cpuid --ext 29 && set arch amd64 || set arch i386

menu NetInstall
item --gap NetInstall Ubuntu Preseed (user: ubuntu, password: t00r):
item install_ubuntu_14.10           Ubuntu 14.10 Utopic
item install_ubuntu_14.10_autopart  Ubuntu 14.10 Utopic autopart
item install_ubuntu_14.04           Ubuntu 14.04 LTS Trusty
item install_ubuntu_14.04_autopart  Ubuntu 14.04 LTS Trusty autopart
item install_ubuntu_14.04_forcepae  Ubuntu 14.04 LTS Trusty (32 bit)
item install_ubuntu_12.04           Ubuntu 12.04.3 LTS Precise
item --gap NetInstall Debian
item install_debian_6_not_preseed   Debian 6 Squeeze
item install_debian_7_not_preseed   Debian 7 Wheezy
item install_debian_7_backports     Debian 7 Wheezy (wheezy-backports kernel)
item --gap NetInstall Debian Preseed (user: root, password: t00r):
item install_debian_8               Debian 8 Jessie (unstable)
item install_debian_7               Debian 7 Wheezy
item install_debian_7_autopart      Debian 7 Wheezy autopart
item install_debian_7_backports_autopart      Debian 7 Wheezy backports autopart
item install_debian_6               Debian 6 Squeeze
item install_debian_6_autopart      Debian 6 Squeeze autopart
item --gap NetInstall Fedora:  
item install_fedora_20              Fedora 20
item install_fedora_19              Fedora 19
item --gap NetInstall CentOS:  
item install_centos_7.0             CentOS 7.0
item install_centos_7.0_kickstart   CentOS 7.0 (kickstart)
item --gap NetInstall Arch Linux:  
item install_arch_linux             Arch Linux Netboot
item --gap Other
item install_ipfire                 IpFire
item back   < Back to main menu
choose target && goto ${target}

chain ${mainmenu}

# Ubuntu
set release utopic
goto install_ubuntu

set autopart autopart
set release utopic
goto install_ubuntu

set release trusty
goto install_ubuntu

set autopart autopart
set release trusty
goto install_ubuntu

set release precise
goto install_ubuntu

set release trusty
set arch i386
set options forcepae
goto install_ubuntu

  current/images/netboot/ubuntu-installer/${arch}/linux url=\
  preseed/ubuntu-minimal.seed auto=true netcfg/choose_interface=${net0/mac} \
  locale=en_US.UTF-8 priority=critical biosdevname=0 ${autopart} ${options}

# Debian
set autopart autopart
goto install_debian_6

set release squeeze
goto install_debian

set autopart autopart
goto install_debian_7

set autopart autopart
goto install_debian_backports

set release wheezy
goto install_debian

set release unstable
goto install_debian

set release squeeze
chain${release}/main/installer-${arch} \

set release wheezy
initrd${release}/main/installer-${arch} \
chain${release}/main/installer-${arch} \

set release unstable
initrd${release}/main/installer-${arch} \
chain${release}/main/installer-${arch}  \
 /current/images/netboot/debian-installer/${arch}/linux url=  \

 /current/images/netboot/debian-installer/${arch}/linux url=\
 /preseed/debian-minimal.seed auto=true netcfg/choose_interface=${net0/mac} priority=critical \

set release unstable
initrd${release}/main/installer-${arch}/current/ \
chain${release}/main/installer-${arch}/current/ \
 images/netboot/debian-installer/${arch}/linux url= \
 debian-wheezy-backports-minimal-preseed.seed auto=true netcfg/choose_interface=${net0/mac}\ 
 locale=en_US.UTF-8 priority=critical ${autopart}

# Fedora
# TODO: auto 32/64 bit
set release 20
goto install_fedora

set release 19
goto install_fedora

initrd${release}/Fedora/x86_64 \
chain${release}/Fedora/x86_64 \
 /os/images/pxeboot/vmlinuz inst.repo= \

# CentOS
# TODO: auto 32/64 bit

chain ksdevice=link \ 

# Arch Linux
cpuid --ext 29 && set arch x86_64 || set arch i686
chain${arch}/vmlinuz \
 autopartarchiso_http_srv= \ 
 archisobasedir=arch checksum=y ip=dhcp

# IpFire

Quickie web server.

If you need a fast setup web server running and you do not want to have to set up apache or something similar, then Python can help. Python comes with a simple builtin HTTP server. With the aid of this little HTTP server you can turn any directory (within limitations) in your system into your web server directory. This is important especially on embedded devices where storage is nominal. The only thing you need to have installed is Python. Linux comes with Python for the most part.

Practically speaking this is very useful to share files inside your local network. We like to use it for sharing documentation. Implementing this tiny but hugely useful HTTP server is very simple, its just a single line command. Note: this server is NOT SECURE. Use at your own risk.

Assume that I would like to share the directory /home/pwsrvr (or ~/pwsrvr) and my IP address is

Open up a terminal and type:
$ cd /home/your_dir_2_b_used
$ python -m SimpleHTTPServer 
c:\> cd /home/your_dir_2_b_used
c:\> python -m SimpleHTTPServer
That's it! Now your http server will start in port 8000. You will get the message:
$ python -m SimpleHTTPServer 8080
Serving HTTP on port 8080 ...

Now open a browser and type the following address: - - [28/Dec/2014 02:10:48] "GET / HTTP/1.1" 200 - - - [28/Dec/2014 02:10:48] "GET /ss.png HTTP/1.1" 200 - - - [28/Dec/2014 02:10:48] "GET /cgi.gif HTTP/1.1" 200 - - - [28/Dec/2014 02:10:48] "GET /ha.jpg HTTP/1.1" 200 -

You can also access it via:

If you want to use "localhost", make sure it is set up in your hosts file. Seen where it was not. If the directory has a file named index.html, that file will be served as the initial file. If there is no index.html, then the files in the directory will be listed.

$ ls
1.gif            cgi-bin    ha.jpg         ip.png  ss.png         wmfb.php
backup           cgi.gif    icon.ico       lo      thankyou1.php
bash1.png        chmod.png  index.html     sl.png  wmfb.dat
bashscript.html  cron.png   indexhtml.old  sp.png  wmfb.html

Index.html has been renamed to text. If you just want to serve files, this might be a better way to do it.

If you wish to change the port that's used start the program via:
$ python -m SimpleHTTPServer 8080

For more security, if you want to only serve on localhost you will need to write a custom Python program such as: (untested)
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler

HandlerClass = SimpleHTTPRequestHandler
ServerClass  = BaseHTTPServer.HTTPServer
Protocol     = "HTTP/1.0"

if sys.argv[1:]:
    port = int(sys.argv[1])
    port = 8000
server_address = ('', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."

Note also that this should also work on MSWindows or MSWindows with Cygwin. Have not tried on an Apple Mac. you can find Python at

Saturday, December 27, 2014


You are kind of like a computer and you need logical instructions to solve a problem. Those instructions are the programming that is needed. So what is it about?

Programming is required so that we can solve a problem.  What a lot of people think programming is about.

What are the parts of the system?  They are:

System parts







There is actually a lot more as you can see from the list below. I may differ from this list a bit.

We want to build a program, but first we have to see what we need. What are we looking for in results. Obviously you need to be organized. You need a plan.

What must the results look like?  Reports:hard copy, terminal, web output, or etc

 Output datafiles:
How will we get the data into the system?

 What form must the input data take:

How will we process the data from input to output:  Formulas and logic needed should be documented. Flowcharts are a way to document what your plans are. Two flowcharts of many used are first the Vtoc.

And then second is the traditional flowchart.

For specific symbols see:

What hardware do we need?
There used to be a joke that you could not get fired for purchasing IBM with using the Intel platform. Nor so true anymore. Do need special input and or special output devices. What kind of networking. What kind of security equipment. In the past the computer hardware platform was dominated at least with the desktop systems if Intel versus PPC. The PPC platform has gone awaym but we now have the Arm processors really begin to flood the market. Arm is become the best for lighter platforms (embedded) and the Intel systems are taking the high end. That is changing now that the multicore Arm processors are more powerfull and easier to get.

What development software? 
What kind of software do we need. That goes not only for the development software, but for specialized firmware. For example,  Networking equipment comes with the manufacturers software. Many people choose to prefer third party software that is usually more powerful. We have seen that a lot with your home routers. Instead of the usual firmware, Openwrt or DDWrt may be used to replace the factory firmware.

One factor that is usually forgotten is how user friendly will the software be. Is it intuitive? How knowledgeable will the users already be. Hopefully they will they not be required to be constantly looking at manuals to use the software.

That being said development software, varies in the range of source code they prefer. C, Java, or many other languages might be used. What development language you might use also depends on the skill set of the program developers. Though more and more programmers are finally becoming diversified.

You might want to also consider how portable is the code going to be, can we reuse the code on newer or different platforms. What kind of software licenses will be required and other legal issues that might potentially arise. On a wide scale, will it be copyrighted or open source. Is there a chance that, there will be a question of ownership, as with Oracle and Java.

What data validation software and techniques need to be used to prevent problems. Or to quote and old addage of GIGO. (Garbage in then you will have  Garbage out).

Having decided all that, now we can start coding. Obviously as we go along, things will need to be changed. Source code should never be written in stone. You also want to make sure adequate backups or duplicates of the software are kept to prevent loss. One other issue is security. How sure are you the code will not get leaked to competitors either from inside or outside sources.

Testing and debugging. (expect the unexpected)
Lastly, what kinds of debugging tools and test data will we need to verify the competency of the software. When you think you have tested it enough, test it again. Will the dummy data be diverse enough to test all possible scenarios. Testing software will also need to be developed if not readily available.  One thing for sure is that even if you think everything is perfect, do not remove any existing systems till your new software proves to be robust. You would running software in tandem with the existing setup.

You may want to do testing, that forces the system to fail. You will be able to gauge what safeguards and others features need to be built in to easily recover from any possible disasters.

Have been in enough real world situations where everything was supposed to be perfect, but when the software was put into production, there were nothing but problems. Could tell quite a few war stories so to speak about installing new systems. Even if you do get it right, you may want to change how the software works or be able to additional equipment. That all requires redevelopment and retesting. 

Documentation. (and training)
If potential users are made part of the testing process, you can gauge how user friendly your system is.  Then make changes as needed. Feedback from users can be a tool to also what needs to be part of the documentation of the project. Where did those users feel that they needed more instruction.

New users will also be a part of the documentation testing as what needs to also be included or improved as they are being trained on the software.  What are the proper procedures for the use of the software, handling of the equipment, and dealing with the data that is needed to get the information required.

End users will need to be trained as to whether the information generated by the system is valid. If the information in a form that is useful, how will the information be used. Was the problem solved with what was done? Here we go again.

Another table

Another table.

Screenshot from 2014-12-27 02:02:25
Source code example:

<!DOCTYPE html><html><head><style>thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
{border:1px solid black;}
<table border="1" style="width:300px">

Friday, December 26, 2014

Raspberry Pi web server setup.

Web server software setup.

There are two basic programs we want to install. Apache2 the web server and PHP a programming language for use with the server.

$ sudo apt-get install apache2 php5 libapache2-mod-php5 php5-cli

That will take a little while to install. Be patient.

Then you need to do a fix for the server.

$ sudo nano /etc/apache2/conf.d/name

For example set add ServerName localhost or any other name:

ServerName localhost

or you could use

Servername yourservername

Save the file and restart Apache 2

$ sudo service apache2 restart

Test the server:

Point a browser to the RPi You should get the setup page.

Now we need to test the PHP install..

$ cd /var/www

You should already see index.html with the code that shows you the home page.

Now we need to create a new page

$ sudo nano phpinfo.php

Save and exit. Now point your browser to yourhostname/phpinfo.php

You should get the PHP status page.

Now you should be ready to roll.

Note: you may need to edit /etc/apache2/apache2.conf and add:

# add php useage
AddHandler application/x-httpd-php .html

Create your web page and save it at /var/www


<title> main page </title>
Site under contruction
<img src='' eight=500 width=500 />


Update: Definitely left out the database part of a server. With MYSQL now being allegedly commercial, we wanted another choice. Oracle seems to have their fangs in all the major databases. We wanted to use Mariadb, but it does not seem to be in the repositories for the Raspberry Pi. We can also use freebasic to build our own database.

Goodbye line numbers.

Ever copy code into vim and realize that the line numbers were also copied. Here is a quick easy way to get rid of the line numbers.

Original code:

We want to remove the first 5 characters from every line so then we need to use the normal option:

:%normal 5x

Press return and the line numbers are gone!

Some other tricks:

Remove first 2 characters of every line, only if they're spaces:
:%s/^ /

Note that the last slash is optional, and is only here so that you can see the two spaces. Without the slash, it's only 7 characters, including the :.

Move indentation to left for every line:
:%normal <<