Archive for the ‘Programming’ Category

sorta captcha breaking thing

Monday, December 22nd, 2008 by webstersprodigy

“The pixels in the above image are numbered 0..99 for the first row, 100..199 for the second row etc. White pixels represent ascii codes. The ascii code for a particular white pixel is equal to the offset from the last white pixel. For example, the first white pixel at location 65 would represent ascii code 65 (‘A’), the next at location 131 would represent ascii code (131 – 65) = 66 (‘B’) and so on.

modular exponentiation speedup

Monday, December 8th, 2008 by webstersprodigy

Trying to do this in a somewhat intelligent way this time. The results are better. timing in at around 4 seconds instead of the brute force 11 minutes. I’m very positive it could be sped up much much more by writing in C, but this is just algorithmic, and I’m writing in python.

stupid benchmark

Saturday, December 6th, 2008 by webstersprodigy

Stupid single core opteron vs xeon benchmark. This benchmark is to test the single core speed of some operations of a 2.2 GHz Opteron 170 vs a Xeon X5460 3.16 GHz. Our old main server had 4 Opteron cores simlar to the ones used in the benchmard, and the Xeon is the processor in our new server.

modular exponentiation python program

Sunday, October 19th, 2008 by webstersprodigy

This is a simple – not efficient – but doable way to do modular exponentiation

alarm clock

Saturday, September 27th, 2008 by webstersprodigy

This is my alarm clock script. It plays a random song from /home/lundeen/alarm #!/bin/sh /usr/bin/X11/xterm -display :0 -bg black -fg white \ -e /usr/bin/mplayer -shuffle  /home/lundeen/alarm/* It runs in cron lundeen@mopey-mythy:~$ crontab -l # m h dom mon dow command 00 07 * * 1-5 /home/lundeen/alarm.sh

python optparse example

Thursday, September 25th, 2008 by webstersprodigy

This is a short commented optparse example #!/usr/bin/env python from optparse import OptionParser #action, type, dest (destination), and help, default #can optionally pass usage in here as a string parser = OptionParser() #notice the first arguments are a list – they define the synonomous commands #destination is the most important – it is what your [...]

gnu readline – python

Thursday, September 25th, 2008 by webstersprodigy

This is the very start of our cryptanal program frontend. (for more up to date see the Software page).

Golay G24

Monday, September 8th, 2008 by webstersprodigy

This is a dirty implemenation of Golay correcting code using python. This is a solution to 18.13 problem 1 from Trappe and Washington’s Crytography book. To run this, you need bash, python, and the numpy libraries. To run, run golay.sh. The algorithm is located in golay.py

isbn-10 validity identifier

Monday, September 1st, 2008 by webstersprodigy

Wellp, here’s a program that does the isbn error checking

python anagram finder

Wednesday, August 13th, 2008 by webstersprodigy

This is a silly little program that finds anagrams. Just hangin out practicing python-fu, and this was a challenge I found online.

Basic TKinter GUI format in python

Wednesday, July 23rd, 2008 by webstersprodigy

Though there are many ways to format your gui code, the following seems to work well for me. It is not pretty, but the important thing is just how I laid it out. Basically, I like making a subclass of frame for almost everything.

TKinter radio buttons in python

Friday, July 18th, 2008 by webstersprodigy

This is pretty straightforward. I tend to structure all my gui programs so far in almost the same way, with the inherited frame class doing all the packing.

md5check directories

Saturday, July 12th, 2008 by webstersprodigy

This is a python script that recursively md5sums all the files in your directory and compares it with another directory. It is similar, and probably less good than “find /dirone -type f -print0 | md5sum”

recursive remove in python

Monday, July 7th, 2008 by webstersprodigy

In the book Programming Python’, an entire chapter is dedicated to recursive copyting of directories, recursive deletion, etc. He uses the os tools to accomplish this. The reason something like this is necessary is the fact that the os tools do not have a built-in recusive delete. For example, if in my current directory I had a folder named ‘test2′, I would get the following error when trying to remove it.

python script similar to cat

Thursday, July 3rd, 2008 by webstersprodigy

This is a stupid script similar to cat. Again, I am using it for windows.

Recursive Search and Replace

Wednesday, June 25th, 2008 by webstersprodigy

This is something I do again and again… traverse down a directory tree searching and replacing for a certain amount of text. Especially since dynamic content is not allowed on ISU’s main webserver (how lame!)

python script similar to join

Tuesday, June 3rd, 2008 by webstersprodigy

python script similar to join. I used this to script on windows, since I could not find a join there. def join(fromdir, tofile):   output = open(tofile, ‘wb’)   parts = os.listdir(fromdir)   parts.sort()   for filename in parts:     filepath = os.path.join(fromdir, filename)     fileobj = open(filepath, ‘rb’)     while 1:       filebytes = [...]

Encrypt a message with RSA in python

Monday, May 5th, 2008 by webstersprodigy

For some people in my class this was easy, and others it was difficult. Some people have spent a good 40 hours on this, so I thought I’d post some code to help out. There isn’t much documentation on the crypto modules.

Get Weather from the commandline

Monday, April 28th, 2008 by webstersprodigy

This is a program written in python that gets the weather from the command line. The usage is like: $ weather.py 83204 5-day Forcast for 83206 ——————— Monday Tuesday Wednesday Thursday Friday High: 74 68 47 49 58 Low: 43 34 29 27 32 It breaks occasionally, most likely because wunderground’s output isn’t consistant.  but [...]

Popular Languages

Friday, April 25th, 2008 by webstersprodigy

I stumbled across this http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html which has the most popular programming languages tracked over 5 years.


No computers were harmed in the 0.341 seconds it took to produce this page.