Browsed by
Author: Kenneth Holter

Simple script for dumping a MySQL database

Simple script for dumping a MySQL database

As file system backups might fail to backup open files, it’s good practice to close any open files before running the backup. Closing a MySQL database file means you will have to stop the MySQL server itself, causing causing a database outage while the backup is running. But fortunately there’s a smarter way to backup you database – simple dump the entire database to a file (which is automatically closed when the dump is completed), and have your file system…

Read More Read More

Setting up Sublime Text as a node.js development environment

Setting up Sublime Text as a node.js development environment

Sublime Text makes a great IDE for node.js development. First, install the node.js software and get your initial project up and running. Various tutorials on the web should get you going. When it’s time to run your app, configure the Sublime Text build system to build it and run it. To avoid having to start and stop your Node server manually, make use of the tool Nodemon – this tool will build and run your app automatically when you edit…

Read More Read More

Setting up dual monitors in Xubuntu 11.04 on Fujitsu P7120

Setting up dual monitors in Xubuntu 11.04 on Fujitsu P7120

I recently installed Xubunut 11.04 on an old notebook laptop, and wanted to run a dual monitor setup using an external monitor. The laptop ships with Intel Graphics Media Accelerator 900, and I’m using this display controller:

My external monitor is running with a 1280×1024 resolution, and are placed on the left hand side of the laptop.

Using swatch to throttle script log messages

Using swatch to throttle script log messages

At work we have a few scripts that we would like to monitor, and define a few messages that should trigger an SMS to be sent to the person on call. As most of these scripts log to syslog, and we have a our linux servers set up to forward syslog messages to a central log host, we going to monitor the central syslog for important messages originated by the scripts. In order to avoid message storms, however, we need…

Read More Read More

Simple script for testing regular expressions in Perl

Simple script for testing regular expressions in Perl

At work the other day I was creating regular expressions (regexps) in perl for use with swatch. Instead of testing the regexps by entering them into the swatch config file, restart swatch, and use the “logger” command to trigger swatch to take action, I thought I’d simplify it by creating a small script. Since swatch is written i perl, I created a tiny script in perl so that there wouldn’t be any regexps mismatch between how the script interprets regexps…

Read More Read More

Small PHP-script for checking concert tickets availability

Small PHP-script for checking concert tickets availability

I’m waiting for some concert tickets to be available for purchase (the Steve Vai concert at Las Vegas Hilton in May). Instead of checking the Steve Vai tour dates web page ever day, I wrote a small script to do it for me every time I visit my own site (just for fun, of course). First, let’s execute the script to check the availability of the concert tickets: This is the script:

(In the code output above I stripped the…

Read More Read More

Experimenting with hugepages to reduce CPU and memory resources

Experimenting with hugepages to reduce CPU and memory resources

Most computers today have support for virtual memory. An application (i.e. process) running on such computers sees its address space as one large range of contiguous addresses, even if its memory chunks may be scattered around the physical memory (RAM). This means that when the process requests a particular memory location, the computers must figure out which physical memory location this corresponds to. The mapping of virtual memory to physical memory is stored in the page tables. For processes that…

Read More Read More