Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

how to avoid being asked "Enter passphrase for key " when I'm doing ssh operation on a remote host?

 On Mac, add UseKeyChain to ~/.ssh/config


nano ~/.ssh/config

and add the following


Host *

    UseKeychain yes

Quickly Show/Hide Hidden Files on macOS Sierra, OS X El Capitan & Yosemite

The Quickest Way to Show/Hide Hidden Files

Since the release of macOS Sierra, when in Finder, it is now possible to use the shortcut:
 CMD + SHIFT + .
Press once to show hidden files and again to hide them. If you’re using a version earlier than macOS Sierra, see Show/Hide Hidden Files using Terminal Aliases to setup a toggle command via terminal.

Show/Hide Hidden Files the Long Way

The long way to show hidden Mac OS X files is as follows:
  1. Open Terminal found in Finder > Applications > Utilities
  2. In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES
  3. Press return
  4. Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.
Relaunch Finder by right clicking the Finder Icon whilst holding the `option/alt` key
Relaunch Finder by right clicking the Finder Icon whilst holding the ‘Option/alt’ key
This will show all hidden files. To hide them again, follow the same steps but replace the Terminal command with:
defaults write com.apple.finder AppleShowAllFiles NO
It’s not the longest set of instructions or the biggest command to commit to memory but if you’re doing this a lot, it’s worth spending a few minutes now to save yourself a lot more time in the future.

Open link in a new tab using Chrome Browser + Selenium Java

Actions action = new Actions(driver);
WebElement link = driver.findElement(By.linkText("Gmail")); action.moveToElement(link).keyDown(Keys.CONTROL).click(link).build().perform();


Note:
For windows, this is Keys.CONTROL
For Mac, this is Keys.COMMAND

Running PHP on the macOS / Mac OS X Apache Web Server

PHP 5 is installed in macOS / OS X by default, but the built-in Apache web server may not be configured to automatically run PHP. To enable PHP, the apache configuration file needs to be modified. This file is located in the following location: 

/etc/apache2/httpd.conf 

In order to edit this file, the permissions on the file must be changed. This can be accomplished by doing the following: 

1. Open a terminal windows (Applications -> Utilities -> Terminal) 

2. Change to the correct directory (cd /etc/apache2) 

3. Change the permissions on the file (sudo chmod 755 httpd.conf)
Once the file permissions are changed, you can use a tool like EditRocket to open the httpd.conf file and modify it. After opening the httpd.conf file, we need to look for the following line: 

#LoadModule php5_module libexec/apache2/libphp5.so 

This line needs to be uncommented by removing the # in front of the line. Remove the # and then save the file.
PHP is now enabled, but we need to restart the apache web server for the changes to take effect. To restart the web server, do the following:

sudo apachectl restart
This will restart the apache server. To test PHP, create a PHP file called test.php in the following directory.
/Library/WebServer/Documents/ 

Enter the following URL to visit the page: 

http://localhost/test.php

Where is Java Installed on Mac OS X?

Use /usr/libexec/java_home -v 1.7 command on a terminal shell to figure out where is your java 1.7 home directory

Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux / OS X Mac


If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.
The full error message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/geek/.ssh/id_rsa
To fix this, you’ll need to reset the permissions back to default:
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
If you are getting another error:
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts).
This means that the permissions on that file are also set incorrectly, and can be adjusted with this:
sudo chmod 644 ~/.ssh/known_hosts
Finally, you may need to adjust the directory permissions as well:
sudo chmod 755 ~/.ssh
This should get you back up and running.

Location of Chrome Extension Source Code On Mac OS X

~/Library/Application Support/Google/Chrome/Default