Posts

Showing posts with the label command line

Rock, paper, or scissors.

Game of Rock, paper, or scissors. Should be able to run on any platform that can support the Python interpreter. $ python rps.py or c:/[pythondirectory]> python rps.py rps.py [code] import random import sys def makeYourChoice():     print "Press R for Rock"     print "Press P for Paper"     print "Press S for Scissors"     print "Press Q to quit!"     userChoice = raw_input("What do you want to choose?").lower()          if userChoice == "r":         return "Rock"     if userChoice == "p":         return "Paper"     if userChoice == "s":         return "Scissors"     if userChoice == "q":         sys.exit(0)     else:         makeYourChoice() de...

Rock, paper, or scissors.

Game of Rock, paper, or scissors. Should be able to run on any platform that can support the Python interpreter. $ python rps.py or c:/[pythondirectory]> python rps.py rps.py [code] import random import sys def makeYourChoice():     print "Press R for Rock"     print "Press P for Paper"     print "Press S for Scissors"     print "Press Q to quit!"     userChoice = raw_input("What do you want to choose?").lower()          if userChoice == "r":         return "Rock"     if userChoice == "p":         return "Paper"     if userChoice == "s":         return "Scissors"     if userChoice == "q":         sys.exit(0)     else:      ...

Guiless?

Image
You actually can do a minimal windowing from the command line in Linux with dvtm. Dvtm is excellent for low end machines where graphics are not a priority. In the picture shown we have a working clock, SC a spreadsheet that you can easily export data to your favorite desktop spreadsheet such as Libreoffice, Links2 a web browser pointed to www.google.com, and finally nano a pretty decent basic text editor. I prefer vim, but nano has more of a user interface. Cheatsheet: `dvtm` is one simple, easy-to-use terminal multiplexer. Commonly used Options:     -v         prints version information to standard output, then exits.         -m <mod>   set default modifier at runtime.         [cmd...]   Execute cmd after dvtm is started. KeyBoard Shortcuts:     Mod    Each keybinding begins with Mod which defaults to ^...

Record your command line..

Image
Sometimes every once in a while, you find an old generally unused command, but now you find it is very valuable. One such command is know as ttyrec. As the name suggests, you can probably record what is typed at the terminal.   This is excellent for documentation purposes. It is a must for people who do any amount of work on the command line.  An example: recently did a remote install of Arch linux on a remote machine.  It would have been nice to have a record of all the work done. # sudo apt-get install ttyrec Well how do you use it? There are actually two parts of the system. ttyrec does the recording and ttyplay  will playback what you have recorded.  So you will want to invoke ttyrec with a filename (for later playback,) which will generate a new shell or prompt.  Go ahead and type in the commands you want to do, then when you are finished, use <control>d to exit the the recording. You will see the word exit to confirm the exit of the tty...

More computers without new hardware.

Image
Several computers for the price of one. You can not beat a deal like that. Actually you will still have only one computer but we will use the power of the system to allow it to run what is known as virtual machines or computers within a computer. Actually this has been done for a long time, but only now is the general community starting to take advantage of it. A little history first. It used to be if you wanted to use more than one operating system on your computer, you had to do what is known as dual or multi-boot. You had more than one operating system you could use, but only one at a time. Remembering when I was a tech, the college I was working for wanted to get rid of their unix server. They wanted each student to have their own  'nix system to work with. So we took a machine with already installed Microsoft product and squeezed in Linux operating system install. Linux was going to be taught to get to know Unix. When the students started up the computer for their access...

Cut and paste.

Image
Play pretend here for a second. You are a new accountant for a company and you  need to make a consolidated financial report of many units. (This example is way over simplified, but I think you will get the idea.) You need to get a report out, but you do not have time to re-enter figures, because all the units send their data in ascii or what is known as text files. How can we get the computer to compile the data so it can be easily entered into the spreadsheet?  Heres how! A good prerequisite for this post is at:  http://www.linuxintheshell.org/ Units one two and three send their data in, but they are in an ascii file. We want to convert them  so they can be easily converted for use in a spreadsheet. From Unit 1 in unit1:                        Unit 1 Income:        5000 Expenses    2000 Data from Unit  2 in unit2:             ...