07.05.08

WordPress Backup Script

Posted in Bash, Tips at 11:15 am by Guy

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=guy_blog
DB_USER=guy_root
DB_PASS=****
DB_HOST=localhost
 
#no trailing slash
BLOG_DIR=/home/guyru/guyrutenberg.com
BACKUP_DIR=/home/guyru/backups
 
 
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"

Read the rest of this entry »

04.05.08

spass 1.1 - Secure Password Generator

Posted in C/C++, Projects, spass at 11:14 pm by Guy

This is a new version of my /dev/random based secure password generator - spass. The new version doesn’t have new features, it’s mainly a bug-fix release. The package now uses autotools, which means it has the standard configure script and makefile. I also fixed some typos in the help message. Overall the new version doesn’t offer anything new compared to the old one, except for easier installation.
Read the rest of this entry »

30.04.08

mctext 0.2 - A Markov Chain Text Generator

Posted in C/C++, Projects, mctext at 8:41 pm by Guy

This is the second release of my Markov Chain text generator - mctext. This text generator takes existing sample text, and generates a new text using Markov Chains.

The main new thing in the version in that it allows the users to specify via the command line how many words should be considered when generating the next one. The bigger the step number the closer the generated text is to the original one. The value used in mctext-0.1 was 2, and this is also the default in this one. The number of steps can be set using the --steps command line switch.
Read the rest of this entry »

26.04.08

Pull vs. Push MVC Architecture

Posted in Uncategorized at 2:56 am by Guy

I intended to write this post couple of months ago, when I worked on a pull based MVC framework for some site. Most web-developers are acquainted with the MVC architecture and almost all the major web-frameworks uses this concept, including Ruby on Rails, CakePHP, Django, Symfony and others. So what is MVC and what’s the difference between pull and push?
Read the rest of this entry »

19.04.08

Equality-at and Relation-at LaTeX Macros.

Posted in LaTex at 8:36 am by Guy

These are two useful LaTeX macros for creating equality-at and (the more general) relation-at signs. These macros depend on the mathtools package. As with all other macros you should add them to you preamble in order to use.

The general macro is the \relat. It takes two arguments, the relation and an expression where the relation takes place (the “at”). The equality-at macro, \eqat is a specific case of \relat. I’ve created it because it is commonly used and only requires passing the “at” argument.
Read the rest of this entry »

14.04.08

A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Posted in Greasemonkey at 7:34 am by Guy

Following comments in Fixing the Home Link in the Telem System (Open U) I’ve decided to fix the top bar links in the Sheilta system too.

The links in the top bar are javascript links that open in a new window when clicked. My Greasemonkey script turns them into regular links that you can open in a new tab.

Read the rest of this entry »

09.04.08

Notes About Using amsmath split Enviroment In Hebrew Documents

Posted in LaTex, Tips at 7:25 am by Guy

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.

Read the rest of this entry »

05.04.08

Hidden Spam Links in Wordpress

Posted in Uncategorized at 12:08 am by Guy

About a week ago, I’ve decided to look at the HTML source of my blog. I was in total shock to find a spam link hidden there. This is how it looked:

<!-- ocadia theme credits, downloaded from wpthemesfree.com -->
<u id="ocadia" style="display: none">Buy some <a href="http://detoxbuddy.com/categories/191.html">marijuana drug testing</a> products</u>

Ocadia is the name of theme I’m using, so I guessed the hidden link came from there. I was partially right. The code indeed resided in the index.php file of the theme, but as I later found out, the theme had nothing to do with that. I removed link and the comment immediately, and went to see if the it was distributed this way from Beccary (the author of the theme.
Read the rest of this entry »

28.03.08

Vim Syntax Highlighting For Google Gadgets

Posted in Tips, vim at 11:26 pm by Guy

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.
Read the rest of this entry »

19.03.08

Scanning Documents Written in Blue Ink - biscan

Posted in Projects, biscan at 1:08 am by Guy

After writing the post on converting PNMs to DjVu I’ve ran into some trouble scanning documents written in blue ink. The problem: XSane didn’t allow me to set the threshold for converting the scanned image to line-art (B&W). So, I tried scanning the document in grayscale and in color and convert it afterwards to bitonal using imagemagick. This ended up with two results. When I used the -monochrome command line switch, the conversion looked good, but it used halftones (dithering), when I tried to convert it to DjVu it resulted in a document size twice as large as normal B&W would. The other thing that I tried is using the -threshold switch. The DjVu compressed document size was much better now, but the document was awful looking, either it was too dark, or some of the text disappeared. After giving it some thought I knew I can find a better solution.
Read the rest of this entry »

« Previous entries