CoolProgrammer's Linux-Powered Home

Code Snippets

Useful bits of code:

ptr.h -- the automatic pointer
This defines a reference counting automatic pointer template. So, if you want a pointer to an object Example, you declate ptr_t<Example> example; and example will now behave almost exactly like an Example *, except that you never need to free it--you may pass it to other functions (so long as they expect this template as input and not a normal pointer), store it in class instances, etc., and it will free itself once it is no longer referenced.
userspace.py -- CPUFreq manager
This is a simple graphical interface to the Linux frequency scaling driver--very useful on a laptop!
1