I had to parse an access_log of a website, in order to generate a sitemap. More precisely, a list of all URLs in the site. After playing around I’ve found a solution using sed
, grep
, sort
and uniq
. The good thing that each of this tools is available by default on most Linux distributions.
Continue reading Generating URL List from Access Log (access_log)
Category: Tips
rzip vs. bzip2 – A short comparison
I decided to benchmark rzip against bzip for my backup needs. The benchmark was performed on a 89M tar archive of a directory which I regularly backup using my Amazon S3 backup script. The directory contains mostly LaTeX, PDF and Open Office files, so this benchmark may reflect very different results than what you will get if you will test it on other kinds of files.
Continue reading rzip vs. bzip2 – A short comparison
usb 1-4: device descriptor read/64, error -71
When I try to connect my Sansa Clip MP3 player to the linux box I see the following error in dmesg
:
usb 1-4: device descriptor read/64, error -71
and the device recognition fails. The player’s battery gets reloaded but I can’t mount it and transfer songs.
Continue reading usb 1-4: device descriptor read/64, error -71
Start Trac on Startup – Init.d Script for tracd
As part of a server move, I went on to reinstall Trac. I’ve tried to install it as FastCGI but I failed to configure the clean URLs properly. I got the clean URLs to work if the user access them, but Trac insisted on addeing trac.fcgi
to the beginning of every link it generated. So I’ve decided to use the Trac standalone server, tracd
.
The next problem I faced was how to start the Trac automatically upon startup. The solution was to use an init.d
script for stating Trac. After some searching, I didn’t find an init.d
script for tracd
that were satisfactory (mostly poorly written). So I went on an wrote my own init.d
script for tracd
.
Continue reading Start Trac on Startup – Init.d Script for tracd
Clean URLs (Permalinks) for WordPress on Lighttpd
I’ve moved my blog in the last few days to a new bigger dedicated server (as well as some other sites I own). After doing some benchmarks (I plan to post those soon) I’ve decided to switch to Lighttpd. While the exact migration notes are the topic of another post, I can say that I’m fairly satisfied with the move.
After setting up the server, I started moving the blog. Importing the files and the database was pretty straight forward. But when I thought every thing is ready and I transfered the domain to the new server I’ve found out that none of my inner pages are accessible. The reason, as it turned up pretty quickly, is that the WordPress depends on Apache’s mod_rewrite
to create the clean URLs (the so called permalinks). This actually posed two problems:
- WordPress depends on Apache’s
mod_rewrite
. - WordPress used
.htaccess
files for the clean URLs configuration
Continue reading Clean URLs (Permalinks) for WordPress on Lighttpd
WordPress Backup Script
This is a small script I’ve written to automate my server-side backups of my blogs. It creates a backup of both the database and the actual WordPress files.
#!/bin/bash
# (C) 2008 Guy Rutenberg - http://www.guyrutenberg.com
# This is a script that creates backups of blogs.
DB_NAME=
DB_USER=
DB_PASS=
DB_HOST=
#no trailing slash
BLOG_DIR=
BACKUP_DIR=
echo -n "dumping database... "
mysqldump --user=${DB_USER} --password=${DB_PASS} --host=${DB_HOST} ${DB_NAME} \
| bzip2 -c > ${BACKUP_DIR}/${DB_NAME}-$(date +%Y%m%d).sql.bz2
if [ "$?" -ne "0" ]; then
echo -e "\nmysqldump failed!"
exit 1
fi
echo "done"
echo -n "Creating tarball... "
tar -cjf ${BACKUP_DIR}/${BLOG_DIR##*/}-$(date +%Y%m%d).tar.bz2 ${BLOG_DIR}
if [ "$?" -ne "0" ]; then
echo -e "\ntarball creation failed!"
exit 1
fi
echo "done"
Notes About Using amsmath split Environment In Hebrew Documents
Recently I’ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:
Package amsmath Error: \begin{split} won't work here.
Continue reading Notes About Using amsmath split Environment In Hebrew Documents
Vim Syntax Highlighting For Google Gadgets
I started developing Google Gadgets for LabPixies, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets’ code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I didn’t like as it required me to wrap the HTML code with a specific comment. As I don’t like this kind of solution, I’ve decided to create my own syntax highlighting file for Vim.
Continue reading Vim Syntax Highlighting For Google Gadgets
Backup Directories To Amazon S3 Script
This is a small script I wrote today, to automate my backups, which I do on Amazon S3. This is fairly short, yet useful bash script that utilize the s3cmd to do the actual sending of the files.
Continue reading Backup Directories To Amazon S3 Script
Activating Guarddog Settings on Startup
Like many Linux users, I use Guarddog as a frontend to my iptables firewall. At some point, I noticed that Guarddog started acting strangely. Every time I restarted my computer, all internet traffic was blocked (both in and out). The only way to fix this situation was to open Guarddog and press “Apply” (without doing any changes). While it was annoying, it didn’t bother me much because I used to restart my computer about once a month. But few days ago, I decided to solve this problem once and for all.
Continue reading Activating Guarddog Settings on Startup