Archive for June, 2012

Reference first argument in move command

mv /path/to/dir/filename.txt !#^:h/newname.txt

Where :

! means history expansion

# means command currently being typed

^ means the first argument

:h gets the “head” that is the directory without the filename portion

Apache rewrite rules

Rewrite to a folder and hide the folder name in url :

RewriteCond     %{SERVER_NAME}    ^sitename.com        [NC,OR]
RewriteCond    %{SERVER_NAME}    www.sitename.com    [NC]
RewriteCond    %{REQUEST_URI}    !^anyfiletoexclude.php    [NC]
RewriteCond    %{REQUEST_URI}    !^/foldertoredirect/    [NC]
RewriteCond    (.*)        /foldertoredirect/$1

force use www

RewriteCond    %{SERVER_NAME}    ^website.com$
RewriteRule    ^/(.*)        http://www.website.com/$    [L,R]

Configure Vsftpd in amazon ec2 instance

pasv_enable=YES
 pasv_min_port=12000
 pasv_max_port=12100
 port_enable=YES
 pasv_address=<public ip of your elastics>

Reset A2Billing admin password

echo "update cc_ui_authen set pwd_encoded = '410fc6268dd3332226de95e42d9efa4046c5463769d7493b85e65cfa5c26362dc2455cc23c0bc5831deb008def4ab11a9eaa9b76ba3f377da134f39ec60dd758' where login='root'" | mysql -pPASSWORD DATABASE

 

This will reset username and password to : root/changepassword

Mounting Open stack Cloud Object Storage in Linux

Prerequisites:

libcurl and libcurl-devel  fuse, fuse-devel, and fuse-libs libxml2 and libxml2-devel

Download the cloudfuse :

This version doesnot support mounting at container level :

wget https://github.com/redbo/cloudfuse/tarball/master

This supports mounting at container level:

https://github.com/vfloz/cloudfuse/tarball/master

tar -zxvf master

cd <extracted dir>

./configure

make && make install

 

Create an entry in your fstab:

cloudfuse  /mount/point fuse username=<username>,api_key=<api key>,container=containerName,authurl=<authurl>

mount -a

Read readme.txt for more information.

Perl Issues and Solutions

Display The Include paths for perl :

perl -e 'print join("\n", @INC);'

View Cpan Configuration:

cpan>o conf

Find perl module’s Path:

perl -MList::Util -e'print $_ . " => " . $INC{$_} . "\n" for keys %INC'