Archive for the ‘Tips & Tricks’ Category

Subversion shortcuts

Tuesday, March 2nd, 2010

Here are some shortcuts I use on an almost daily basis that I constantly forget and then go re-read the blog post. I have taken them from an old post but added a new one:

Bulk add:

svn st | grep ^? | sed 's/? //' | xargs svn add

Bulk remove:

svn st | grep ^! | sed 's/! //' | xargs svn rm

Strip all .svn directories from project:

find . -name .svn -exec rm -rf {} \;

Subversion bulk add or remove

Friday, December 11th, 2009

A couple of one liners to easily bulk add or remove files in subversion:


svn st | grep ^? | sed 's/?    //' | xargs svn add

svn st | grep ^! | sed 's/?    //' | xargs svn rm

svn st | grep ^! | sed 's/!    //' | xargs svn rm

They can even handle files with spaces.

nginx and non document root phpmyadmin

Friday, November 6th, 2009

Recently we have been playing around with nginx for a couple of projects we have been working on and I think I have fallen in love with a web server. After using apache for so many years, I did not think that this could be possible, but it is!! For what we are using it for, it is superior in almost every aspect: installation, configuration, speed, memory usage, etc. Not to mention the fact that most of our apache deployments are often tainted by the beast that is cPanel/WHM… The reason I am writing this article is to hopefully alleviate the pain of trying to figure out how to setup phpmyadmin or other such applications in a non-document root setup when you are just learning the ins-and-outs of nginx configuration.

Just a quick tip because it is probably the main stumbling block when learning nginx configuration vs apache configuration; the root directive works differently in nginx. In nginx it will append the directory from the matching location block to the request. Taken from the docs: “so that a request for “/i/top.gif” will not look in “/spool/w3/top.gif” [but in /spool/w3/i/top.gif] like might happen in an Apache-like alias configuration where the location match itself is dropped. Use the alias directive to achieve the Apache-like functionality.” But I digress.

Most of the online documentation and tutorials explain how to get php running globally or how to get phpmyadmin to work from document root, but I had to dig deep to get it to work like www.domain.com/phpmyadmin/ . I didn’t want every .php script to be run as php and I did not want phpmyadmin installed at document root. Here is what I found:


location /phpmyadmin {
    root           /usr/local/nginx/html;
    index          index.php;
}

 location ~ ^/phpmyadmin.+.php$ {
    root          /usr/local/nginx/html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

(more…)

Nifty Twitter Tip (Twip?)

Monday, September 28th, 2009

It turns out you can easily provide a link for your users to post something to their twitter account; say a link to an interesting blog post or some other such thing.

http://twitter.com/home?status=Check+Out+This+Blog+Post:+http://cli.gs/3ZeD5X