Alex Beutel's Blog

Begginning of Summer 2009

May 30th, 2009 · No Comments

As usual I haven’t posted in a while but there actually have been some things going on that may be worth writing on here.  I’m at Duke for the summer doing research with the Physics Neutrino group, among other things so here are some things that have happened:

Ethical Hacking Seminar

Duke OIT gave me the opportunity to take this hacking seminar at Duke the first week of summer.  It was definitely an extremely beginner course and I was a little disappointed to see that so much of it was just “pick the right tool and run it,” but good opportunity to dig a little deeper into network protocols and learn some new things; without a doubt was worthwhile.  If anyone reading this is as much of a beginner as I am check out things like Ettercap, nmap, and Nessus.

Duke’s AFS Online Interface – Webfiles

The past year I have been working with OIT, half doing web application security and half doing programming updating Duke’s online interface for its AFS file system, Webfiles.  Essentially, it was an attempt to make the online interface more comfortable for average users and make it most similar to Windows Explorer and OS X Finder so that using it is as intuitive as possible.  The coding was anything but beautiful, but it was a good opportunity to learn more about Javascript and play with some fun things.  General changes are that it now has an icon and outline view, drag and drop, some of the typical shortcut keys, etc. Below are some screenshots and I will try to create a demo site at some point.  I am also excited to say Duke is making all my code open source so let me know if you would like to implement it yourself.  I believe Carnegie Mellon is currently looking at deploying it on their systems, which I think is exciting.

icon outline

Neutrino Physics

I just started working with Professor Chris Walter and his Neutrino Physics group.  So far, just to get into the group, I have been working on creating a plug-in for ROOT to make it read and write to a specific kind of distributed file system faster.  It has been an interesting experience getting back into C++ and a little bit of Fortran, and learning about this large project out of CERN.  I’m still finishing up the plug-in but hopefully I will be able to post the code or at least write about how to easily integrate the plug-in into ROOT when I’m done.  Not sure what I will be doing after that; I am taking classes on GEANT4 and think I will be doing monte carlo simulations of some sort for the rest of the summer, but I will write about this when I know more.

Simple Flash Cards in Python

The second reason I am here for the summer is that I need to take Spanish to fulfill Duke’s foreign language requirement.  If you actually know me, you will know that I am horrible at foreign languages and have been dreading taking these classes since I got to Duke.  It has now been two years since I last took a Spanish course, so jumping back into the language has been an interesting experience.  Also, Spanish 63 is known to be a lot of work and over the summer its so jam packed together that it is actually a good amount of work each night.  Anyway, we had our first test last Friday, and I had about 100 words of vocabulary to memorize, one of my worse skills.  So, both to procrastinate from actually studying and because I thought it could be useful, I decided to make a basic command line flash card program.  I’m trying to bit by bit pick up Python, so I used it and it was fairly simple.  The program essentially takes in a plain text file with the two sides of the flash card on one line, each side separated by a colon.  It then goes through the lines, shows you the second half of the line first, waits for you to press enter and then shows you the first half.  If you press enter again it will discard the word and go to another random word in the deck; if you type ‘x’ and then press enter it will put the word back in the stack.  Fairly basic, and the code is nothing special; probably took about 15 minutes to throw together, but it was surprisingly very useful as I could run through a lot of the vocab very fast and repeatedly. I’ll probably update it to make it a little better packaged together with proper arguments, etc. so you can check back for that.  Anyway, to run it (if you have a Mac python is installed by default and in Windows you need to do it yourself) open up a terminal and make sure you are in the folder where the code and the text file with the vocab are.  Then just type:

python flashcards.py yourvocabfile.txt

The code for flashcards.py (example vocab linked here) can be seen below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python
# encoding: utf-8
 
import sys
import random
import os
 
def clearscreen(numlines=100):
    if os.name == "posix":
        # Unix/Linux/MacOS/BSD/etc
        os.system('clear')
    elif os.name in ("nt", "dos", "ce"):
        # DOS/Windows
        os.system('CLS')
    else:
        print '\n' * numlines
 
def main(argv=None):
	if argv is None:
		argv = sys.argv
	allLines = []
 
	again = 'x'
	if(len(argv) > 2):
		again = argv[2]
 
	f = open(argv[1], 'r')
	for line in f:
		allLines.append(line)
 
	clearscreen()
 
	cnt = 0
	wrong = 0
	wWords = []
	while len(allLines) > 0:
		cnt += 1
		l = allLines.pop(random.randint(0, len(allLines)-1))
		parts = l.split(":")
		p = 1
		p2 = 0
		print cnt, "(", len(allLines), "). ", parts[p]
		inp = raw_input("")
		if(inp == "exit"):
			break
		print parts[p2]
		inp = raw_input("")
		if(inp == "exit"):
			break
		if(inp == again):
			allLines.append(l)
			wrong += 1
			wWords.append(l)
		clearscreen()
	clearscreen()
 
	print "Missed ", wrong, " times"
	for line in wWords :
		print line
 
if __name__ == "__main__":
	sys.exit(main())

Again, nothing special or fancy, but seemed to work well; I guess I’ll know how effective it was when I get the test back haha. Anyway that is all for now, I may make public a post I wrote a few months ago that I never published, so check for that and I’ll write of any other things I do this summer. Also check my twitter as I post more frequently there. Time to go outside.

Tags: Duke · Javascript · Programming · Python · Web Development

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment