Sometimes we need to create a file from Finder directly. And this is strange that Finder allows easily to create a folder but not a file! Although Linux and Windows file browsers have this option. So, let's enhance Finder!
First start Automator (Launchpad / Other / Automator). In the chooser that appears next, select Service.
At the top of the Automator main window, set the "Service Receives Selected" drop-down to "files or folders". Then select Library / Utilities in the left tree menu. Next drag (or just double click) "Run AppleScript" into the main working area (mid-right). Here you will get "Run AppleScript" box. Paste the following AppleScript into this code box, then click the hammer icon to compile the code:
on run {input, parameters}
tell application "Finder"
set currentPath to insertion location as text
set x to POSIX path of currentPath
end tell
return x
end run
Next double click on "Set Value of a Variable" (also in the LIbrary / Utilities section). Click the "Variable" drop-down and create a new variable. Let's call it currentFolder.
Select Library / Text in the left tree menu. Next drag (or just double click) "New Text File" into the main working area (mid-right). Here you will get "New Text File" box.
Drag the variable you just created (currentFolder) from the Variable panel at the bottom of the Automator window to the "Where" selector of the "New Text File" action. Change "Encoding" to "Unicode (UTF-8)". Click the New Text File's "Options" button (at the bottom of the box) and select "Show this action when the workflow runs". This will allow you to specify the names of new files.
Save the service with "File / Save ..." top menu and give it a name (For example "New File"). To test it, in the Finder go to the folder where you want to create a new file. Control-click on an existing file within that folder and select "New File" from the "Services" submenu. A dialog should appear requesting a filename. Enter one then click "Continue"; your new file should appear.
This obviously creates a text or RTF empty file (file with .txt or .rtf extension). You can change the extension to whatever you need as the last step.
Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop
Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard
Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard
In Leopard and later, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):
Space, to lock the size of the selected region and instead move it when the mouse moves
Shift, to resize only one edge of the selected region
Option, to resize the selected region with its center as the anchor point
Formats
Different versions of Mac OS X have different formats for screenshots.
Mac OS X 10.2 (Jaguar): jpg
Mac OS X 10.3 (Panther): pdf
Mac OS X 10.4 (Tiger) and later: png
In Mac OS X 10.4 and later, the default screenshot format can be changed, by opening Terminal (located at /Applications/Utilities/Terminal) and typing in:
defaults write com.apple.screencapture type image_format
killall SystemUIServer
Where image_format is one of jpg, tiff, pdf, png, bmp or pict (among others). If you omit the second line, you will need to log out and in again for the change to take effect.
Grab and Preview
Instead of using the keyboard shortcuts above, screenshots can be taken by using the Grab application included with Mac OS X. It is located at /Applications/Utilities/Grab.
In Mac OS X 10.4, the Preview application can also be used to take screenshots, by using the Grab submenu in the File menu.
From the Terminal
The screencapture command in the Terminal can also be used to capture screenshots, and is useful for scripts. Here is an example.
After upgrading to 10.8.2 I have got a problem with adding a new entry into hosts file: the update was recognised only after system restart. But a more easy solution was just to flash DNS cache! So,
... flushing your DNS cache in Mac OS X is actually really easy, and there are two different commands to use, one for Leopard and for Tiger. Depending on your version of OS X, open your Terminal and follow the appropriate directions below:
Flushing DNS Cache in OS X Lion (10.7) and OS X Mountain Lion (10.8)
Launch Terminal and enter the following command, you will need to enter an administrative password:
sudo killall -HUP mDNSResponder
Note the dscacheutil still exists in 10.7 and 10.8, but the official method to clear out DNS caches is through killing mDNSResponder. You can also find that process running in Activity Monitor.
Flush DNS Cache in Mac OS X 10.5, Mac OS X 10.6
Launch Terminal and issue the following command:
dscacheutil -flushcache
All done, your DNS has been flushed. On a side note, the dscacheutil is interesting in general and worth taking a look at, try the -statistics flag instead for some stats.
Flush your DNS Cache in Mac OS X 10.4 Tiger
Type the following command in the Terminal:
lookupd -flushcache
That’s it - now your DNS settings should be as you intended them to be :-)
After Xcode installation and trying to build mc I've got:
configure: error: C compiler cannot create executables
Google offers to install Xcode correctly (this is a different story however) or to reinstall it. Hmmm. Good idea but in my case the following simple action solved the issue: symlinks for compilers - that's all ! KISS