Tag Archives: Code Snippet

Erlang Circular Process Communication

The 1984 Chandy / Misra solution to the dining philosophers problem1 requires philosophers to communicate with each other. In Erlang, one way to do this is to have the philosophers tell the philosopher who sat before them that they are neighbors.
Below is my first Erlang program which sets up the circular communication between processes:
%% Dining [...]

Fix Disqus Validation Errors on Wordpress

Disqus is a great comment system but unfortunately the Wordpress plugin generates invalid XHTML. Luckily it’s pretty easy to fix. I’ve made the necessary changes and packaged them up. A simple diff will show the minimal amount of changes needed.
Disqus Wordpress Plugin — Fixed validation

Technorati Authority Boosting Script

“Technorati is an Internet search engine for searching blogs, competing with Google [and] Yahoo.” —Wikipedia. Not only does Technorati allow for blog searching, they have their own rating system called “authority” which is analogous to Google’s PageRank. Authority is a function of how many incoming links a blog has. High authority is critical to finding [...]

Chmod Dirs and Files Separately

Chmod-ing a whole directory recursively is usually not a good idea. Directories should be executable when serving them via http but the documents should not. Here’s a set of commands from the Mercurial book to help separate chmod-ing of directories and files:
$ chmod 755 ~
$ find ~/public_html -type d -print0 | xargs -0r chmod 755
$ [...]

IPNotify

Though there are probably some better solutions out there, I wrote a simple bash script to email me when my server’s IP address changes. My ISP loves to change my IP address randomly, and when I’m not home for extended periods of time, it’s a pain to not have access. This script will email me [...]