SSH port forwarding syntax is confusing . Here are some of the best blog posts that provides break down of SSH port forward command line syntax with beautiful visualization.
SSH port forwarding syntax is confusing . Here are some of the best blog posts that provides break down of SSH port forward command line syntax with beautiful visualization.
UNIX domain sockets enable efficient inter process communication between the processes running on the same machine.,UNIX domain socket uses file pathname to identify the server instead of an IP address and port. Support for UNIX domain sockets has existed on many flavors UNIX & LINUX for the longest time but this facility was no available on Windows. On Windows if you want to do Local IPC then you had to use named pipes . Named pipe had different API’s then sockets., This difference made porting UNIX domain sockets based application to Windows difficult.
Windows 10 Version 1803 brings native support of UNIX domain sockets to Windows. You can program in “C” with Windows SDK version 1803 (10.0.17134 or greater ) and program in C# using .NET core 2.1 ,
Here is how to check support for UNIX domain sockets on Windows.
“sc query afunix” from a Windows admin command prompt
Here is the C# demo sample
| using System; | |
| using System.IO; | |
| using System.Net.Sockets; | |
| using System.Text; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace UnixSocketsDemo | |
| { | |
| class UnixSocketsOnWindows | |
| { | |
| public static void Demo() | |
| { | |
| string path = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | |
| var task = Task.Run(() => | |
| { | |
| StartServer(path); | |
| }); | |
| // wait for server to start | |
| Thread.Sleep(2000); | |
| StartClient(path); | |
| Console.ReadLine(); | |
| } | |
| private static void StartClient(String path) | |
| { | |
| var endPoint = new UnixDomainSocketEndPoint(path); | |
| try | |
| { | |
| using (var client = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) | |
| { | |
| client.Connect(endPoint); | |
| Console.WriteLine($"[Client] Connected to … ..{path}"); | |
| String str = String.Empty; | |
| var bytes = new byte[100]; | |
| while (!str.Equals("exit", StringComparison.InvariantCultureIgnoreCase)) | |
| { | |
| Console.WriteLine("[Client]Enter something: "); | |
| var line = Console.ReadLine(); | |
| client.Send(Encoding.UTF8.GetBytes(line)); | |
| Console.Write("[Client]From Server: "); | |
| int byteRecv = client.Receive(bytes); | |
| str = Encoding.UTF8.GetString(bytes, 0, byteRecv); | |
| Console.WriteLine(str); | |
| } | |
| } | |
| } | |
| finally | |
| { | |
| try { File.Delete(path); } | |
| catch { } | |
| } | |
| } | |
| private static void StartServer(String path) | |
| { | |
| var endPoint = new UnixDomainSocketEndPoint(path); | |
| try | |
| { | |
| using (var server = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) | |
| { | |
| server.Bind(endPoint); | |
| Console.WriteLine($"[Server] Listening … ..{path}"); | |
| server.Listen(1); | |
| using (Socket accepted = server.Accept()) | |
| { | |
| Console.WriteLine("[Server]Connection Accepted …" + accepted.RemoteEndPoint.ToString()); | |
| var bytes = new byte[100]; | |
| while (true) | |
| { | |
| int byteRecv = accepted.Receive(bytes); | |
| String str = Encoding.UTF8.GetString(bytes, 0, byteRecv); | |
| Console.WriteLine("[Server]Received " + str); | |
| accepted.Send(Encoding.UTF8.GetBytes(str.ToUpper())); | |
| } | |
| } | |
| } | |
| } | |
| finally | |
| { | |
| try { File.Delete(path); } | |
| catch { } | |
| } | |
| } | |
| } | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("Hello World!"); | |
| } | |
| } | |
| } |
Resource
In this blog post I will describe installing and configuring Jenkins Continuous integration server. This set-up was used for one of my current project to build Linux Application software.
I used Ubuntu 12.04 virtual machine running inside VirtualBox for this tutorial.
Jenkins is an continuous integration server written Java . Jenkins monitor configuration management ( CVS,SVN,Perforce.. ) servers for changes , such as source code check-ins. Once it detects changes it will update the local working directory with the source from CM and performs series of build steps defined by the user on the source code. These build steps could be simple as invoking the shell script or build script such as make,ant .
Jenkins has many plug-ins available to extend its feature set and to integrate with other Software tools ( unit test, code coverage, code analysis ).
Jenkins is Java based software , hence it requires Java Runtime as prerequisite on a system.
Jenkins software is available as Debian package . To Install latest Jenkins software on Ubuntu execute following steps from command line
Once the installation completes make sure that Jenkins server up and running by opening web browser and pointing to http://localhost:8080 .
If Jenkins running you should see following page in the web browser . This completes the installation.
Jenkins natively support CVS and SVN CM. In my application I use Perforce for configuration management. Since Jenkins natively does not support Perforce CM I need to install Perforce plugin for Jenkins. Installing plugin is easy, Select “Jenkins->Manage Jenkins” option from the menu , select available tab to list the plugin and select and install perforce plugin. Following picture shows the “Manage Jenkins” page.
You can discover and install additional plug-in similar to perforce plugin from the page.
From the Jenkins main page select NewJob to create simple build step.
In the next page enter job name and select “Build free style software project” option . You can read about the various option by selecting help icon next to option.
Next page allows user to enter Configuration management specific details, in case Perforce CM, it user name,password and server details as shown below. These options differ based on the selected Configuration management .
Other configuration details such as source code depot ( Perforce specific ), workspace details , Poll interval ( how often Jenkins should poll CM for changes ), where to copy the build output are entered on the same page . Once the Configuration Management specific details are entered next step is provide instruction Jenkins to build software.
For this demo I have selected option to “Execute Shell” option to enter build command. With this option you can enter any Linux shell command . I will Apache ant to build my source code . Jenkins will execute these command once it check-out source code from the CM . I have entered following command to illustrate the build setup
cd projecta-src/
echo “Build started…”
ant BuildRelease
echo “Build Ended”
After saving this step Jenkins will start monitoring Configuration Management for changes, if changes detected it will pull changes to local workspace and execute the build scripts.
Resources:
1. Jenkins website.
Currently I am working on project which is uses custom version of embedded Linux built using open embedded framework. This project also uses QT for all the UI development ,googletest for c++ unit test and boost c++ for all threading and asynchronous communication(boost.asio).
As part of development I have explored and collected web resources which helped me to explore ,understand and tryout the samples and tools. I thought I would share the same in this blog post.
Raspberry Pi is a credit card sized computer built using Broadcom SOC (system on chip) created by Raspberry Pi foundation. It costs $35 for model B board which has 700 MHz ARM CPU, 512 MB RAM, 2 USB2 ports, 1 HDMI port ,1 RCA video port,Ethernet and audio port. It has SD card for installing Linux distribution.
Here is screenshot of Raspberry Pi board
There are number of Linux distribution that target Raspberry Pi , including distribution to run Media Center software.
In this post I will talked about how I built my media center pc using Raspberry Pi and OpenELEC ( open embedded Linux entertainment center ) Linux distribution.
OpenELEC is a small Linux distribution with complete XBMC media center software. Compared to Raspbmc which is another Linux based media center distribution , OpenELEC is very small around 80MB in size. Because OpenELEC distribution packages only software necessary for media center it is small and fast compared to Raspbmc.
Here is the screenshot of my Raspberry Pi board with all necessary connection .(HDMI connection to monitor, micro usb power connection, Ethernet connection and USB keyboard and mouse).
Before powering up the board , you need download OpenELEC distribution from the OpenELEC website. Make sure that you download image which as RPi-arm name in it, example : OpenELEC-RPi.arm-devel-20121124031454-r12577.tar.bz2
To create bootable OpenELEC image on SD card you can Windows/Mac/Linux OS workstation with SD card reader. Here are the steps to create SD image on Ubuntu 12.10 .
1. Unzip and un-tar OpenELEC to some folder ,
2. Insert 2GB blank SD card to your machine.
3. Execute create_sdcard shell script from OpenELEC folder with device path of the SD card.
Example
linux-vm:~/OpenELEC-RPi.arm$ ./create_sdcard /dev/sdb
4. Once step 3 completes without any errors, SD card will have bootable OpenELEC image.
5. Now insert SD card to Raspberry Pi board and power up.
6. You will see the boot screen with OpenELEC and Raspberry Pi logo.
7. After while you see familiar XBMC media center interface.
8. Now you navigate the menu using keyboard and add your data source where you stored your media collection.
OpenELEC supports UPnP, DLNA,NFS,CIFS,SMB,FTP,SFTP and others file sharing protocols. Using these you should be able to browse the media collection stored on your PC , MAC, Linux or NAS box.
You can also connect your USB2 hard drive to Raspberry Pi and browse media collection from OpenELEC. OpenELEC supports hard drive formatted using NTFS ,FAT/FAT32 and other Linux file system formats.
Once you have contents you play any audio/video/photo formats.
OpenELEC also supports Apple AirPlay as target. You can enable this from settings menu. Once enabled , you can stream photo and video from you IOS device( iPhone ,iPad ,iPod touch and MAC computers ) to OpenELEC connected device ( TV or monitor )
In the next blog post I will explore installing Java 8 on Raspberry Pi and running Java FX application.
Resource
1. Raspberry Pi : Main Raspberry Pi website.
2. OpenELEC : Open Embedded Linux media center website.
3. OpenELEC on Raspberry Pi : Instructions to install OpenELEC on Raspberry Pi
4. XBMC : XBMC wiki page .
5. Raspbmc : Raspberry Pi media center distribution based with XBMC software.
6. Run Java Application on Raspberry Pi. Oracle TechNet article for installing Java on Raspberry Pi
7. Raspberry Pi accessories : Collection of Raspberry Pi compatible accessories.
I often use both Windows and Linux environment at work. Sometimes I need to share files between Linux & windows workstation.
There are couples of ways to share files between Linux & Windows.
Even though many of the option listed are simple , it requires some effort to setup. You need to repeat the same when you re-install Linux.
Recently I discovered simple and elegant way to achive the same using python built in SimpleHTTPServer module.Advantage of this approach is python is by default installed on all Linux distributions. No need to install any additional package.
Here is how to do it
Resource