Tuesday, August 5, 2014

Raspberry Pi - Sh scripts in Python

How to write sh commands in Python

By Importing the library OS in python, we can use the  'sh' scripts in python very easily.

sh script  'a.sh' to echo the 'Hello World'


Python program to use 'a.sh' shell script


Output:

 

Monday, August 4, 2014

Node Server.js in Raspberry Pi

To serve a page using Node.js  require a few lines of code. Raspberry pi browser shows hello world webpage which is running on Node(screenshots below)


Node Server.js program running
 



Raspberry Pi browser shows the page in localhost port 8888




Server.js Program

node.js Hello World Program

Just thought of writing a program in Node.js. There are a lot of tutorials in Node.js.

I am following the link http://www.nodebeginner.org/#javascript-and-nodejs

HelloWord program

use console.log for printing strings.

console.log("Hello World");