August 2nd, 2010
I am new to San Francisco and have been using this really cool app called Transporter to find my way through the city. I learned that it is designed by two UC Berkeley students: Ljuba Miljkovic and Thejo Kote.
Apps like these make me pay $30/month for the iphone data plan. Totally worth it
Great job guys!
Tags: iphone app, public transit, san francisco, transporter
Posted in san francisco | No Comments »
November 30th, 2009
Goal: I want to find some text called mytext within all php files in a directory. I also want to display all the matches and highlight them.
If this is what you want try this:
grep -Hin "mytext" *.php | less +/mytext
Tags: find text, grep
Posted in Unix | No Comments »
November 30th, 2009
To find syntax errors in all php pages within a directory called /var/www/html, use the following command:
find /var/www/html -name '*.php' -type f -exec php -l {} \;
Tags: php, syntax error
Posted in Unix, php | No Comments »
November 15th, 2009
Have a big website with millions of records? Is MySQL full-text search letting you down? Sphinx search http://sphinxsearch.com by Andrew Aksyonoff is probably gonna solve your problems. It is an awesome product (and yes it’s open source) with less than a second search results on a data set with millions of records.
I had the opportunity to author a sphinx based search engine for vBulletin. We use it for our huge forums at Internet Brands. A demo can be viewed here:
Tags: MySQL, search, sphinx
Posted in MySQL, Unix | 1 Comment »
November 15th, 2009
From the man watch page: “The -d or --differences flag will highlight the differences between successive updates.”
Try
watch -d -n 3 "free -m"
The above command would highlight the differences in memory consumption every 3 seconds.
Tags: watch
Posted in Unix | No Comments »
November 5th, 2009
I tried a 256 MB slice (that’s what they call a cloud) with Slicehost, a rackspace company, and the guys are AWESOME! Shortly after that, rackspace came up with rackspacecloud.com (they had slicehost, why would they? who cares
), and I have been a big big fan of rackspace. So, I decided to give rackspacecloud.com a shot. Same memory, same disk space, same everything (well I haven’t really needed rackspacecloud.com support that often) and close to half the price.
256 MB on slicehost = $20 vs 256 MB on rackspacecloud.com = $11 approximately (for me atleast)
Doesn’t quite make sense to me
Tags: rackspacecloud, slicehost, vps
Posted in Unix | No Comments »
September 29th, 2009
To duplicate (backup) a file as filename.unixtimestamp use
cp myfilename{,.`date +%s`}
You can change the date format as per your preference. Below would duplicate it as filename.yyyymmdd
cp myfilename{,.`date +%Y%m%d`}
Tags: duplicate files, timestamp
Posted in Unix | No Comments »
September 29th, 2009
To find all files (regular files) modified after 12:00 AM today use
touch -t `date +%Y%m%d0000` /tmp/mintimestamp
find /path/to/search/for -type f -newer /tmp/mintimestamp
rm /tmp/mintimestamp
The trick is to timestamp /tmp/mintimestamp with the timestamp that we want to compare against.
So you would use the touch command below in the above set of commands to find all files modified after 12:00 AM on Jan 1, 2008:
touch -t `date 200801010000` /tmp/mintimestamp
Tags: find files, timestamp, touch
Posted in Unix | No Comments »
September 29th, 2009
Check out my post on migrating website content here: http://priteshjshah.com/?page_id=42
Tags: migrate website content, ssh, tar
Posted in Unix | No Comments »
September 28th, 2009
the -v switch is used to return negative results. So, to find everything which does not contain “findme” use
cat filename | grep -v "findme"
Tags: find text, grep
Posted in Unix | No Comments »