The box lasts longer


…than what comes within it. I got myself an iPhone 6 Plus as a replacement. It’s hard to resist a wish come true.

Advertisements

Folders consuming most disk space using du


du is available natively on almost all Linux distributions, and on Mac OS X. If you are in need of reclaiming disk space, and want to quickly find which folders to focus your attention on, run the following command

du -h -d 1

That will quickly list all the folders under the current folder and their disk space usage. Use the following command to check space left on each disk

df -h

Physical serial port redirection


I have previously posted about Virtual serial port redirection on Windows, to develop and test applications that use serial ports. I’ve found the available drivers increasingly buggy on Windows 8.1. This post shows how you can wire two USB-Serial cables to achieve the same objective.

Serial Port Redirection

You’ll need two USB-Serial cables such as USB to TTL Serial Cable for Raspberry Pi from Adafruit or several similar ones from Amazon. Wire the cables so that the ground wires are connected, and receive wire of one cable is connected to the transmit of another and vice-versa. Plug the cables in and install the appropriate drivers. Windows usually works with FTDI chipset based cables without requiring installation of drivers.

Now, you should see two serial ports, which redirect data to each other.

Virtual serial port redirection using socat


Here’s how socat can be used to redirect one serial port to another on Ubuntu

sudo socat -d -d pty,link=/dev/ttyS0,raw,echo=0 pty,link=/dev/ttyS1,raw,echo=0

Assuming both serial devices above are not assigned to a real device. If the above command is successful, you can send data from on serial port to another using a terminal emulator such as screen

screen /dev/ttyS0 115200

Install screen using sudo apt-get screen if not already installed. Repeat the above command on another prompt for the other serial device, and you’re good to go. Quit screen using Ctrl-A .

socat can also be used to perform serial to TCP redirection

sudo socat -d -d pty,link=/dev/ttyS0,raw,echo=0 tcp-listen:8000

Now, you should be able to use screen to send and receive data on the serial port, while you use something like netcat to receive and send data to the serial port

netcat 127.0.0.1 8000