Showing posts with label Tools. Show all posts
Showing posts with label Tools. Show all posts

Friday, August 13, 2010

Self Contained C Data Structures and Utils Repository

I've rewritten a couple of data structure and utils (C lang) that I use for my RaleighFS Project, and I've released it at github under BSD License.

At the moment there are some data structures and helper functions:
  • Memory Pool - Simple Memory Allocator.
  • Memory Utils - memcpy(), memset(), memcmp(), memswap() with some variants.
  • Memory Block - copy-on-write block.
  • Hashed Containers: Hashtable, Set, Bag.
  • Queue - FIFO/Circular Queue.
  • Cache - LRU/MRU Cache.
  • WorkQueue - Lightweight pthread workqueue.
  • Sort/Merge functions.

Every "object" is self contained, you can grab the "hashtable.c/hashtable.h" file to be ready to use the hashtable, no other dependence is required. And if data structure require a malloc() you can specify your own allocator during object initialization.

Saturday, January 30, 2010

PyQt4 Schema Script

I've received a couple of emails asking me what I use to draw various graphs and schema that I post on this blog. And the obviously answer is QPainter! I've a small PyQt script that does the easy things but the more difficult one is coded every time...


The script is really simple, it take an xml input and just draw the few items that can recognize. You can use RGBA colors and you can draw linee-paths, like in the image above. The XML looks like this one:



<!-- Green Rect -->
<item type='rectangle'
x='130' y='140' width='140' height='60' 
border='1/0x98b954' 
color='0xf4ffe4/0xdbfdab' />

<text x='130' y='140' width='140' height='60'
color='0x000000' font='Arial'
size='12' bold='false' italic='true'>
I'm just a Test!
</text>        

<!-- Links Line -->
<line path='70,120;70,170;130,170' />



I know that it's a stupid thing and making xml seems to be a long job, but this is what I need at the moment, maybe in the future this script will get a WYSIWYG ui but at this time is just a simple script that generate an image :)

The source code with the above example is available here: PyQt4 Schema Script.

Friday, May 29, 2009

Tool: IP Packet Sniffer

Today I've implemented a simple IP Packet Sniffer.

Sometimes is useful to know what're the IP packages that transit on your network, for Analyze network problems, Monitor network usage, Debug client/server communications or Debug network protocol implementations.

The tool is very simple, but I think that can be useful to learn something more about IP and TCP packets and Protocols implementation.

Maybe you can extend this Tool to support other Transport Layer Protocol.

Note: You need to run it as Root.

You can find the Source Code Here: IP Packet Sniffer Source Code.