Chit chat

———-

There was a post that wanted everyone to learn programming and of course I had to chime in:  What people do not tell you is that you really need at least two disciplines., The IT part if course, but you also need to know the industry you are going to code for. How can you develop an accounting program if you do not have a clue about debits and credits.  You also need common sense and how to piece things together. Many people have said that musicians can make for good programmers.One thing that people forget is that they think all your need are  programmers,. There has to be someone among others to do systems analysis of a project before programming is ever done. Hardware, software, people, procedures, and data have to be coordinated.  Wonder if any systems analysis was done on the Obamacare website?

We have replaced youtube-dl yourtubeurl -f 34 with youtube-dl youtubeirl -f flv

Sometimes I will save videos about equipment I do not own in case I ever have a chance to get such equipment. i.e. linux on a tablet.

Decided to  experment a little bit. Pretended to be blind and took a debian network boot cd  and inserted it into a machine with the monitor turned off to see if I could do a sightless install. Debian does have a audio based screen reader.There was not as much help as there should have been. Probably would recommend some improvements..

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

Installed arch linux on an i686 (aka pentium II). Installed linux many a time, but this is a new experience using arch as an os on a desktop. One thing that was different was to use the secure shell to remotely connect to the install machine. That way I could cut and paste commands as needed and save a lot of typing. There were some issues, that really were not issues. Had to use a search engine to rectify things I did not understand. Allegedly the live cd makes it easy to install. I had to do it the old fashion way. Having linux expperience already made things easier. If I had been a novice, it would not have been installed.  Will probably take the several instruction sheets I used to make my own install procedure.  Kde seemed to work ok and the command line was very zippy.

I am assuming you now how to download and burn the arch linux cd.

 https://www.archlinux.org/download/

 http://mirrors.gigenet.com/archlinux/iso/2014.01.05/

Index of /archlinux/iso/2014.01.05

Name Last modified Size Description

Parent Directory
arch/ 05-Jan-2014 03:26
archlinux-2014.01.05-dual.iso 05-Jan-2014 03:41 528M
archlinux-2014.01.05-dual.iso.sig 05-Jan-2014 03:41 287
archlinux-2014.01.05-dual.iso.torrent 05-Jan-2014 03:41 30K
archlinux-bootstrap-2014.01.05-i686.tar.gz 05-Jan-2014 03:42 75M
archlinux-bootstrap-2014.01.05-i686.tar.gz.sig 05-Jan-2014 03:42 287
archlinux-bootstrap-2014.01.05-x86_64.tar.gz 05-Jan-2014 03:44 77M
archlinux-bootstrap-2014.01.05-x86_64.tar.gz.sig 05-Jan-2014 03:44 287
md5sums.txt 05-Jan-2014 03:44 220
sha1sums.txt 05-Jan-2014 03:44 244

Apache Server at mirrors.gigenet.com Port 80
Of course I had already installed arch linux on the pogoplug a while back.
Boot the arch minimal iso in the target machine.and at the oot prompt change the password

# passwd
root@archiso ~ # passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

root@archiso ~ #

See if you have an internet connectio

root@archiso ~ # ping -c 1 http://www.google.com
PING http://www.google.com (74.125.198.106) 56(84) bytes of data.
64 bytes from og-in-f106.1e100.net (74.125.198.106): icmp_seq=1 ttl=44 time=20.5 ms
http://www.google.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 20.597/20.597/20.597/0.000 ms
root@archiso ~ #

See what the name of your nic card is to the system

root@archiso ~ # dmesg | grep eth
[   37.369974] systemd-udevd[178]: renamed network interface eth0 to enp0s12

Get get the ip address

# ip addr show dev enp0s12
2: enp0s12: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 00 00 00 00 00 00 00 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.127/24 brd 192.168.8.255 scope global enp0s12
valid_lft forever preferred_lft forever
inet6 fe80::210:5aff:fe19:fd88/64 scope link
valid_lft forever preferred_lft forever

Start the ssh session

# systemctl start sshd

Go to a remote machine and log in (since root is the only user, you have to log in as root)

$ ssh root@192.168.8.127

The authenticity of host ‘192.168.8.127 (192.168.8.127)’ can’t be established.
ECDSA key fingerprint is (a bunch of hex numbers).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.8.127’ (ECDSA) to the list of known hosts.
root@192.168.8.127’s password:
Last login: Fri Jan 10 03:27:12 2014 from remotecomputer
root@archiso ~ #

Now you can turn off the monitor to the machine to be installed to save a bit of power. From here you can follow any number of arch linux command line install pages:

https://wiki.archlinux.org/index.php/Beginners%27_Guide/Installation
Skip past the network install since it is already working.

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

Interesting script to automate command line remote  login (i.e. never type that password again!):

<br /># invoke with ./Installkey.sh servername<br /><br /># set up the .ssh dir if it does not exists<br />DIRECTORY=",ssh"<br />ssh $1 'if [ ! -d "$DIRECTORY" ];  then  mkdir $DIRECTORY ;chmod 700 $DIRECTORY  fi'<br /><br /># copy the key<br />scp $DIRECTORY/id_dsa.pub $1:~/.<br /><br /># install the key<br />ssh $1 'cat id_dsa.pub &gt;&gt; $DIRECTORY/authorized_keys'<br />ssh $1 'chmod 600 $DIRECTORY/authorized_keys '<br /><br /># remove the public key you just copied<br />ssh $1 'rm ~/id_dsa.pub'<br />eddie@oedt01:~/bin$ cat installkey.sh<br /># invoke with ./Installkey.sh servername<br /><br /># set up the .ssh dir if it does not exists<br />DIRECTORY=",ssh"<br />ssh $1 'if [ ! -d "$DIRECTORY" ];  then  mkdir $DIRECTORY ;chmod 700 $DIRECTORY  fi'<br /><br /># copy the key<br />scp $DIRECTORY/id_dsa.pub $1:~/.<br /><br /># install the key<br />ssh $1 'cat id_dsa.pub &gt;&gt; $DIRECTORY/authorized_keys'<br />ssh $1 'chmod 600 $DIRECTORY/authorized_keys '<br /><br /># remove the public key you just copied<br />ssh $1 'rm ~/id_dsa.pub'<br />

Then you will want to use cssh to manage several systems  at once.

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

Sshkey install update.

Wrote a script a while back to put your ssh key on a remote system so you do not have to type in the password all the time. Found a few shortcomings with it and now have updated it. You will have to type in your password to login and complete the script process.

installkey.sh

# invoke with ./Installkey.sh servername

# set up the .ssh dir if it does not exist
DIRECTORY=”,ssh”
ssh $1 ‘if [ ! -d “$DIRECTORY” ];  then  mkdir $DIRECTORY ;chmod 700 $DIRECTORY ; fi’

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

# install the key
ssh $1 ‘cat id_dsa.pub >> $DIRECTORY/authorized_keys’
ssh $1 ‘chmod 600 $DIRECTORY/authorized_keys ‘

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

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

Not a fan of C++, but my br9ohter put up a Microsoft  example for hist students to solve. Of couorce I wanted to solve it using linux,

#include <iostream>

using namespace std;

int main() {

int length;
int width;

cout << "Enter the width: ";
cin >> width;

cout << "Enter the length:" ;

cin >> length;

cout <<"the area is: ";
cout << length * width;

cout << "\n\n";

return(0);

Gedit main.cpp

eddie@oedt01:~$ g++ math.cpp -o math
eddie@oedt01:~$ ./math
Enter the width: 10
Enter the length:20
the area is: 200

eddie@oedt01:~$

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

There are different numbering systems. What we use most common  is base ten Computers and electronics better adapt to the bainary of base two systems. That s because only zeroes and ones are used to create munbers. Then of course numbers can be represented by light swithes. for example if you had eighr light switches will represent on and 0 will represent off/ 11011110 Huh? How can that be a number? Well it can be translated from what the machine understands to what we understand. So we can write a program htat will trans late the number from base 2 (one and zeros) to what we understand.

128  64  32  16      8  4   2   1

1        1   0   1      1   1   1   0

os that is 128 + 64+16 +8+4 +2 or 222

To make thinkgs easier we can write a program to do the translation for us.

numcnvrt.c


#include <stdio.h>
int main(void)
{
char bin; int dec = 0;
printf("enter a binary number: ");

while (bin != '\n') {
scanf("%c",&bin);
if (bin == '1') dec = dec * 2 + 1;
else if (bin == '0') dec *= 2;
}

printf("The decimal number is: %d\n", dec);

return 0;

}

Sincomputers only understands onee and zeros, the code will have to be compliled ot translated to what the computer understands. Once we do that can can call the program to solve the problem for us.. So let’s do that.

$ gxccnumcnvrt.c -o binmath

The code was compiled, so let’s run it.

$ ./binmath
enter a binary number: 11011110
The decimal number is: 222
Whoopie the computer came up with the number we hand translated from binary to base 10.

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

Could of sworn I had included this quick sshkey shell file in an earlier post. Here it is again.

Wrote a script a while back to put your ssh key on a remote system so you do not have to type in the password all the time. Found a few shortcomings with it and now have updated it. You will have to type in your password to login and complete the script process.

installkey.sh

# invoke with ./Installkey.sh servername

# set up the .ssh dir if it does not exist
DIRECTORY=”,ssh”
ssh $1 ‘if [ ! -d “$DIRECTORY” ];  then  mkdir $DIRECTORY ;chmod 700 $DIRECTORY ; fi’

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

# install the key
ssh $1 ‘cat id_dsa.pub >> $DIRECTORY/authorized_keys’
ssh $1 ‘chmod 600 $DIRECTORY/authorized_keys ‘

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

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

One of the things that sort of gets my gut is when peoplefeel htat something is not worth what is is. In this case it benefitted me. Was browsing at local bookstore when I happened upon the book that had calculations for electronics with codethat was in basic. Most people now a days disregurd basic as being archaic. The book was only a dollar. Could not believe app the programs that it contained.  Even if I did not use the basiclanguage to write code from this book, the basic code certainly served as pseudo code that could be used to write similar programs.Now it is much easier to write progrms to calculate values for electronic parts to be used in circuits.  The book had been a gold mine. of information.

Screenshot from 2014-01-27 03:35:37

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

Odds and ends:

Linux hints: http://www.instructables.com/id/Linux-hints/

Fake chicken fried steak:

fakecfs

Good day

Advertisements