Phine Solutions web work notes

Simple command to find out the directory disk usage

Filed under: linux goodies — 1.618 @ 8:37 am

ls -F | grep “/” | xargs du -hs

For admin to snoop everybody, try

ls -F | grep “/” | sudo xargs du -hs

ssh public/private key using ssh-keygen

Filed under: linux goodies — 1.618 @ 4:07 pm

me@connect-from-machine:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/me/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/me/.ssh/id_rsa.
Your public key has been saved in /home/me/.ssh/id_rsa.pub.
The key fingerprint is:
blah blah ….

The command ssh-keygen -t rsa initiated the creation of the key pair.

The private key was saved in .ssh/id_rsa. The file is read only by you and you can see why since if someone else get it he can try to use it to connect to the same machine. If you happen to make it passphrase free, it will be even easier for the other person.

The public key is save in .ssh/id_rsa.pub.
Its content is then copied in file .ssh/authorized_keys of the system you wish to SSH to without being prompted for a password. Using scp, this can be done by scp .ssh/id_rsa.pub username@remote-machine:/.ssh/authorized_keys .

Once the file is copied you are on ssh private key login.

JQuery vs. Prototype

Filed under: my 2 cents — 1.618 @ 10:57 am

Recently I started looking into both JQuery and ProtoType to simplify the Javascript works on my site and first decision to make was to which one to choose. Besides these popular options, MooTool also caught my attention since it appears there are some very loyal followers on the web.

I found this article best explains the differences between JQuery and Prototype from the level of the framework itself.

In short, Prototype does what a “framwork” is supposed to do. It is a layer between the HTML dom objects the developer and functionality is done through a set of classes.

JQuery is, for lack of better word, a straight DOM manipulator. It also provides a layer between the JavaScript and HTML, but it is more direct and simpler so it is rather provided as a “library” than a “framework”.

I guess which one to pick largely depends on the developer because neither could really go wrong. It is really about how you look at HTML frontend coding, or whether you are more comfortable with treating the HTML dom as an individual entity and Javascript as UI helper; or JavaScript as a UI driver and HTML is a product of it.

I personally enjoyed using JQuery and I like it a lot. And I believe JavaScript should stay small in the whole HTML UI design and not to be too complicated.

©phinesolutions.com