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

February 7, 2015

Installing PHP Composer globally on Mac & Linux

Composer is a dependency manager for PHP. PEAR used to be the go-to tool for managing PHP dependencies quite some time ago, but it was always cumbersome, and not much fun to use. Composer makes it very easy!

Installing Composer is easy on Mac or Linux:
curl -sS https://getcomposer.org/installer | php

If you want to run it globally, simply move and rename the downloaded .phar file:
mv composer.phar /usr/local/bin/composer

It might even be possible to set it all up in a single command, though I cannot test it right now:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

You can now run the composer command from anywhere in your shell.

composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev

April 28, 2014

Bash shell: Incremental history searching

From using Git, Linux/Ubuntu apt-repositories, or general Bash folder navigation, you may have noticed that pushing the tab button halfway through typing an item/folder name will autocomplete it if it exists. Similarly, we can build an autocomplete feature for user commands that have been entered in the past! They are obviously stored in history somewhere, because you can already chronologically "scroll" through every single command you've issued, or just see it all by entering history. It would be nice to have a quick way to access something specific, complex or lengthy, especially if you already know how it starts.

All you need to do to find a previous command, is to start entering the first few letters of it, then you can navigate all commands you previously issued that started with your entered phrase, by using the up/down arrows! Here's how you set it up:

In terminal, open or create:
gedit  ~/.inputrc

Copy/paste the following there, and save (you may also have to close and reopen a terminal, or reload this way):
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

And done! Now, for example, if I am now looking for the command...
sudo apt-get update

...all I need to do is enter the first few letters, something like...
sud

...and scrolling up/down through my now-selective bash history will allow me to easily locate the command in its entirety for use again!

Adapted from: Ubuntu User Community

April 1, 2014

Windows/Mac/Linux filesharing from Synology NAS accounts

This is really simple to do, but ties in with setting up proper user accounts and permissions. Remember setting up user accounts and permissions? On the final application page, check what is necessary. I have a need for all these services on this particular user account:


Now we need to actually enable file sharing with our operating system. In most cases this should already be filled in, but if it is not, take a look at Control Panel -> File Services:


Since I'm using Windows, I don't presently have a need for Mac File Service, so let's disable that for now.

You should now be able to access your NAS from Windows' Network, and should see it listed as a "computer" along with all the other devices on the network.