Creating hard links in Windows 7

If you need to create a hard link on Windows (as opposed to soft links which are created by default), you can create it using command line. The exact syntax would be:

mklink /J <Link> <Target>

So say you need to create a link www in the current folder which needs to point to D:\my_files\html, the command would be:

mklink /J www D:\my_files\html

This utility works in Windows Vista and Windows 7, and should also work on Windows 8 & 10.



Using 16×2 LCD display with i2c controller in Arduino

If you are planning to use a 16×2 LCD display with i2c controller in Arduino, check out this page for the three general types of LCD i2c controller, and the settings for each one of them:

Also, some controllers will have brightness controllers which can be adjusted using a small screwdriver. If the LCD blinks as per the code in the above site, but you cannot see the characters, it most probably is a brightness issue.


Convert SeaTools iso file into USB bootable on Mac

Seagate SeaTools for DOS is a free hard drive testing software that runs independent from your operating system. Seagate provide a iso file which needs to be burned to a CD. Considering that CD/DVD drives are fast disappearing, and most computers these days support booting of a USB drive, it makes life easier if the the iso get converted into USB bootable. It is actually easy to do it on a Mac using the following steps:

a) Download Seatools for DOS from Seagate site (

b) Open the iso file downloaded. Simple double clicking should mount the file on your desktop. Open the mounted folder, and extract the SeaTools.ima to your desktop.

c) Rename SeaTools.ima to SeaTools.img (Accept the warning dialog box)

d) Insert a USB drive that you will use. Note that any data on this drive will be completely erased.

e) Start your terminal window and find the USB drive identifier:

diskutil list

. Make sure that you get the correct disk identifier. In my case it was /dev/disk1.

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data BOOTCAMP                250.0 GB   disk0s4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.0 GB    disk1
   1:             Windows_FAT_32 KINGSTON                16.0 GB    disk1s1

f) Unmount the usb disk folder using the following commands in your terminal window:

diskutil unmountDisk /dev/disk1

g) Copy the contents of the SeaTools.img file to USB drive

sudo dd if=Desktop/SeaTools.img of=/dev/disk1

That’s it. Your USB drive will now boot to SeaTools. One thing that I have observed with the SeaTools is that if you have set the drives to be discovered through AHCI mode in your bios, it might not always detect the drives. It is better to change the drive detection to IDE for it to work reliably.

For those looking to use the same procedure on a Windows machine, this link should help your out: . For Linux and BSD, the procedure should essentially remain the same as Mac in principle, although the disk identifier & unmounting commands might be different. dd should work on all.

Creating custom pkgng repository for FreeBSD

pkg is a utility for installing binary packages in FreeBSD. But to install non-default options not selected by the packager/maintainer across multiple servers, use the ports to roll out custom packages. Creating custom package is very easy. There are only small changes compared to creating packages for the old pkg_* toolset.

mkdir -p /usr/ports/packages/All
make package-recursive install

Note that install keyword has been used, because new pkgng does not install the main port while creating the package. It will install all dependent ports though. Once packages are created, copy all of them to a staging directory:

cp /usr/ports/packages/All/* .

Alternatively, if the ports are already installed, create packages using:

pkg create -a

This will create packages for all installed ports in the current directory.

Once all the packages are in current directory, run pkg repo command to create repo files:

pkg repo .

Current directory now contains all the files to host custom repository :). Move it to some publicly accessible place which is reachable by target computers. Use of directory under a web server makes it easier. For more control over repository creation and how packages are created, see poudriere and tinderbox

On the target computers to use this repository, make a few changes. Disable the base FreeBSD repository:

mkdir -p /usr/local/etc/pkg/repos
echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf

Now make the new repository active

echo 'REPONAME: { url: "http://REPO_URL"}' > /usr/local/etc/pkg/repos/REPONAME.conf
pkg upgrade

There are tons of options for the conf files, and also how to use multiple repositories with priorities, but those are beyond the scope this article. Consult man pages for pkg-repository and pkg.conf for more details.

Custom repository is now ready for use.

Please note that anything related to PACKAGESITE is no longer valid for the new versions of pkgng .