Home

One more day.

Leave a comment

Chit chat

———-

Schools want to reduce math and science classes for alleged lack of interest. I think it is an instructor issue instead.

Working on some stuff for an or two.

If you think the command line is too hard, then try these.

What do you really own?
Using the Arduino and ethernet for a web interface to control audio inputs and outputs via 4066 ic’s.
Have a little fun with your home web server. Imagine you are a fancy restaurant.

 

—————————————————

Use the Arduino + ethernet when your server is down for a temporary site to let your users know what is going on.pertinent code:

client.println(“<center>”);client.println(“<h1>Your server name<h1>”);
client.println(“<hr”);
client.println(“<br />”);client.println(“<h2>Bear with us as the server is under reconstruction!</h2>”);
client.println(“<img src=’http://www.seemyheart.org/wp-content/uploads/2013/06/Website_Under_Construction.gif‘ height=500 width=500 />”);
client.println(“</center>”);

—————————————————

Just had to try this.

We have a boat load of negatives that should be in picture files.

The form: (not actual size).

—————————————————

Just a simple batch file to collect information about your computer.  A bit dated and there are probably some commands that should have been included, but a good list of commands you can use to find out about your linux box. You have to install some of the commands for them to work. You do not have to use all the commands like I did, but it will be interesting to see what is in the file generated. Great for documentation about the system. Good list to have for insurance purposes.

usage: sudo ./hwinfo2file.sh filename

$ sudo ./hwinfo2file.sh My_desktop_computer_info

hwinfo2file.sh

echo "================================="
cat /etc/hostname
echo "getting stats"
file=$1.txt
# file="system.txt"
echo " " &gt; $file
echo "=====================================" &gt;&gt; $file
echo&nbsp; get computername &gt;&gt; $file
cat /etc/hostname &gt;&gt; $file
echo "=====================================" &gt;&gt; $file
echo&nbsp; get current ip connections &gt;&gt; $file
sudo ifconfig &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get linux version &gt;&gt; $file
lsb_release -a &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get memory specs &gt;&gt; $file
free &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get file storage statistics &gt;&gt; $file
df -h &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get mounted file system list &gt;&gt; $file
cat /etc/fstab &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get pci specs &gt;&gt; $file
sudo lspci &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get loaded modules &gt;&gt; $file
sudo lsmod &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get current usb attachments. &gt;&gt; $file
sudo lsusb &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo get repos &gt;&gt; $file
cat /etc/apt/sources.list &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get installed software &gt;&gt; $file
# sudo dpkg --get-selections &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get hardware info &gt;&gt; $file
# sudo lshw &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get scsi devices &gt;&gt; $file
# sudo lsscsi &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; display /etc/issue &gt;&gt; $file
cat /etc/issue &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get boot up info &gt;&gt; $file
# dmesg &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get users &gt;&gt; $file
cat /etc/passwd &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get current users on system &gt;&gt; $file
who &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get system messages &gt;&gt; $file
# cat /var/log/messages &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get rootkit checker log &gt;&gt; $file
# cat /var/log/rkhunter.log &gt;&gt; $file
# echo "-------------------------------------" &gt;&gt; $file
# echo&nbsp; get syslog &gt;&gt; $file
# cat /var/log/syslog &gt;&gt; $file
echo "-------------------------------------" &gt;&gt; $file
echo&nbsp; get scheduled events &gt;&gt; $file
cat /etc/anacrontab &gt;&gt; $file
cat /etc/crontab &gt;&gt; $file

—————————————————

To install Statusnet, you need to go download the latest version. Once completing that, you can transfer the file to the server. (of course, you can download the file direct to the server.) We do everything from the command line to the server when we can.

$ scp statusnet-1.1.1.tar.gz  oeorgan1:~/.

statusnet-1.1.1.tar.gz                        100% 8869KB   4.3MB/s   00:02
$

Now to go to the server to do the install.

eddie@oelt02:~$ ssh oeorgan1

Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-41-generic i686)

* Documentation:  https://help.ubuntu.com/

New release ‘14.04.1 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

Last login: Sat Aug 16 10:34:43 2014 from oelt02.local
$

Is it there?

$ ls statusnet-1.1.1.tar.gz
statusnet-1.1.1.tar.gz
$

Make a directory to work in .

$ makedir statusnet
$ cd statusnet

Expand the archive

/statusnet$  tar zxvf ~/statusnet-1.1.1.tar.gz



statusnet-1.1.1/theme/neo/images/lightbox_bg.png
statusnet-1.1.1/theme/neo/images/lock.png
statusnet-1.1.1/theme/neo/images/lock_open.png
statusnet-1.1.1/theme/neo/images/magnifier.png
statusnet-1.1.1/theme/neo/images/resultset_next.png
statusnet-1.1.1/theme/neo/images/rosette.png
statusnet-1.1.1/theme/neo/images/tick.png
statusnet-1.1.1/theme/neo/logo.png
statusnet-1.1.1/theme/neo/mobilelogo.png
statusnet-1.1.1/theme/neo/theme.ini

/statusnet$statusnet$
/statusnet$ cd statusnet-1.1.1/
/statusnet/statusnet-1.1.1$ ls
actions               doc-src          install.php            plugins
apple-touch-icon.png  EVENTS.txt       js                     PLUGINS.txt
avatar                extlib           lib                    README
background            favicon.ico      lighttpd.conf.example  scripts
classes               file             local                  tests
CONFIGURE             htaccess.sample  locale                 theme
COPYING               index.php        mail-src               UPGRADE
db                    INSTALL          Makefile

Get the instructions to follow

/statusnet/statusnet-1.1.1$ Vim README

Move the extracted directory to the web directory area.

$ sudo mv statusnet-1.1.1/ /var/www/sn
$ sudo apt-get install php5-curl
$ sudo service apache2 restart

Set ownership

chgrp www-data /var/www/sn/
or
$ sudo chown -R www-data:www-data sn

Set file permissions

$ sudo chmod a+w /var/www/sn/

$ sudo  chmod a+w /var/www/statusnet/avatar
$ sudo  chmod a+w /var/www/statusnet/background
$ sudo  chmod a+w /var/www/statusnet/file
or
$ sudo chmod -R 755 sn

Via command line set up mysql
Create a database to hold your microblog data. Something like this
should work:

mysqladmin -u “username” –password=”password” create statusnet

Note that StatusNet must have its own database; you can’t share the
database with another program. You can name it whatever you want,
though.

(If you don’t have shell access to your server, you may need to use
a tool like PHPAdmin to create a database. Check your hosting
service’s documentation for how to create a new MySQL database.)

Create a new database account that StatusNet will use to access the
database. If you have shell access, this will probably work from the
MySQL shell:

GRANT ALL on statusnet.*
TO ‘statusnetuser’@’localhost’
IDENTIFIED BY ‘statusnetpassword';or use phpmyadmin

or use phpmyadmin (requires superuser power)

Be sure to reload privileges before exiting.

Go to the web site and then install setup

Follow instructions:

Log in as an admin and setup the site. Would not hurt to set up a pointer on the menu to the site from your main page.

Have fun!

—————————————————

Sheldon’s favorite: pasta and weenies.

SUNP0020 SUNP0022

Good day.

The Computothoughts.

Leave a comment

Computothought

 

computothought

and introducing Miss Computothought Jr.

Screenshot - 08112014 - 03:46:55 AM

 

They are asking too much.

Leave a comment

Chit chat

———-

Still like to use lpq to check on print queues.

You feel foolish when you have installed applications on a #web server a zillion times, but you make simple mistakes like typing in a url of phpmysql when it should of been phpmyadmin. Been a while, but the app is installed.
#linux
Oldie, but goodie…. #internet   #linux   #mswindows #computers

——————————————————–

Source code for the file permissions application shown a while back.

<html>
<body>

<script type="text/javascript">
<!--
/* chmod helper, Version 1.0
 * by DK of able-design
* Last Modified: recently
*/

function do_chmod(user) {
 var field4 = user + "4";
 var field2 = user + "2";
 var field1 = user + "1";
 var total = "t_" + user;
 var symbolic = "sym_" + user;
 var number = 0;
 var sym_string = "";

 if (document.chmod[field4].checked == true) { number += 4; }
 if (document.chmod[field2].checked == true) { number += 2; }
 if (document.chmod[field1].checked == true) { number += 1; }

 if (document.chmod[field4].checked == true) {
  sym_string += "r";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field2].checked == true) {
  sym_string += "w";
 } else {
  sym_string += "-";
 }
 if (document.chmod[field1].checked == true) {
  sym_string += "x";
 } else {
  sym_string += "-";
 }

 if (number == 0) { number = ""; }
 document.chmod[total].value = number;
 document.chmod[symbolic].value = sym_string;

 document.chmod.t_total.value = document.chmod.t_owner.value + document.chmod.t_group.value + document.chmod.t_other.value;
 document.chmod.sym_total.value = "-" + document.chmod.sym_owner.value + document.chmod.sym_group.value + document.chmod.sym_other.value;
}
//-->
</script>


<form name="chmod" action="">
<table cellpadding="0" cellspacing="0" summary="Chmod calculator"><tr><td width="100%" valign="top"><table width="100%" cellpadding="5" cellspacing="2" border="0" summary=""><tr><td width="100%" bgcolor="#8e97b4" align="center" colspan="5"><font color="#ffffff" size="3"><b>chmod (File Permissions) helper</b></font></td></tr>
 <tr bgcolor="#bcbcbc">
  <td align="left"><b>Permission</b></td>
  <td align="center"><b>Owner</b></td>
  <td align="center"><b>Group</b></td>

  <td align="center"><b>Other</b></td>
  <td bgcolor="#dddddd" rowspan="4"> </td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Read</b> (r = 4)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner4" value="4" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group4" value="4" onclick="do_chmod('group')"></td>

  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other4" value="4" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="left" nowrap><b>Write</b> (w=2)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner2" value="2" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group2" value="2" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other2" value="2" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">

  <td align="left" nowrap><b>Execute</b> (x=1)</td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner1" value="1" onclick="do_chmod('owner')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group1" value="1" onclick="do_chmod('group')"></td>
  <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other1" value="1" onclick="do_chmod('other')"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Octal:</td>
  <td align="center"><input type="text" name="t_owner" value="" size="1"></td>

  <td align="center"><input type="text" name="t_group" value="" size="1"></td>
  <td align="center"><input type="text" name="t_other" value="" size="1"></td>
  <td align="left"><b>=</b> <input type="text" name="t_total" value="" size="3"></td>
 </tr><tr bgcolor="#dddddd">
  <td align="right" nowrap>Symbolic:</td>
  <td align="center"><input type="text" name="sym_owner" value="" size="3"></td>
  <td align="center"><input type="text" name="sym_group" value="" size="3"></td>

  <td align="center"><input type="text" name="sym_other" value="" size="3"></td>
  <td align="left"><b>=</b> <input type="text" name="sym_total" value="" size="10"></td>
 </tr>
</table></td></tr></table>
</form>
</body>
</html>

——————————————————–

Tried to use the famous Kipkay’s method for a sort of megaphone for the pad. Not stable enough. Used tees instead of right angles. Also sealed off the back side of the tees to concentrate sound.

——————————————————–

One of the things I like about a home web server is the ability enhance the capabilities of a touchpad. You can use the server to do all the heavy lifting. In this case cookdojo recipe program is running from the server (where all the data is kept), but allows the touchpad as an interface or thin client. You can easily move the touchpad to another location for some other web based application such as home automation or even a game.

——————————————————–

While back I did an article about doing parabolas. Here is a web page that can help in printing parabola sections.

 

SUNP0008

 

SUNP0010

The code: (use at your own risk)

<!DOCTYPE html>
<html>
<head>
<title>                  Parabola Segments    </title>
<script>
function                 drawPicture(form)
{ var canvas =           document.getElementById('example'); // link to id='example'
  var context =          canvas.getContext('2d');               // create graphic context
  var scale =            350;
  var gain =             1;
  var radius =           1;
  var focal =            form.foc.value; 
  var step =             0.1;
  var Num_seg =          24;
  var a =                1/(4*focal);
  var x0 =               scale*.6;
  var y0 =               scale*2;
  
  var x ,y, dx ,dy,ds,angle,x_g,y_g;
  var s     =              0;
  var x_last=              0;
  var y_last=              0;
  
  
  var X_calc =           new Array(11);
  var Y_calc =           new Array(11);
  var S_calc =           new Array(11);
  

  for                    (i=0; i<=10; i++)                               //Calc Parabola data
{ x =                    step*i;
  y =                    a*x*x;
  dx =                   x-x_last;
  dy =                   y-y_last;
  ds =                   Math.pow(dx*dx+dy*dy,.5);
  s =                    s + ds;
  X_calc[i] =            x;                                              //X_data
  Y_calc[i] =            y;                                              //Y_data
  S_calc[i] =            s;                                              //Surface_data
  angle =                (x/s)*2*Math.PI/Num_seg;
  x_last=                x;
  y_last=                y;
}

  gain =                 1.99/S_calc[10];
  
  context.clearRect(     0,0,scale*2,scale*2);                            //ÊclearÊcanvasÊ
  context.strokeStyle =  "Black"; 
  
  context.beginPath();  
  context.fillStyle =   "rgb( 255, 255, 255)";                         // red, grn, blu
  context.fillRect (     0, 0, scale*2, scale*2);                      // or draw white box
  context.fill();
  
  if                    (form.s1[0].checked)                          //Draw segements?
{ context.moveTo(        x0,   y0);                                   // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  -gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  context.strokeStyle =  "Black"; 
  context.moveTo(        x0,   y0);                                     // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  -gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  -gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  //context.strokeStyle =  "Black"; 
  for                    (j=1; j<=10; j++)
{ angle =                (X_calc[j]/S_calc[j])*2*Math.PI/Num_seg;
  y_g =                  -gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  -gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                                // move to origin 
} context.stroke();
  y_g =                  -gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                  // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  -gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                           // move to origin 
} context.stroke();
}

  x0 =                   scale*1.4;                                      // draw second segment                            
  y0 =                   0;
  context.moveTo(        x0,   y0);                                     // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  context.moveTo(        x0,   y0);                                    // move to origin 
  for                    (i=0; i<=10; i++)
{ angle =                (X_calc[i]/S_calc[i])*2*Math.PI/Num_seg;
  x_g =                  -gain*scale*S_calc[i]*Math.sin(angle);
  y_g =                  gain*scale*S_calc[i]*Math.cos(angle);
  context.lineTo(        x_g + x0,  y_g + y0 );
} context.stroke();
  for                    (j=1; j<=10; j++)
{ angle =                (X_calc[j]/S_calc[j])*2*Math.PI/Num_seg;
  y_g =                  gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                         // move to origin 
} context.stroke();
  y_g =                  gain*scale*S_calc[j];
  context.moveTo(        x0,  y_g + y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*S_calc[j]*Math.sin(angle*i/10);
  y_g =                  gain*scale*S_calc[j]*Math.cos(angle*i/10);
  context.lineTo(        x_g + x0,  y_g + y0);                         // move to origin 
} context.stroke();
}
}


if                       (form.s1[1].checked)                             // draw left side
{ x0 =                   50;
  y0 =                   scale*2-100;
  context.moveTo(        x0,   y0); 
  for                    (i=0; i<=10; i++)
{ x_g =                  gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[i];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[0];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  y_g =                  -gain*scale*Y_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   gain*scale*X_calc[0];
  y_g =                  -gain*scale*Y_calc[i];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  x_g =                  gain*scale*X_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
}    



if                       (form.s1[2].checked)                             // draw left side
{ x0 =                   2*scale-50;
  y0 =                   scale*2-100;
  context.moveTo(        x0,   y0); 
  for                    (i=0; i<=10; i++)
{ x_g =                  -gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[i];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   -gain*scale*X_calc[i];
  y_g =                  -gain*scale*Y_calc[0];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  y_g =                  -gain*scale*Y_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
  for                    (i=0; i<=10; i++)
{ x_g =                   -gain*scale*X_calc[0];
  y_g =                  -gain*scale*Y_calc[i];
  context.moveTo(        x_g + x0,  y_g + y0);                            // move to origin 
  x_g =                  -gain*scale*X_calc[10];
  context.lineTo(        x_g + x0,  y_g + y0);                            // move to origin 
} context.stroke();
}    
    
  context.closePath();  
    
 // form.REC.value  =      form.REC.value +"S_calc[i]"+S_calc[10]+" \n" ;
  
}
</script>

<style                   type = "text/css">
canvas {                 border: 2px solid gray; }           
</style>

</head>
<body> 

<h1>Parabola 1/12 Segments or Sides </h1>
<form >
<input type=text size = "10" value=".5" name="foc" onkeypress="drawPicture(this.form)">
=>Define a parabola focal point =>
<input type=button value="Plot_it" onClick="drawPicture(this.form)">
<input type="radio" Name=s1 checked="checked"  Value = "Seg" />     segments</label>
<input type="radio" Name=s1                    Value = "LSide"  /> <label for="sidecheck"> Left Side</label>
<input type="radio" Name=s1                    Value = "RSide"  /> <label for="sidecheck"> Right Ride</label>
<p> 
<canvas  id   =         "example" width="700" height="700">   </canvas> <br>
</form>

</body>
</html>

12 

3 4

6 5
Other code to look at: (This will help you to calculate the focal point. .5 gives a focal point
within the parabola. I think I used 1.9 for focal point away from the parabola to work better
 as a solar oven.

<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>                  Plot A Parabola      </title>
<script>
function                 drawPicture(form)
{ var canvas =           document.getElementById('example'); // link to id='example'
  var context =          canvas.getContext('2d');               // create graphic context
  var scale =            300;
  var radius =           1;
  var focal = form.foc.value; 
  
  var step =             0.1;
  var a =                1/(4*focal);
  var x0 =               scale;
  var y0 =               scale*2;
  
  
  context.clearRect( 0,0,scale*2,scale*2); //ÊclearÊcanvasÊ

  context.strokeStyle =  "yellow";                              // set stroke to red
  context.beginPath();                                          // new geometry
  context.moveTo(        x0,   y0);                             // move to origin
  context.lineTo(        x0,   -scale*2 + y0 );                 // second point
  context.stroke();
  context.moveTo(        x0-scale,   -scale+ y0 );              // move to origin
  context.lineTo(        x0+scale,   -scale+ y0 );              // second point
  context.stroke();
  
  context.closePath();                                          // end geo

  context.fillStyle =   "rgb( 0, 255, 0)";                      // red, grn, blu

  context.strokeStyle =  "Black"; 
  context.beginPath();                                          // new geometry
  context.moveTo(        x0,   y0);                                // move to origin 
  for                    (i=0; i<=10; i++)
{ var x  =               i*step;
  var y  =               -a*x*x;
  context.lineTo(        scale*x + x0,  scale*y + y0 );           // second point
} context.stroke();                                                // stroke lines

  context.moveTo(        x0,   y0);                                 // move to origin 
  for                    (i=0; i<=10; i++)
{ var x  =              -i*step;
  var y  =              -a*x*x;
  context.lineTo(       scale*x + x0,  scale*y + y0 );             // second point
} context.stroke();                                                // stroke lines
  
  context.moveTo(       x0,   -scale*focal + y0 +5);               // move to focus 
  context.lineTo(       x0,   -scale*focal + y0 -5);               // plot focus 
  context.stroke();
  
  context.moveTo(       x0 +5, -scale*focal + y0 );                // move to focus 
  context.lineTo(       x0 -5, -scale*focal + y0 );                // plot focus 
  context.stroke();

  
  context.font =         "10px Times New Roman";                 // set font
  context.fillStyle =    "Black";                                // define fill using "black"
  context.fillText(      "-1", 10, 2*scale);                     // write "Sample String"  
  context.fillText(      "0",  scale, 2*scale);              // write "Sample String"  
  context.fillText(      "1",  1.97*scale, 2*scale);              // write "Sample String" 
  context.fillText(      "1",  1.97*scale, 1*scale);              // write "Sample String" 
  context.fillText(      "2",  1.97*scale, 10);              // write "Sample String" 
  context.fillText(      "focus",  x0-10, -scale*focal + y0 -10);              // write "Sample String" 


  
}
</script>

<style type="text/css">
canvas {                 border: 2px solid violet; }           
</style>

</head>
<body> 

<h1>Plot a Parabola With A +/-Unity Radius </h1>

<br>
<form>
<input size="10" value=".5" name="foc" onkeypress="drawPicture(this.form)" type="text">
=&gt;Define a parabola focal point =&gt;
<input value="Plot_it" onclick="drawPicture(this.form)" type="button">
<p>    
</p></form>

<canvas id="example" width="600" height="600"> 
</canvas> <br>
Radius is set to +/- 300 points.....A Parabola follows the equation  y = x^2/(4*focal)


</body></html>

——————————————————–

Fake #beer for those of us who do not drink.

Good day.

Quickie post.

Leave a comment

Chit chat

———-

In sympathy with Germany, I am getting out my old typewriter.

——————————————————–

Batch file to slowly print out a text file. Perfect for a quickie teleprompter.

——————————————————–

Did you know that you can use the thermistor from a personal computer fan to tell relative temperature?

 

——————————————————–

Normally I probably would not put something like this in the blog. But the more I thought about it, the more I thought it might fit. Like many people who work late at night, you do not want to disturb anyone while building projects. One tool that is very noisy is a drill. There had to be a better way, I looked for an auger in all the stores, but none were to be found except by mail order. Since I make a lot of things, why not make a sort of auger for light projects that would be quiet in use. That is when I came up with a pvc drill. It could always be used a toy for a child in any case.

The hardest thing to possibly implement is a chuck, Was not sure what I was going to do. Happened to be in Harbor Frieght and they actually had one on the shelf. It was reasonable enough, so I purchased one.  You can actually get chucks separately. Then I was on my way to completing the project.More on the project at:
http://www.instructables.com/id/Pvc-Hand-drill/

——————————————————–

Translating from one batch file system to another can be Interesting. Someone wrote a batch file for emulate a menu that could of been a bit more precise for dos, but I decided to translate it to bash.

Dos:

@echo off
color 0e
Title Website Starter (by Prof. Pickle)
:Menu
cls
echo ---------------------------------------------------------------------
echo This is the Website starter
echo.
echo Select the number of the website you wish to select
echo Or press E to exit.
echo ---------------------------------------------------------------------
echo.
echo.
echo 1. facebook
echo 2. youtube
echo 3. google
echo 4. redtube
echo 5. other
set /p web=
If %web% EQU 1 start www.facebook.com
If %web% EQU 1 goto Menu
If %web% EQU 2 start www.youtube.com
If %web% EQU 2 goto Menu
If %web% EQU 3 start www.google.com
If %web% EQU 3 goto Menu
If %web% EQU 4 start www.redtube.com
If %web% EQU 4 goto Menu
If %web% EQU 5 goto other
If %ERRORLEVEL% NEQ 0 goto ERROR
If %web% EQU E goto exit
If %web% EQU e goto exit
goto please
:other
cls
echo You have chosen other
echo.
echo Type the web address of the website (www.website.com)
set /p otherweb=
start %otherweb%
If %ERRORLEVEL% NEQ 0 goto ERROR
:exit
cls
echo Goodbye!
pause > nul
exit
:ERROR
cls
echo Sorry, an error has occurred.
echo.
echo If you were using the "other website" function you may have
echo typed it incorrectly.
echo.
echo Press any key to go back to menu
pause > nul
goto Menu
:please
cls
echo Please press a number from 1-5
echo.
pause
goto Menu

Sure the author worked really hard on it. then I thought how would I do a quick equivalent using bash. To be fair his batch code could of been improved with a while loop.  This is what I came up with:

Bash:
#!/bin/bash
#
# Script to run firefox and load a specific site.
#
while :
do
clear
echo "************************"
echo "* My website loader    *"
echo "************************"
echo "* [1] Facebook         *"
echo "* [2] Google           *"
echo "* [3] Twitter          *"
echo "* [4] Youtube          *"
echo "* [5] Some other site  *"
echo "*                      *"
echo "* [0] Exit/Stop        *"
echo "************************"
echo -n "Enter your menu choice [1-5, or 0]: "
read yourch
case $yourch in
1)  firefox http://www.facebook.com & ;;
2)  firefox http://www.google.com & ;;
3)  firefox http://www.twitter.com & ;;
4)  firefox http://www.youtube.com & ;;
5) echo  ; read -p "Enter website: " ws ; firefox $ws & ;;
0) exit 0;;
*) echo "Oopps!!! Please select choice 1,2,3, 4 or 5";
echo "Press Enter to continue. . ." ; read ;;
esac
done

Which generates a screen something like this.
************************
* My website loader    *
************************
* [1] Facebook         *
* [2] Google           *
* [3] Twitter          *
* [4] Youtube          *
* [5] Some other site  *
*                      *
* [0] Exit/Stop        *
************************
Enter your menu choice [1-5, or 0]: 

——————————————————–

The original teleprompter setup was a bit bulky, but works best for me. Decided to come up with a simpler setup that only required one reflector.

But with this unit you need to have reversed text displayed. No problem.

Create text in OfficeWriter.
Export text to a pdf file i.e. test.pdf

Get software.
$ sudo apt-get pdfjam
Reverse the pdf facing.
$ pdffip test.pdf
which generates test-flipped.pdf.

Show the file in your document viewer and do your video.
You will probably have more text that what I used.

——————————————————–

Got milk?

SUNP0006

Good day.

Augusto.

Leave a comment

Chit chat

———–

Some of us in IT have spent a lot of hours and expense getting educated. Some also have a lot of practical experience. IT people are more than just Googlers. In the corporate environment, IT spend a lot of time setting machines up. To have users try to repair a setup could do more damage than good.

#God is a single #father. No wonder he does not have time to fix all the problems.

Play on “Once I built a railroad”:

Once I built a network,

Made it run.

Made it race against time.

Once I built a network,

and now it’s done,

Brother can you spare a paradigm.

 

Tuxpaint import

$ tuxpaint-import [filename.ext]

—————————————————————

Protect your usb device from being hacked when you need a charge with a usb rubber.

—————————————————————

Did you know that you can use the thermistor from a personal computer fan to tell relative temperature?

 

images

—————————————————————

Sharks Cove board with Intel Atom CPU targeted at Windows developers.

One really thinks this is aimed at the Raspberry Pi/Arduino market. But at $300 dollars, who is really going to choose it. Microsoft  has a tradition of not supporting speciality products for any period of time. Zune and etc etc etc. Even if it was worth it I would shy away from it. Ironically you can take a pico motherboard and dc-dc power supply and in effect have the same thing for a fraction of the cost.

Now if you really want to get inane on this, I will take my old 486 laptop and add all kinds of breakout cables to do quite a bit. Parallel, serial,  vga, and etc. The 486 laptop was free. Cables did have some cost to them, but no where near $300. If you know anything about electronics, a “1” is plus five volts and a “0” is near zero volts. That is true for the Raspberry Pi, Arduino, personal computers, and a zillion developer boards. Not all interfaces will be using digital, but you get the idea.

Run my robot on an old Pentium 1 with linux as the os. With a laptop or most any standard legacy machine you can add a variety of interfaces:

Parallel
http://www.instructables.com/id/No-solder-parallel-port-break-out/

Serial
http://www.instructables.com/id/DB9-serial-break-out-cable/

Vga
http://www.instructables.com/id/Vga-breakout-cable/

Plus others such as usb. Also consider:
http://www.instructables.com/id/Electronic-Guides/

It’s your choice!

—————————————————————

Old electronics can yield quite a lot of good equipment. For example an old 5 1/4″ drive can yield stepper motors. You just saved twenty dollars.

—————————————————————

Many people have created tutorials on http://www.instructables.com. To see how each instructable is doing can be a chore. Devised a bash script to help conquer that chore. Though may not be the latest, it certainly shows viable trends. You can also import the data into a spreadsheet rather easily.

First you will want to create a text file with the instructables you want to follow.
One url to a line.

http://www.instructables.com/id/Line-editor-template/

You may need to install a program or two such as elinks and zenity so things will work. Then you will want to create an executable of the file to collect the data.

#================================
#
#  Instructables numbers catcher
#
#=================================
# Assignments
# ——————————–
szAnswer=$(zenity –file-selection –title=”Select a iurl file to read”)
datafile=$szAnswer
outfile=”inumdata”
total=0
# the date
tmon=$(date +”%b”)
tday=$(date +”%d”)
echo  “The views for $dj on $tmon $tday:” > $outfile
#=================================
#
# Data input
#———————————
while read line
do theurl=$line
echo  “$theurl”
# echo -n “$theurl'” >> $outfile
# get total views
# count=$(elinks  “$theurl” | grep -m 1 “hits-count” | sed ‘s/[^0-9]*//g’)
count=$(elinks  “$theurl” | grep -m 1 “views” | sed ‘s/[^0-9]*//g’)
# let total=$total+$count
echo “$count” >> $outfile
done < $datafile
# echo “total: $total” >> $outfile
zenity –text-info –filename=$outfile

Then it is a matter of running the script.

Just copy and paste the data into the spreadsheet.

—————————————————————

Sometimes wifi is just not required.

BHbFznGCcAEOomD.jpg:large

—————————————————————

Easy food conversion calculator

Screenshot from 2014-08-03 11:58:21

Code is available.

Good day.

 

Hotter than…

Leave a comment

Chit chat

———–

Allowing M$ into the linux foundation upsets me to no end.

Hello everybody out there using minix, linux, bsd, or etc -

I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 32 bit machines. This has been brewing since January, and is starting to get ready. I’d like any feedback on things people like/dislike in ‘nix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). Building it using assembly language.

I’ve currently ported several programs, and things seem to work. This implies that I’ll get something practical within a few months or so, and I’d like to know what features most people would want. Any suggestions are welcome, but I won’t promise I’ll implement them :-)

PS. Yes – it’s free of any ‘nix code, and it has a special fs. It is NOT portable (uses our own task switching etc), and it probably never will support anything other than traditional 32 bit equipment, as that’s all I have :-(.

———————————————————————–

 

Picture of Linux setup for SSH password less login.

 

Screenshot-Untitled Window.png

 

There are many times when I do not want to always keep typing in passwords to log into local servers. Not only that, I do not want to be typing passwords when people are watching.  If you run a primarily linux network like I do then this can be a real boon to your use of the systems not to have to do the traditional login. So we will need a way to authenticate to the systems we want to use..There was traditionally two kinds of authentication. RSA and DSA. RSA should not be used any more.  Public key authentication can only be established on a per system / user basis only i.e. it is not system wide. You will be setting up ssh with DSA public key authentication for SSH version 2 on two machines.Note: you will need to be able to use the command line/terminal for this project.Note: For both the server and the client port 22 should be changed to some number above 1024 that is an unused port.  Both numbers must be the same unless you are an advanced user,  Other settings should be changed as well. (i.e. disable root access)$ sudo vim /etc/ssh/sshd_config# Package generated configuration file
# See the sshd_config(5) manpage for details# What ports, IPs and protocols we listen for
Port 22The nmap command is a good way remotely to determine what ports are being used. You may like this instructable also:  http://www.instructables.com/id/Linux-screen-play/

Step 1: What do you need?
#1 machine : Client machine with ssh installed$ sudo apt-get update
$ sudo apt-get install ssh#2 machine: A remote server with ssh and openssh-server$ sudo apt-get update
$ sudo apt-get install ssh
openssh-serverNote: I usually add openssh-server to all machines except those I do not want there to be ssh access.

Step 2: Settin up the keys.

Picture of Settin up the keys.

 

Step #1: Generate DSA Key Pair

Use ssh-keygen command as follows:
$ ssh-keygen -t dsa
Output:

Enter file in which to save the key (/home/usernane/.ssh/id_dsa):  Press [Enter] key
Enter passphrase (empty for no passphrase): myPassword
Enter same passphrase again: myPassword
Your identification has been saved in /home/username/.ssh/id_dsa.
Your public key has been saved in /home/username/.ssh/id_dsa.pub.
The key fingerprint is:
04:be:15:ca:1d:0a:1e:e2:a7:e5:de:98:4f:b1:a6:01 username@username-desktop

Caution: a) Please enter a passphrase different from your account password and confirm the same.
b) The public key is written to /home/you/.ssh/id_dsa.pub.
c) The private key is written to /home/you/.ssh/id_dsa.
d) It is important you never-ever give out your private key.


Step 3: Directory set up and key copy to server.

Picture of Directory set up and key copy to server.

 

Set directory permission Next make sure you have correct permission on .ssh directory:
$ cd
$ chmod 700 .ssh
Update note: Must have been thinking about wev serverdirectory  permissions 755 s/b 700.t

Typically you want the .ssh directory permissions to be 700 (drwx——) and the public key (.pub file) to be 644 (-rw-r–r–). Your private key (id_rsa) should be 600 (-rw——-).

Copy public key.

Now copy file ~/.ssh/id_dsa.pub on Machine #1 (tom) to remote server as ~/.ssh/authorized_keys. The command scp is an ssh based  network file copy command and it will copy your public key file in this step. (you will be asked your your password on the server to log in.
$ scp ~/.ssh/id_dsa.pub user@server:.ssh/authorized_keysNote: You can get to the calculator from here:
http://www.onlineconversion.com/html_chmod_calculator.htm

Step 4: Server Side.

Picture of Server Side.

 

Now that you have the public key copied over to the server, you need to move it to the right place.
What you just did frim the client machine.$ scp ~/.ssh/id_dsa.pub user@bennjerrys:.ssh/authorized_keysWarning: If you already have an authorized_keys file this will write over it. (safer way)From client machine
$ scp ~/.ssh/id_dsa.pub user@bennjerrys:.
Server side.
$ cat
id_dsa.pub >> .ssh/authorized_keysChange permissions so only you can see and access it.$ chmod 600 ~/.ssh/authorized_keysNote: An authorized_key file (no “s” at the end)  is for the old rsa keys.

Step 5: Back to the client.

Picture of Back to the client.

 

So you do not have to enter in a passphrase:Type the following command at shell prompt:
$ exec /usr/bin/ssh-agent $SHELL
$ ssh-add

Step 6: Loggin in.

Picture of Loggin in.

 

Screenshot-- on oesrvr1 - File Browser.png

 

From the command line you could use:$ ssh user@servernameor$ ssh user@remote-server.comor$ scp file user@servername:/tmpNow if you try to logon in from the client to get to a share, you should not get a second password window.
Screenshot-eddie@oesrvr1.comcast.net: ~-3.png

Tada!!


Step 7: Advanced.

Picture of Advanced.

 

Almost forgot about this script:

<pre class="brush: plain;">#!/bin/bash
#
## USAGE: add_to_server.sh remote_server
#
## This script will add your ssh dsa public key to remote_server's authorized_keys list,
## assuming that everything is in it's default location
#
set -v     # verbose output
username="USERNAME"  # CHANGE ME!!!!
remote_server=$1  # assigns the first commandline argument to $remote_server
#
#
## Pipe the public key to ssh, then remotely touch the file to make sure it will be there, and concat to the end of it.
## Might work without the touch?
cat ~/.ssh/id_dsa.pub | ssh ${username}@${remote_server} "touch ~/.ssh/authorized_keys &amp;amp;&amp;amp; cat - &amp;gt;&amp;gt; ~/.ssh/authorized_keys"
#
exit 0

Step 8:

Picture of

 

One of the things most people hate to do is to type in passwords. Not only could someone be looking over your shoulder, but also the password gets sent where it can be easily monitored. There has to be a better way. A method very much used on ‘nix systems (including OS/X) is called the ‘secure shell’ (ssh for short). You can actually use it on Microsoft systems also, but it requires more than usual extra setup.
$ ssh typo1
password: _
Anyway, if you are setting up a new system and or recovering from a hard disk crash, setting up the ssh keys to all the servers or systems you log into can be a lot of fun. There had to be a way of automating this process.  The process is usually just three steps. Copy your key to the new server, adding the key to the authorized_key files, and then lastly removing the copied key if need be. So let’s make a batch file to take care of this.Installkey.sh

# invoke with ./Installkey.sh servername
# copy the key
scp .ssh/id_dsa.pub $1:~/.
# install the key
ssh $1 'cat id_dsa.pub &gt;&gt; .ssh/authorized_keys'
# remove the public key you just copied
ssh $1 'rm ~/id_dsa.pub'

Save it to an ascii file.
Enable the shell file
$ chmod +x  Installkey.sh

Run the code:

$ ./Installkey.sh typo1

Now you should be able to log into the server without typing a password.

$ ssh typo1
Linux typo1 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 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.
Debian comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

/)
o                 /’ )
/’   (                          ,.
__/’     )                        .’ `;
o      _.-~~~~’          “—..__             .’   ;
_.–‘  b)                       “–…____.’   .’
(     _.      )).      `-._                     <
`\|\|\|\|)-…..___.-     `-.         __…–‘-.’.
`—……____…—`.___.’—-… .’         `.;
`-`             `

This machine is for the exclusive use of OE.
Anyone attempting to gain, or gaining access other
than as specifically authorized will be prosecuted
under all applicable statutes plus all applicable
civil rules for damages.

————————————————————————
You have mail.
Last login: Sun Aug 19 05:15:37 2012 from oedt01
$ _

But then I thought, what I need to do a bunch of servers, even that could be tedious. So let’s add some more code. First we need to make a list of the servers we want to update and save them to a file.

servers:
[data]
typo1
oesrvr1

[/data]

Now we need to use the original code and add a routine to read the server names from a file. That allows us to just type in one command and do all the servers. If we need to add a new server to the list, you just add it to the servers file. One bit of caution is that if you have run the program before, you do not need to do it again on prepared servers. Rename the existing servers file and start a new servers file.

srvrsshupdate.sh:

####################################
# Update remote ssh server keys
# by the sysadmin
# date: 08/19/2012
#=================================
# Assignments
# --------------------------------
# servers has list of servers to update (s/b 1 server name per line)
servernamefile="servers"
# end assignments
#=================================
#
# Just do it. (main loop)
#---------------------------------
while read line
do server= $line
scp .ssh/id_dsa.pub $server:~/.
ssh $server 'cat id_dsa.pub &gt;&gt; .ssh/authorized_keys'
ssh $server 'rm ~/id_dsa.pub'
done &lt; $servernamefile
# end of main loop
#==================================
# End of job
###################################

Alternative code:


# invoke with ./Installkey.sh servername

# set up the .ssh dir if it does not exists
DIRECTORY=",ssh"
ssh $1 'if [ ! -d "$DIRECTORY" ];&nbsp; then&nbsp; mkdir $DIRECTORY ;chmod 700 $DIRECTORY ; fi'

# copy the key
scp $DIRECTORY/id_dsa.pub $1:~/.

# install the key
ssh $1 'cat id_dsa.pub &gt;&gt; $DIRECTORY/authorized_keys'
ssh $1 'chmod 600 $DIRECTORY/authorized_keys '

# remove the public key you just copied
ssh $1 'rm ~/id_dsa.pub'

Enable
$ chmod +x srvrsshupdate.sh
Run it
$ srvrsshupdate.shMy desktop bit the dust  I decieded to put a new install of linux (Debian replaced Ubuntu.) You really should not use old ssh keys, so I regenerated a new key and proceeded to update all the servers.

Step 9.

Picture of

 

One of the things I use so much that I tend to forget about is running command remotely. For example I want to start up a lighting sequence on a remote machine it can be as simpple/ Do that can be as ssh servername “commandinquotes”

$ ssh oesrvr1 “kitt”

 ——————————————————————

Vga cards are slowly being replaced by HDMI interfaces. What a lot of people do not know is that some vga cards come with a special port that allows us to attach devices known as i2c (I squared c) to the vga cards. That allows a personal computer to be attached to a host of devices from all kinds of sensors to other input devices. In fact you can connect Arduinos and other microprocessors to the vga port. Since most traditional personal computer motherboards allow the attachment of more than one vga card to the system, that allows for some interesting setups.

Data is sent and received over two wires (aka serial) to make interfacing rather easy.  Temperature sensors can be interfaced to the vga ports to detect dangerous sutuations insde and outside servers or other valuable equipment. The SDA and SCL connections are the key points of interaction.

If we can connect sensor devices to the vga port, they we can go one step further and add microprocessors to control other devices. One such device that might be used is the ever popular Arduino. At the retail level, most Arduinos are sold on an interface board, but you can also use them as standalone chips. Now legacy personal computers are infinitely more valuable for the time being with the added power of the microprocessors.
There is enough information on the Arduino, that I should not have to elaborate here, The sky is the limit. What’s your next project?
——————————————————————

Simple usb charger. try at your own risk,

——————————————————————

Simple blinker or flasher. No fancy ic’s (integrated circuits) are required.

Transistor: (NPN)
2n3904

For an alternate light blinker (like at a railroad crossing) you might try:

 

——————————————————————

Parcon is a neat little program that when used with sudo or the  like can control the data lines on the parallel port to turn on and off an led or other equipment using proper circuitry. (5 volts only otherwise)

Youtube video

https://www.youtube.com/watch?v=BlCHGiG_CQM

Parallel port.

pin 2 – data line 1  D0   –led–resistor— pin 18
pin 3 – data line 2  D1    “
pin 4 – data line 3  D2    “
pin 5 – data line 4  D3    “
pin 6 – data line 5  D4    “
pin 7 – data line 6  D5    “
pin 8 – data line 7  D6    “
pin 9 – data line 8  D7    “
pin 18 – ground

To compile:
$ gcc parcon.c -o parcon

To run (l is off and h is on.)
$ sudo parcon 1l 2l 3h 5h 8l

Turns off pins 1,2, and 8. Tuns on pins 3 and 5/

parcon.c ( you will have to trim out the html code. I will try to fix it later.)

#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;sys/io.h&gt;

char *binprint( unsigned char x, char *buf )
{
&nbsp; int i;
&nbsp; for( i=0; i&lt;8; i++ )
&nbsp;&nbsp;&nbsp; buf[7-i]=(x&amp;(1&lt;&lt;i))?'1':'0';
&nbsp; buf[8]=0;
&nbsp; return buf;
}

int main( int argc, char *argv[] )
{
&nbsp; char c;
&nbsp; unsigned char val;
&nbsp; char buf[9];
&nbsp; int x;
&nbsp; if( argc&lt;2 )
&nbsp; {
&nbsp;&nbsp;&nbsp; printf("&nbsp; example usage: parcon 1l 2l 3h 5h 8l\n");
&nbsp;&nbsp;&nbsp; return 2;
&nbsp; }
&nbsp; if( ioperm(888,1,1) )
&nbsp; {
&nbsp;&nbsp;&nbsp; printf("Couldn't get port 888\n");
&nbsp;&nbsp;&nbsp; return 1;
&nbsp; }
&nbsp; val = inb(888);
&nbsp; printf("old = %s\n",binprint(val,buf));
&nbsp; for( x=1; x&lt;argc; x++ )
&nbsp;&nbsp;&nbsp; if( argv[x][1]!='h' )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val &amp;= ~(1&lt;&lt;(argv[x][0]-'1'));
&nbsp;&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; val |= 1&lt;&lt;(argv[x][0]-'1');
&nbsp;
&nbsp; printf("new = %s\n",binprint(val,buf));
&nbsp; outb(val,888);
&nbsp; return 0;
}

——————————————————————

Savory  crespelle.

P000-259-318-642-c3022

Good day.

Thank god, the a/c was fixed.

Leave a comment

Chit chat

———-

Happy system administrator day,

———————————————-

The basis of this article  is based on the dialog from the movie known as “The hunt for the Red October”. In the movie, one of the key lines was I think “One ping and one ping only”. Pinging was a method by submarines equipped with sonar to detect what is around them. Normally you would use more than one ping. In computing we also have a program called ping that does the same thing to detect what is around on the network. There is a very powerful program called nmap that usually automates such activity. That usually takes some kind of administrative power to implement. We will be using a simple linux batch file (could be easily converted to other platforms) to detect what is around us. This tool is perfect for the home network. It will probably not detect what is known as “Man in the middle devices”, but at least you can see the visible systems on your network.Note a quick way to see who has been active on the network with you is to ping your netmask:
for a 192.168.1.x network$ ping -c 2 -b 192.168.1.0$ sudo arp -aThe code.
pingall.sh: (do not forget “chmod +x pingall.sh)

for i in {1..254}
do
ping 192.168.1.$i -c1 -w1 -v | grep "icmp_seq=1"
done

If you have a different network, you will have to change “192.168.1” accordingly, here again we are using the good old “grep” command to extract data from the return stream. it is our sonar scope. Let’s run it.

$ ./pingall.sh
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.852 ms
64 bytes from 192.168.1.31: icmp_seq=1 ttl=64 time=0.260 ms
64 bytes from 192.168.1.99: icmp_seq=1 ttl=255 time=2.75 ms
64 bytes from 192.168.1.109: icmp_seq=1 ttl=64 time=0.261 ms
64 bytes from 192.168.1.115: icmp_seq=1 ttl=64 time=0.064 ms
$ _

Ok, there are five devices on the network. We need to know more. There is what is call DNS or “Domain naming service”. We can use the router to tell us what the ipaddresses maybe are known as.

The code.

nslookup.sh: (Do not forget to make it executable with chmod +x nslookup.sh”)

for i in {1..254}
do
nslookup 192.168.1.$i |grep name
done

Let’s run it.
$ ./nslookup.sh
1.1.168.192.in-addr.arpa name = my_network.
10.1.168.192.in-addr.arpa name = router2.
20.1.168.192.in-addr.arpa name = router3.
31.1.168.192.in-addr.arpa name = oesrvr1.
115.1.168.192.in-addr.arpa name = oesrvr104
$_

Notice the ipadresses are backwards, but we still can identify units on the network from the list. Two devices show up known as router2 and router3. I know that they are not connected to the network at this time. They just have reserved names in the router. The unit at 99 is actually the print server and should have a reserved name in the router, I can take care of that later. 109 is a temp machine I have set up to test some software. Now if there were any unknown numbers, they would need to be investigated immediately. Again you would need to change “192.168.1.” to work with your network.

There you are, two simple tools to check on your network.

Update:
Yet another way to look at the network.

$ for d in {1..255} ;do rev=$( dig +short -x 192.168.1.$d ) ; echo “$d $rev” ; done

Miscellaneous:

See if the website is alive.

$ ping missingwebsite.com

$ ping http://www.instructables.com
PING prod.fastly.net (199.102.47.72) 56(84) bytes of data.
64 bytes from 199.102.47.72: icmp_seq=1 ttl=45 time=51.5 ms
64 bytes from 199.102.47.72: icmp_seq=2 ttl=45 time=50.1 ms
^C64 bytes from 199.102.47.72: icmp_seq=3 ttl=45 time=49.0 ms

— prod.fastly.net ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 10162ms
rtt min/avg/max/mdev = 49.092/50.269/51.552/1.007 ms

Find out if just the internet tubes are down by stepping through all the internet routers.

$ traceroute missingwebsite.com



9  te0-0-0-3.ccr21.dfw01.atlas.cogentco.com (154.54.7.45)  39.589 ms te0-0-0-4.ccr21.dfw01.atlas.cogentco.com (154.54.6.57)  41.533 ms te0-1-0-4.ccr21.dfw01.atlas.cogentco.com (154.54.6.65)  42.982 ms
10  te0-1-0-1.ccr21.mci01.atlas.cogentco.com (154.54.46.201)  44.677 ms te0-2-0-3.ccr21.mci01.atlas.cogentco.com (154.54.5.170)  46.383 ms te0-0-0-1.ccr21.mci01.atlas.cogentco.com (154.54.46.185)  48.315 ms
11  te0-3-0-2.ccr21.ord01.atlas.cogentco.com (154.54.2.190)  49.768 ms  51.418 ms  52.621 ms
12  te3-8.ccr01.dsm01.atlas.cogentco.com (154.54.0.78)  44.561 ms  46.309 ms  47.732 ms
13  38.104.184.50 (38.104.184.50)  54.185 ms  55.582 ms  49.107 ms
14  edge5-usshc.wikia.net (208.68.167.146)  50.457 ms  52.333 ms  53.778 ms
15  199.102.47.58 (199.102.47.58)  55.999 ms  57.643 ms  59.092 ms
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *^C

Routers are playing possum when you see the asterisks.

Domain name servers can help also.

$ dig missingwebsite.com

$ dig http://www.instructables.com

; <<>> DiG 9.7.0-P1 <<>> http://www.instructables.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40751
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.instructables.com.        IN    A

;; ANSWER SECTION:
http://www.instructables.com.    2177    IN    CNAME    a.prod.fastly.net.
a.prod.fastly.net.    22832    IN    CNAME    prod.fastly.net.
prod.fastly.net.    16    IN    A    199.102.47.72
prod.fastly.net.    16    IN    A    199.102.47.71

;; Query time: 14 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Mon Nov 21 21:14:36 2011
;; MSG SIZE  rcvd: 116

$ nslookup mussingwebsite.com

$ nslookup http://www.instructables.com
Server:        1.1.1.1
Address:    1.1.1.1#20120548

Non-authoritative answer:
http://www.instructables.com    canonical name = a.prod.fastly.net.
a.prod.fastly.net    canonical name = prod.fastly.net.
Name:    prod.fastly.net
Address: 199.102.47.71
Name:    prod.fastly.net
Address: 199.102.47.72

pingall.sh improved (you should be able to pick the network now.  i.e.: pingall.sh 2

if [ -z "$1" ]
then
let n=1
else
let n=$1
fi
echo “You are using network $n.”

for i in {1..254}
do
ping 192.168.$n.$i -c1 -w1 -v | grep “icmp_seq=1″
done

nslookup improved:
if [ -z "$1" ]
then
let n=1
else
let n=$1
fi
echo “You are using network $n.” for i in {1..254}
do
nslookup 192.168.$n.$i |grep name
done

—————————————————————————–
Extra:

Simple port scan
Usage portscan.sh host 1stport lastport

$ ./portscan.sh  oesrvr1  1  1024
“22 open”
“25 open”
“80 open”
“110 open”
“111 open”
“143 open”
“993 open”
“995 open”

#!/bin/bash

IP=$1
firstport=$2
lastport=$3

function portscan

{
for ((counter=$firstport; counter<=$lastport; counter++))

do
(echo >/dev/tcp/$IP/$counter) > /dev/null 2>&1 && echo “$counter open”
done
}

portscan

# end of code

 

One neat command is arp-scan, but it requires admin rights.

$ sudo arp-scan  –localnet
[sudo] password for eddie:
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.1.1    00:00:00:00:00:00    Buffalo Inc.
192.168.1.32    00:00:00:00:00:00    DELL COMPUTER CORPORATION
192.168.1.99    00:00:00:00:00:00    Cellvision Systems, Inc.

3 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 1.741 seconds (147.04 hosts/sec). 3 responded
$

————————————————————–

You can also access a linux server and show the desktop on a tablet.

P000-313-256-398-d0020

————————————————————–

Sauted chicken thighs, cheese infused polenta, and green beans.

SUNP0001

Good day.

Older Entries

Follow

Get every new post delivered to your Inbox.