C/C++

Finding anagrams in a list

I was reading quora and came across a post about someone who was rejected from facebook for a sloppy answer. The question was to make a list of words where the anagrams were grouped at the top.

People consoled the guy.

The answer seemed like a unixy thing. It's not that hard, the trick is to create an index for each word, where the index is the word, sorted by letter.

Small Hack to Send SMDR to Syslog for IP Office and other PBXs

This is a work in progress. I wanted to log all our calls and found out that there's a feature in IP Office called SMDR that sends logs to a server.

There were a few programs that could receive these logs, but I couldn't find one that just logged the lines to a syslog. After initally reading how to do it in Python and looking a the Perl code from SimpleSMDR, it seemed like too much code. This small C program, smdr-syslog, to does what I want.

Find Your Compromised Email Scripts: Wrapper to Execute sendmail (or qmail-inject) for Web Apps

This is yet another sendmail wrapper to help detect webmail scripts that might be spamming. It's designed for the qmail with the QMAILQUEUE path, and the qmail-qfilter filter framework. You need to write a filter that will scan the mail going out, or use Spamassassin if you want general spam filtering.

What you do is, change the sendmail program setting in php.ini to run this program, which I call metasendmail.

EasyCZ Button Switchboard

This is a simple (or simplistic) Linux GTK+ application that shows a button panel or "switchboard". Each button executes a script.

g_signal_connect_data instead of g_signal_connect_object, because GHashTable is not a GObject

I just blew two hours figuring out that a GLib GHashTable is not a descendent of GObject. Duh!

How to use Tags or Ctags to Browse Code with Vim

This is a short tutorial about using ctags (or exuberant ctags) to work with the vim editor to give you a great code browser. Vi and it's successor Vim have a built-in feature to allow you to jump from a use of a function call to the definition of that function call. It's a good way to learn about a library of code: load up some example code, and then read it, jumping from the function calls to the definitions.

To use tags, you must first install ctags or exuberant-ctags. They are in the repositories. To run it, go to the root of your source tree and type:

ctags -R *

Comparison Shopping for Toilet Paper, in multiple computer languages.

It's hard to concentrate when you're tired and cranky, so I wasted some time writing a simple calculator in several different languages.

Shared Memory Example

Here's one for the noobs (from a noob). This demonstrates the use of shared memory. It's a program that spawns 10 children, and each one gets a special "babytalk" word to say.

Syndicate content