find server ip address
To find a server IP address
ifconfig eth0 | grep inet | awk '{ print $2 }'
Related cards:
Find Class of a variable in Javascript
As we have object.class method in Ruby, to check the class of a variable in Javascript, here is the snippet
var ss = "some string";
alert (typeof ss); #=> string
alert (typeof pp); #=> undefined
Find text in linux files
grep -rnw 'directory' -e "text-to-search"
-r is recursive, -n is line number and -w stands match the whole word.
grep --include={*.c,*.h} -rnw 'directory' -e "pattern"
This will only search through the files which have .c or .h...
detect and select method in ruby
detect method in ruby returns the first item in the collection for which the block returns TRUE and returns nil if it doesn't find any. It has an optional argument containing a proc that calculates a “default” value — that is, the value to return ...
gmail hack
The below hack might come in handy for testing when a unique account is required.
You can throw '.'s into gmail email addresses and they all end up at the same address on gmail.
All the below email addresses end up as same.
abc@gmail.com
ab....
Copy remote folder to local
To copy a folder in the remote server to your local machine,
scp -r username@IPaddres:/remote/directory/path /local/folder/
In case you wish to copy in your current local directory
scp -r username@IPaddres:/remote/directory/path/ .
apache configuration file location
There is no default location for apache configuration file (httpd.conf) as this can be configured. To know the location run the below commands.
ps -ef | grep apache
root 4053 1 0 06:26 ? 00:00:04 /usr/sbin/apache2 -k start
w...
deploying wordpress blog in rails application
1.First of all make sure that your server can parse both php and rails application.
-
Make a blog directory in side the public folder of rails application.
-
Deploy all WordPress content inside blog directory.
-
Configure your database conne...