Alex Hughes' Fall 2013 Opus
“DeeDee, You EEE-DEE-OUGHT”
“I am the gatekeeper, are you the keymaster?”
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
D
The Second Week of School:
if(list == NULL) { list = tmp = (Node *)malloc(sizeof(Node)); tmp->next = NULL; //list->next = NULL == tmp->next = NULL // because both list and tmp point to the same thing list->value = input; } else { tmp-> next=(Node*)malloc(sizeof(Node)); tmp-> next-> next = NULL; tmp-> next-> value = input; tmp = tmp -> next; }
printf("Which node would you like to insert before?\n"); int seeker; tmp = list; Node*tmp2 = NULL; scanf("%d",&input); tmp = list; for(seeker = 0; seeker < (input-1); seeker++) { tmp = tmp-> next; } printf("Enter a value to insert:\n"); if(input == 0) { scanf("%d", &input); tmp2=(Node*)malloc(sizeof(Node)); tmp2 -> value = input; tmp2 -> next = NULL; tmp2 -> next = tmp; list = tmp2; } else { scanf("%d", &input); tmp2 = (Node*)malloc(sizeof(Node)); tmp2 -> value = input; tmp2 -> next = tmp -> next; tmp-> next =tmp2; } tmp = list; input = 0;
List * build() { Node * tmp=NULL; List * myList = (List*)malloc(sizeof(List)); myList->start=myList->end=NULL; int input = 0; printf("enter a value (-1 to quit): \n"); scanf("%d",&input); while(input != -1) { if(myList->start == NULL){ myList->start = myList->end = (Node*)malloc(sizeof(Node)); myList->start->value = input; myList->end->prev=myList->start->next = NULL; } else { myList->end->next=(Node*)malloc(sizeof(Node)); myList->end->next->value=input; myList->end->next->next=NULL; myList->end = myList->end->next; } printf("Enter another value(-1 to quit): \n"); scanf("%d",&input); } return (myList); }
List * insert(List * myList, Node * place, Node * newNode) { if(place == myList -> start) { newNode->next=place; place-> prev=newNode; newNode->prev = NULL; myList->start=newNode; } else { newNode->next=place; place->prev->next=newNode; newNode->prev=place->prev; place->prev=newNode; } return(myList); }
* the scoping issues are resolved with a lot of frustration and broken computer equipment (via HULK SMASH) * NOW ON TO OTHER FUNCTIONS SUCH AS 'SORT' AND THE LIKE * sort is a pain in the a$$
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
The first week of school:
The second week of school:
The third week of school:
while(value <= 15) { printf("Value is at %d\n", value); place = 8; pin = 3; queue = value; while(place > 0) { GPIO_SET = queue/place << pins[pin]; printf("place is %d, bit is %d\n",place,(queue/place)); if((queue/place) == 1) { queue = queue - place; } place = place/2; pin=pin-1; } usleep(1000000); GPIO_CLR = 1 << pins[3]; GPIO_CLR = 1 << pins[2]; GPIO_CLR = 1 << pins[1]; GPIO_CLR = 1 << pins[0]; usleep(50000); value++; }
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
- just got the list of stuff to be done this semester today. My goal for HPC Experience is to get as comfortable with linux to take a red hat cert and finish some systems programming stuff.
I have lacked on the updates to this opus, but that is not for a complete lack of work.
I did a multitude of things such as getting my AWS Red Hat instance to be able to run through lab46, writing an attendance script, and learning to use some programs within lab46 that made my life much easier to be able to code, such as finally switchingn out of nano into vi as my main text editor (i am now interested in emacs), and using tmux to allow myself to have multiple panes open within the same screen.
this was necessary as I felt like i didn't do anything that would constitute as a project otherwise, but it is a great exaple of the guts of writing a script that i needed to learn, such as defining variables and running loops within the BASH syntax. It's not as complete as i would like, but it's a start.
YEAR=`date +%Y` MONTH=`date +%m | sed 's/^0//'` CURMONTH=`date +%m | sed 's/^0//'` CLASSLOGIN - '09:00' CLASSEND - '10:15' INTIME =`last|cut 50-55` OUTIME=`last|cut 58-63` #december of the of the current year is actually the first month of the next year, november is coded as the 12th month and all previous months are offbyon e #data structs 9-10:15 wed thurs fri #cprog 12:25-1:50 wed fri #clab 3-4:50 thurs #unix 3-5:20 wed fri #To do: #classlogin as var and classend as vars #place login time in var (intime) #place logout time in var (outtime) #if the intime is less than classend (on before class is over) }\ # Do something that recognizes a successful login #if the outtime is after(greater than) class begins (off after class starts)}/ #for MONTH in `last -f /var/log/wtmp.${YEAR}${MONTH}`; do for((i=0;i<5; i++)); do if [ $i -eq 0 ]; then last -i| grep $1 | grep '10.80'> userlogin MONTH=`echo $MONTH | sed 's/^0//'` MONTH=$(($MONTH+1)) else if [ $MONTH -lt 10 ]; then MONTH="0$MONTH" fi last -i -f /var/log/wtmp.${YEAR}${MONTH} | grep $1 | grep '10.80' > userlogin fi MONTH=`echo $MONTH | sed 's/^0//'` MONTH=$(($MONTH-1)) cat userlogin | grep Wed # grep login time, cross reference with class times for each day. cat userlogin | grep Thu cat userlogin | grep Fri done
This instance was kind of usefull, I had been able to get some things done in a RED Hat Certification book such as creating a new user, but the book was frustrating as it jumped around and wasn't consise and to the point as to what it was going to teach you.
I had initially thought that i needed to do a recursive ssh in order to access the instance from the Wedb services, but it turned out that i just needed to copy the permission access file that held my private key within it. I also figured out what a pem file was:
from the definition i think there is a more direct means of accessing the instance without using this file, but seeing how i already had the file built, i figured I should just try and use it.
I ended up using an scp command to lab46 to send the file to my user ssh. The problem i then ran into was that the permissions needed to be set to read only to send the file, and then set back to be able to use the file to open the instance from lab46.
with that resolved i could now access my instance from any outside computer by first ssh into lab46 and then running the instance through the .pem file.
so, I was very reluctanct in previous semesters to use another text editor besides nano, because i just didn't see the benefits. but then i took data structs. data structs kicked my ass and i needed a viable means to be able to quickly manipulate my code without losing my train of thought as to what i was doing.
at first there were a barrage of questions on basic commands, but then they all ended up being very fluid at the end and i honestly don't know how i ever dealt without it before.
I had seen other people in courses using multiple paned programs, and i just always thought that it was cool, and i started using multiple terminals and getting a slew of .swp files because of that, then i started using tmux.
I love tmux. it is the shit, without having a equally 4 paned window i would have just become painfully frustrated with coding the EoCE in data structs. I had both class headers open in 2 panes, the src folder in another, and the current function i was building in a seperate pane so i could see where all my scope was at once.
it's just another one of those things that i didn't see the beauty of until i had a need for it, and when i did, oh was it beautiful. the intuitive control system was much like vi's command and insert modes. it uses CTRL_B to enter command mode and then the appropriate character to use the command. mainly i used it for multiple panes, which are the '“' and '%' but as i delved deeper in single cases i was copying between panes using the number of lines. it all sounds like really simple stuff, and it is, but there is a reason its there, and i am glad it was.
both the use of vi and tmux makes me wonder about a bit bulkier program that may save even more time in moving and manipulating code between files/panes.(emacs? i'm open to suggestion)