Technical Recipes

Friday 27, January 2012

If you need to display how many memory are using your commands running on a machine, you can execute the following command:

$  ps -u arturo -o rss,comm

arturo should be replaced for your current user. RSS means Resident Set Size and it shows the physical memory used by the process in kilobytes (kB).

tags: sysadmin

Wednesday 4, January 2012

Usually you need to get upstream changes to your forked repo. To do that, just execute these lines:

$ git fetch upstream
$ git merge upstream/master

First line gets changes for upstream and second one merge these changes into your forked repository.


Monday 19, December 2011

Just add the following lines to your nginx.conf file:

location  /mydirectory  {
  auth_basic            "Restricted";
  auth_basic_user_file  htpasswd;
}

The htpasswd could be create with the following command:

$ htpasswd -c htpasswd myuser

To see how to do that with Apache take a look here.


Monday 19, December 2011

Sometimes it's very useful to protect a web directory with user/password. Apache web server offers us a simple method to do that based on HTTP basic authentication. We need to create a specific file called .htpasswd, then our conf. file should be changed for adding the protection. Let's do it:

$ htpasswd -c .htpasswd myuser

The previous command will create a new file called .htpasswd. This file should be located inside the directory which will be protected. Then we need to change our Apache's conf. file adding these lines:

<Location /mydirectory>
    AuthUserFile /home/myuser/mydirectory/.htpasswd
    AuthName "Protected area"
    AuthType Basic
    require valid-user
</Location>

When a user access to protected directory Apache will display a dialog box asking for user/passwd.

tags: Apache

Tags

My latest tweets

tweet Improving programmers productivity http://t.co/0TVRcQD0
tweet Comparing PHP vs Python vs Ruby http://t.co/gnziQuWd
tweet Last toy http://t.co/7FgJSzoY
tweet Learning a lot from @codeschool. I've just paid for a subscription. Well done!
tweet Choosing Django Hosting provider http://t.co/6PWLApEK
tweet Google is starting to use github http://t.co/jBvN0ehK
Buy me a coffee!! Coffee cup

Advertisment