.Net and Python Integration

using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)

        private void run_cmd()

            string fileName = @"C:\sample_script.py";

            Process p = new Process();
            p.StartInfo = new ProcessStartInfo(@"C:\Python27\python.exe", fileName)
                RedirectStandardOutput = true,
                UseShellExecute = false,
                CreateNoWindow = true

            string output = p.StandardOutput.ReadToEnd();




Python Program
print "Python C# Test"

Forward Internet In Lunux or NAT

  1. sudo ifconfig eth0 address
  2. echo 1 > /proc/sys/ipv4/ipforward
  3. sudo iptables -t nat -A POSTROUTING -s ! -d -j MASQUERADE
  4. Install dnsmasq -> sudo apt-get install dnsmasq
  5. configure dnsmasq.config as
    • sudo nano /etc/dnsmasq.conf
      • interface=eth0
      • dhcp-range=,

Release unused memory in Ubuntu

sometime we think that RAM is filled with running processes. But actually more over its cached by the processes which has finished its execution. We can release this cache RAM using superuser command.

first check the status of RAM by this command:


"echo 3 > /proc/sys/vm/drop_caches"

Now again check RAM using free command. You will observe too much RAM is released.

How to reset Ethernet ports on ubuntu

To reset or refresh Ethernet interface on Ubuntu use following command:

rm -f /etc/udev/rules.d/70-persistent-net.rules

this  command will reset the all Network interfaces in next reboot.


Domain name Mapping in apache Ubuntu 15.04 without “www” solved

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    ServerAlias *.example.com
    DocumentRoot /var/www/example.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined