Author Archives: COMP-E

Python – State Machine Code

This is a template for a finite state machine that is dynamically built based
on the function names and docstring for the given functions Continue reading

Posted in Python, regex | 1 Comment

Python – Filter directory contents

short and sweet, this python snippet will return a list containing your filtered directory import re import os filter = “.*” + searchstr + “.*” m = re.compile(filter,re.I) #if you want to ignore case use re.I, otherwise remove it filter(m.search,os.listdir(os.getcwd())) … Continue reading

Posted in Python, regex | Tagged , | Leave a comment

Python – Use regex to split hyphenated words

I was asked this question on stackoverflow, and figured I’d repost it here since I wrote it after all. s = “-this is. A – sentence;one-word what’s” re.findall(“\w+-\w+|[\w']+”,s) result: ['this', 'is', 'A', 'sentence', 'one-word', "what's"] make sure you notice that … Continue reading

Posted in Python, regex | Tagged , | Leave a comment

Python – Chunk string or data buffer

I was disappointed that there was no good way to chunk up data for string formatting or packetzing UDP data. After a bit of thought, and a desire to avoid using python code to do loops, I came up with … Continue reading

Posted in Python, regex | Tagged , | Leave a comment

Python – Convert 16bit image to 24bit image 565 to 888

Doing the following is much better than using putpixel and a for loop, as numpy uses c-functions. The actual execution speed is about .3 seconds faster on a 240×320 RGBA image. import numpy as np arr = np.fromstring(buff,dtype=np.uint16).astype(np.uint32) arr = … Continue reading

Posted in Image Processing, Python, comp-e | Tagged , , , | Leave a comment

Image Analysis Using Python

/* work inprogress ;p */ While I may be a fan of embedded systems, I have to admit that python has become my new love. Thought taking into account that you can do sweet Matlab style dsp with it, you … Continue reading

Posted in comp-e | Leave a comment

Verilog Examples For The Spartan 3 / Nexys 2 Boards

Well, I thought I’d be extra generous since I haven’t posted in so long, and have uploaded 4 verilog examples for your viewing pleasure. I have been a bit busy to comment them but I hope that they may be … Continue reading

Posted in Verilog, comp-e, forum | Tagged , , , , | Leave a comment

Pythons in the ‘C’ircus

Spiffy code that is.  Stubby has made a few contributions as of late, so check them out.  I will be ragging on him to put his battleship game up, but alas it seems it’s lacking comments so we’ll see how … Continue reading

Posted in C, comp-e, forum | Tagged , , , | Leave a comment

Creating Morse Code Using The HCS08 Microcontroller

Recently I was faced with the task of sending data out of a HCS08 microcontroller wirelessly.  I had only one pin available to me and decided to effectively create Morse Code so that my receiver could decode the signal without … Continue reading

Posted in C, Microcontrollers, forum | Tagged , , , , | Leave a comment

Javascript Examples

In addition to fixing the forum today, I also decided to post a couple ‘fun’ javascript applications that I’ve made.  I’m not the best with java script and these two apps are my first attempts.  However, they are functional and … Continue reading

Posted in Javascript, forum | Tagged , , | Leave a comment