Publishing from emacs org mode to wordpress

With this tool, you can publish directly from emacs org mode to your wordpress blog. Quick start Installation from marmelade repo: M-x package-install org2blog Add to ~/.emacs: (setq load-path (cons “~/.emacs.d/org2blog/” load-path)) (require ‘org2blog-autoloads) (setq org2blog/wp-blog-alist ‘((“myblogname” :url “http://myblogaddress/xmlrpc.php” :username “myusername”))) Open new org-mode document and execute: M-x org2blog/wp-login M-x org2blog/wp-new-entry Set variables (you can [...]

Posted in Desktop
Tags: ,

Easy way to convert svn repository to git

To quickly convert svn repo to git (with history), all you need is: git svn clone my_svn_adddress But, you’ll probably also want to convert old svn usernames to git author names + e-mails. You can do that with -A switch: git svn clone my_svn_adddress -A users.txt users.txt example: my_old_username = My Name <my_email@example.com> my_old_username2 = [...]

Posted in System administration
Tags: ,

Easy way to remove all .svn directories inside directory tree

If you want to check first what will be removed (good idea), run: find . -name .svn -type d Now run the same command with rm xargs: find . -name .svn -type d | xargs rm -rf

Posted in Linux
Tags: , ,

Zsh named directories

Zsh has a useful feature called Named directories. Usage is simple, you can define it with hash command: hash -d my_dir=/home/user/some/deep/directory/structure Now you can use it like normal directory, just add prefix ~: cd ~my_dir cp ~my_dir/file.txt /other_dir/

Posted in Linux
Tags: ,

Starting new project with yiiframework

This is the procedure I use for creating new projects with yiiframework: Download latest code from http://www.yiiframework.com cd ~/tmp wget http://yii.googlecode.com/files/yii-1.1.5.r2654.tar.gz tar xzvf yii-1.1.5.r2654.tar.gz Create a new directory for the project: mkdir ~/workspace/www/myproject cp -R ~/tmp/yii-1.1.5.r2654/framework/ ~/workspace/www/myproject Create an initial application skeleton: cd ~/workspace/www/myproject framework/yiic webapp public Move application directory outside from webroot (for security [...]

Posted in Programming
Tags: ,

Xmarks replacement

I’ve used Xmarks for bookmarks synchronization between multiple computers, but sadly, they are shutting down their service. Since I use Firefox as my main browser, I decided to switch to Firefox Sync, which in addition to bookmarks, allows synchronization of preferences, passwords, history and tabs. It will be integrated into Firefox 4, for versions 3.5 [...]

Posted in Web
Tags: , ,

How-to: AWstats installation and configuration on Debian

This is a simple tutorial on how to install AWstats on Debian and configure it for displaying web statistics. I’ve tried this on lenny, but it should also work on other versions with small or no modifications. First, make sure your web server is configured to write access logs to combined format. This is default [...]

Posted in System administration
Tags: , , , , , ,

Vertical centering with CSS

One of the biggest weaknesses of CSS is lack of support for vertical centering. There are many tricks to achieve this and each of them has advantages and disadvantages. The method I use is based on method from jakpsatweb’s web site and this webmasterworld’s forum post, with slight modifications. It works fine in all popular [...]

Posted in Programming
Tags: ,

Reducing reserved blocks percentage to free disk space

ext2, ext3 and ext4 filesystems by default reserves 5% of filesystem blocks for use by privileged processes. On modern drives with a lot of space, that can result in much lost space. Fortunately, that behavior can be easily changed with command tune2fs. For example, partition /dev/sdb5 have 384MB and default reserved blocks: nevermind1:/# df -h [...]

Posted in Linux
Tags: , , ,

Protecting PHP scripts from Cross-site scripting (XSS) attacks

Cross-site scripting (XSS) attacks are one of the biggest threats to dynamic web pages. Up to 80 percent of all web sites are vulnerable to some type of this attack. Yet, many programmers and site owners are simply not aware of this problem. So, how it works? Generally, you have some web site which doesn’t [...]

Posted in Programming
Tags: , ,