======Part 3======
=====Entries=====
====November 4, 2011====
On this day we learned about X11. X11 is the graphical interface on the computers in the "Lair". All the computers are connected and you can send things to other people's displays and troll them. You can do this by opening up a normal terminal which is connected to X11. After you are in one you can change your DISPLAY variable to their computer and use xcommands which you can look up to troll them.
====November 11, 2011====
Today we worked on data-mining the schools list of courses for next year. This is one of my favorite things to do when I'm not having a bad day and will take my time on it. Basically data-mining is the process of removing all the extra info from a file and retrieving the valuable data form the mess of information.
We also learned about ASCII art or art made with characters found on the keyboard.
====November 15, 2011====
Today we learned a little about networking. A few basic directories and commands for these aspects are as follows
/sbin/ifcongig this will take you to network information
netstat -nr this will show you the routing system
netstat -l same thing just different format as the previous command
ping this allows you to check for a computer and test teh connection
traceroute follows a ping
====November 17, 2011====
Today one of our classmates came in with a project for work and it was huge. He asked the class for help so it can get done on time and we did because the teacher promised us project points for it. The project was to data-mine some information on companies and emails. I really enjoy data-mining and am trying to learn AWK which makes data-mining much easier and quicker. Data-mining is a great thing to put on your resume when searching for a job because almost every industry is focused around data.
=====unix Topics=====
====$PATH====
The PATH is a list of locations that, when a command is issued, Unix searches to find the executable command in order to run it.
lab46:~$ echo $PATH
/home/cforman/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
each area listed above is a possible location I can execute from. Since the PATH is a variable it can be changed. I changed mine so that I can type any name of a game and Unix will automatically run it for me without the necessity of me having to go to that directory. Since I added to my PATH it was o.k. but if I had removed it would result in errors because I would not be able to run programs instantly just by calling them.
lab46:~$ worm
Well, you ran into something and the game is over.
Your final score was 78
lab46:~$ OpusResults
The total is 102
Your actual value is 76
74.50
The total for part 2 is 102
Your actual value is 91
89.21
your average is 81
lab46:~$
These are two commands that I executed from my home page but the commands are located in different directories one in my personal bin directory and the games directory. I can run them because as I said earlier they are part of my PATH.
====Wildcard====
Wildcars are a series of characters that when searching mean something other then what they normaly do when searching for files. (kinda vague huh)
Here is a list of Wildcards.
? - match any single character
* - match 0 or more of this character/anything really
[] - match any one of enclosed
[^] - do not match any of the enclosed
EXAMPLE TIME
lab46:~$ ls
1275799069694.jpg funny-pictures-taco-cat-is-a-palindrome.jpg
250px-P2_glados.jpg goonies-musical.jpg
Downloads irc
InstNLP2.txt linktestfile
InstNLP2Edited.txt minecraft-creeper-comic-600x694.png
Maildir motd
RageFaceBlackSS.png nom-nom-nom-babies.jpg
archive public_html
archive1.tar.gz puzzlebox
archive2.zip shaco.jpg
archivecompilationfile shellscripting
archives spring2012-20111103.html
archives.tar.bz2 src
archives.zip src.orig
bin testdir
cake testdir.tar
closet testdir2
corningcourses testfile
corningcoursesorg tmp
courses trollin
data trolling-400x345.jpg
emvideo-youtube-nd2rBWbvDbA_3.jpg veigar.jpg
fiddlesticks.jpg wicked-witch.jpg
lab46:~$ ls ???
bin:
CliBash OpusResults commandline hello.c script script4
DOOMONUbot Searchcourses datatypes hello.s script1 script5
DOOMONUbot2 boscript datatypes.c password script2
Multiplicationprog cli.c hello s script3
irc:
irc irc.freenode.net
src:
tmp:
file haha hola killyou mwajajaja testsubject
o.k. that's kind of annoying you might say when looking at the results. Sure not everything you see is three characters long but Unix does this cool thing like you know being nice. if you wanted the directories that were three characters long in name it gives those and shows what they contain. Lets try this again but in a different way. Lets see how many files start with a number.
lab46:~$ ls [0-9]*|wc -l
2
====Tab Completion====
when entering a command onto the command line it will let you tab complete it. When you are typing a command you can hit tab to auto complete it but if what you typed matches more then one command it will not auto complete but give you (if you hit tab twice) all the options of commands that match what you typed.
lab46:~$ ls
1275799069694.jpg closet shaco.jpg
250px-P2_glados.jpg corningcourses shellscripting
Downloads corningcoursesorg spring2012-20111103.html
InstNLP2.txt courses src
InstNLP2Edited.txt data src.orig
Maildir emvideo-youtube-nd2rBWbvDbA_3.jpg testdir
RageFaceBlackSS.png fiddlesticks.jpg testdir.tar
archive funny-pictures-taco-cat-is-a-palindrome.jpg testdir2
archive1.tar.gz goonies-musical.jpg testfile
archive2.zip irc tmp
archivecompilationfile linktestfile trollin
archives minecraft-creeper-comic-600x694.png trolling-400x345.jpg
archives.tar.bz2 motd veigar.jpg
archives.zip nom-nom-nom-babies.jpg wicked-witch.jpg
bin public_html
cake puzzlebox
lab46:~$ ec
then hit tab
lab46:~$ echo
lab46:~$ echo fidd
TAB
lab46:~$ echo fiddlesticks.jpg
lab46:~$ echo S
THE DOUBLE TAB
lab46:~$ echo s
shaco.jpg spring2012-20111103.html src.orig/
shellscripting/ src/
lab46:~$ echo s
====killing a process====
O.K. so say you have a program that is bugging the crap out of your terminal and you cant stop it. How will this trouble get solved. Easily just put a shotgun to its head (metaphorically speaking). Kill commands like "kill -9" are sure to blow off the head of any zombie program or out of control program. Just pray its not a Ninja Zombie (much like magical zombies that don't die from anything). If you have a program that is spazzing out and is disconnected from any control you can implement that is a ninja zombie and that is a losing situation. If its a normal zombie kill -9 will terminate it like a bad Arnold Schwarzenegger impression, "GET in ze chopper!"
SO SAY CAT IS ON BUT YOU WANT IF OFF BUT YOU DESIRE TO COMPLETELY OBLITERATE THE LITTLE KITTEN USE THIS.
lab46:~$ cat
THE EMPTY SPACE IS CAT WHEN IT IS ISSUED WITH NOTHING TO CAT
lab46:~$ ps
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
cforman 4061 0.0 0.1 13632 2000 pts/28 SNs 22:27 0:00 -bash
cforman 5193 0.0 0.0 5860 532 pts/19 SN+ 22:33 0:00 cat
cforman 6573 0.0 0.0 8584 960 pts/28 RN+ 22:40 0:00 ps u
cforman 14217 0.0 0.0 13664 8 pts/17 SNs Oct13 0:00 /bin/bash
cforman 14222 0.0 0.1 42684 2036 pts/17 SN+ Oct13 6:52 irssi
cforman 24154 0.0 0.1 13632 1968 pts/19 SNs 21:21 0:00 -bash
lab46:~$ kill -9 5193
lab46:~$
CAT RESPONDS BY BEING KILLED .... IN A BLENDER LOL
lab46:~$ cat
Killed
lab46:~$
====Compiler====
A compiler is a program that turns source code into programs. With bash it automatically compiles the script to code but with "C"
lab46:~/bin$ ls
CliBash OpusResults commandline hello.c script script4
DOOMONUbot Searchcourses datatypes hello.s script1 script5
DOOMONUbot2 boscript datatypes.c password script2
Multiplicationprog cli.c hello s script3
lab46:~/bin$ gcc -o babybackribs cli.c
lab46:~/bin$ ls
CliBash OpusResults cli.c hello s script3
DOOMONUbot Searchcourses commandline hello.c script script4
DOOMONUbot2 babybackribs datatypes hello.s script1 script5
Multiplicationprog boscript datatypes.c password script2
lab46:~/bin$
You want to use the gode between the two lists of programs. "gcc -o progname scriptname"
====Regular Expressions====
When I think of RegEx's I tend to think of data-mining. A lot of RegEx's are used in this process. You can use them to define certain peices of text when trying to remove repeated paterns and get information not defined by the RegEx's. Here is a list of RegEx's:
^ = match beginning of line
$ = match end of line
. = match any single character
* = match 0 or more of previous character
\< = match beginning of word
\> = match end of word
[] = match any of enclosed
[^] = inverted character class (do not match)
() = grouping
| = or
\(\) = grouping for substitution
lab46:~$ cat InstNLP2.txt | sed 's/^$/^/g' | tr '\n' '$' | tr '^' '\n'|sed 's/-----------/unknown/g'|sed 's/^\$\(.*\)\$\(.*\)\$\(.*\)\$$/"\3","\2","\1"/g'|sed 's/email: //g'|less
HERE IS A LINE OF REGEX THAT I USED TO DATA-MINE A FILE TO RETRIEVE THE USEFUL INFORMATION OUT OF IT.
====Job Control====
Job control is controlling how a program or proces runs (in the foreground or background) and stopping active jobs without killing them and of course my favorite type of control. (in the words of a man name Jesse Cox) "John Wu style in you're face!" ( basic shotgun blast to the head, although John Wu used pistols .... it does not matter) Here is a list of job control commands.
control-z Stop (don't kill) the foreground job, and then return to the shell
jobs Check the status of jobs in the current session
ps -u username Check the status of processes, including those from other sessions. On BSD systems, use 'ps -gx'.
kill -9 %1 Kill a job, by specifying its job number after the percent sign
kill -9 123 Kill a process, by specifying its process id (PID) number
bg Run the most recently stopped job in the background
fg Bring most recently backgrounded job to the foreground
fg %1 Bring a job to foreground by specifying its job number after the percent sign
====Program vs Process====
A program is something you run instantly and see the results almost as fast as you started it. Like opening an application on your desktop. That is a program you are using. A function is also a program but it runs continually in the background usually unless you decide otherwise. A process is like the computer receiving and translating the sets of bits from the key board into ASCII text so you can read it. That is a process. Another process could be background security checks by your friendly neighborhood antivirus.
====Backgrounding a process====
As explained above when something runs in the background you do not see it but it still runs. It does not have any effect until it finishes the process.
lab46:~$ sleep 10
echo hello
lab46:~$ echo hello
hello
lab46:~$ sleep 10
echo hello
^Z
[1]+ Stopped sleep 10
lab46:~$ bg
[1]+ sleep 10 &
lab46:~$ hi
-bash: hi: command not found
[1]+ Done sleep 10
lab46:~$ ps
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
cforman 4061 0.0 0.1 13632 2012 pts/28 SNs+ 22:27 0:00 -bash
cforman 14217 0.0 0.0 13664 8 pts/17 SNs Oct13 0:00 /bin/bash
cforman 14222 0.0 0.1 42684 2036 pts/17 SN+ Oct13 6:52 irssi
cforman 18683 0.0 0.0 8584 964 pts/19 RN+ 23:44 0:00 ps u
cforman 24154 0.0 0.1 13648 2016 pts/19 SNs 21:21 0:00 -bash
lab46:~$
I stopped the sleep and echo commands and placed them in the background to run there. Using "ps" you can see that it is no longer running after it comes out of the background once it says done.
====Foregrounding a process====
Foregrounding a process is the same as back grounding it. Just type "fg" and it comes back to the front of the actions you can perform.
lab46:~$ cat
^Z
[1]+ Stopped cat
lab46:~$ bg
[1]+ cat &
lab46:~$ adjf
-bash: adjf: command not found
[1]+ Stopped cat
lab46:~$ adjfl
-bash: adjfl: command not found
lab46:~$ ajfldk
-bash: ajfldk: command not found
lab46:~$ fg
cat
helo
helo
====Multitasking====
This has a lot to do with foregrounding and back grounding. Consider a program that will take quite a while and you want to do other things you can back ground it as seen in the key word back grounding and then do other stuff. Multitasking in UNIX is essential job control but working while a job is being controlled by the back ground.
====Unix Programming Enviroment====
Identification and definition of the chosen keyword. Substitute "keyword" with the actual keyword.
If you want to demonstrate something on the command-line, you can do so as follows:
lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$
=====unix Objective=====
====Objective====
I will look at a RegEx line and explain the results of it piece by piece to test my ability (not to data-mine) but to recognize the effects of RegEx's
===Method===
I will examine a piece of code and tell what it is doing part by part.
===Measurement===
cat spring2012-20111103.html| grep 'ddtitle'|sed 's/^//g'|sed 's/<\/A/*$//g'|sed 's/^\(.*\) -
\([0-9][0-9][0-9][0-9][0-9]\) - \(.*\) - \([0-9][0-9][0-9]\)$/\2:\3-\4:\1/g'|sort|less
ok so first things first. cat is reading the document spring 2012-20111103.html. grep is pulling out everything that has ddtitle and focusing on it. sed allows for pattern definition. sed is recognizing the exact phrase " | " which is a repeated pattern threw out. the "....." each . represents a character. in this line there are different characters here but none are cared about so the pattern fits by putting the changing piece represented by periods. That line is then replaced by nothing. another sed locks onto the end of the line which is another pattern and it removes it all. the next said is different. instead of removing it describes the pattern by how it is exactly. This allows for sectors to be set up by the \ . the sectors are then rearranged and formatted in the way needed. the information is then sent to less and that is the end of the code.
===Analysis===
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
* How did you do?
* decent i would assume. all explained and correct.
* Room for improvement?
* yes being able to create RegExs along with reading them would be a great improvement.
* Could the measurement process be enhanced to be more effective?
* possibly if checked by a teacher rather then a student.
* Do you think this enhancement would be efficient to employ?
* quite possibly
=====Experiments=====
====Experiment 1====
===Question===
Can I make a redstone-based ripple counter in Minecraft to light a torch or make a
sound when it finishes counting from 0 to 16?
===Resources===
http://www.minecraftwiki.net/wiki/Redstone_Repeater - this site explains everything minecraft and more specifically minecraft redstone repeaters.
===Hypothesis===
I believe i can make a redstone system that will count to 16 then activate a torch and or a sound box.
red stone repeaters allow for a stacking effect where they will send a signal down the line. this signal can be counted to create a counter or a special delay where it needs to run through the system enough times to activate the sound block.
===Experiment===
I am going to build a redstone contraption that will function much like an actual program where it has a hardwired command and will run it until it is accomplished.
===Data===
unfortunately i was not smart enough to solve it myself and the methods used to solve it do not function anymore on minecraft 1.0 here are links to two videos that explain how to do this in both binary and non- binary form. Results being i was unable to do this but someone was and it is possible.
http://www.youtube.com/watch?v=81Janhiya-o
http://www.youtube.com/watch?v=1O-DRgbD3ZI
===Analysis===
Based on the data collected:
* was your hypothesis correct?
* yes it is possible ... no not for me i am not that smart.
* was your hypothesis not applicable?
* yes because counting locks are very nice and practical especialy with pass locks in anything.
* is there more going on than you originally thought? (shortcomings in hypothesis)
* yes but not in my hypothesis. in minecraft redstone has both a on and off state and you create logic gates like nor or and to change the states of the redston much like bit manipulation in computing.
===Conclusions===
Red stone is a great learning tool for computers and fun to work with. it causes you to think outside the box and make applicable things to help you in minecraft just as it would in the real world.
====Experiment 2====
===Question===
Using ';'. can I run multiple commands on the same command-line?
===Resources===
none. I used basic knowledge from class.
===Hypothesis===
I believe that i will be able to use multiple commands at the same time
The ";" acts as a command separator which allows the user to act like he is on a new line.
===Experiment===
i am going to enter it onto the command line and test it.
===Data===
lab46:~$ wtf echo
echo: echo (1) - display a line of text
echo (3ncurses) - curses input options
lab46:~$ echo "testfile";wtf echo
testfile
echo: echo (1) - display a line of text
echo (3ncurses) - curses input options
lab46:~$
===Analysis===
Based on the data collected:
* was your hypothesis correct?
* yes
* is there more going on than you originally thought? (shortcomings in hypothesis)
* there may be.
* what shortcomings might there be in your experiment?
* i did not try and test to see if i can make multiple commands run at one moment on the same item to sequentially effect it.
===Conclusions===
";" is a great way to string together commands when working on unix.
====Retest====
If you're doing an experiment instead of a retest, delete this section.
If you've opted to test the experiment of someone else, delete the experiment section and steps above; perform the following steps:
===State Experiment===
Whose existing experiment are you going to retest? Prove the URL, note the author, and restate their question.
===Resources===
Evaluate their resources and commentary. Answer the following questions:
* Do you feel the given resources are adequate in providing sufficient background information?
* Are there additional resources you've found that you can add to the resources list?
* Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment?
* If you find a deviation in opinion, state why you think this might exist.
===Hypothesis===
State their experiment's hypothesis. Answer the following questions:
* Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?
* What improvements could you make to their hypothesis, if any?
===Experiment===
Follow the steps given to recreate the original experiment. Answer the following questions:
* Are the instructions correct in successfully achieving the results?
* Is there room for improvement in the experiment instructions/description? What suggestions would you make?
* Would you make any alterations to the structure of the experiment to yield better results? What, and why?
===Data===
Publish the data you have gained from your performing of the experiment here.
===Analysis===
Answer the following:
* Does the data seem in-line with the published data from the original author?
* Can you explain any deviations?
* How about any sources of error?
* Is the stated hypothesis adequate?
===Conclusions===
Answer the following:
* What conclusions can you make based on performing the experiment?
* Do you feel the experiment was adequate in obtaining a further understanding of a concept?
* Does the original author appear to have gotten some value out of performing the experiment?
* Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author).
|