Monthly Archives: November 2013

Sublime 3 and the Emmet plugin

After installing Sublime 3 and the package control center you should also install the incredible Emmet plugin.

This plugin helps you write HTML / CSS code lightning fast.
emmetio

For example:
Create a new document in Sublime and save it as index.hml. Inside the sublime editor type

html:5<press tab>

The following HTML document will be generated:

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

After you press tab  a default HTML 5 template will be generated. The cursor is positioned at the <title>  tag; this is the most likely item you are going to change. Type your title and move the cursor after the <body>  tag. The type:

ul>li*2>a.link-${$}<press tab>

After you press tab the following HTML will be generated:

<ul>
<li><a href="">1</a></li>
<li><a href="">2</a></li>
</ul>

Explanation of the shortcode:
Create an ul  and with that 2 li  items. Within theli  ahref  is generated with a class link followed by a sequence number. The {$}  inserts the sequence number as text.

Share
GIT logo

Mount NFS share under Ubuntu

On the server:

Edit the file /etc/exports  file and add the line:

/share hosts(rw,nohide,insecure,no_subtree_check,async,all_squash,anonuid=idofshare,anonguid=guidofshare]

Example:

/home *(rw,nohide,insecure,no_subtree_check,async,all_squash,anonuid=1008,anongid=1008)

Explanation:

/share  is the location you want to share
hosts  is the specification of hosts you allow access
all_squash  to translate all anonymous id’s (not known on server) to the give anonuid and anongid
no_subtree_check does no checking on the complete subtree of filepermissions (see also here)

After adding or changing an export to the /etc/exports file don’t forget to restart the NFS server:

sudo service nfs-kernel-server restart

On the client:

To view the list of exported shares on the server execute the command:

showmount -e [ip_of_server]

 

Example of output:

Export list for 192.168.2.200:
/home *

To mount the NFS share local create a new subfolder and execute the command:

mount -v [host]:/home ~/home/

This will mount the folder /home on the server local on your /home/ folder.

 

 

Share

Send email with PHP script

So you want to send an email through a PHP script. Well that is dead simple (provided you have your smtp server setup correctly). See the code fragment below:

$to = "email@to.com";
$subject = "Your subject";
$message = "Your message";
$headers = "From: webmaster@from.com" . "\r\n" .
   "Reply-to: webmaster@from.com" . "\r\n" .
   "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);

 

Share