26 May, 2014

DVD Backup on Linux

It's been years now, all my primary computers have Linux as the host operating system.  Few things can't be done in Linux, but one in particular is backing up dvd's which required the installation of VirtualBox and Windows VM.  I've been using that setup for some time to backup dvd's, with applications such as DVDFab, DvdShrink or the like.  With WinXp at EOL and Nero failing to work with Win7 VMs I finally gave it up after finding an alternative application for native Linux.

K9copy seems to scratch the itch.  Using Ubuntu 12.04, I found setting it up takes the form:


$ sudo apt-get install libdvdcss libdvdcss2
$ sudo apt-get update
$ sudo apt-get install libdvdread4
$ sudo /usr/share/doc/libdvdread4/install-css.sh
$ sudo apt-get install k9copy


http://k9copy.sourceforge.net/web/index.php/en/

Happy viewing.

03 May, 2014

Google Archive

Did you know that you can export all your Google artifacts?

https://www.google.com/takeout
Check the items you want to export and kick out a Zip file.

Cheers.

11 April, 2014

Generating Multi-Plot Real-Time Plots with Python

In my last post the real-time plotting capabilities were demonstrated, we're extending on this by showing how to generate multiple plots simultaneously.  A couple noteworthy observations, in the past post the X and Y scaling was automatically scaled after each element addition.  While you can still do this, typically for multiplots we would prefer maintaining a shared X range.  While somewhat unnecessary, I've elected to maintain a uniform Y range.



#!/usr/bin/python
from pylab import *;
import time;

def log(M):
  print "__(log) " + M;

def test02():
  plt.ion();
  fig=plt.figure(1);
  ax1=fig.add_subplot(311);
  ax2=fig.add_subplot(312);
  ax3=fig.add_subplot(313);
  l1,=ax1.plot(100,100,'r-');
  l2,=ax2.plot(100,100,'r-');
  l3,=ax3.plot(100,100,'r-');
  time.sleep(3);

  D=[];
  i=0.0;
  while (i < 50.0):
    D.append((i,sin(i),cos(i),cos(i*2)));
    T1=[x[0] for x in D];
    L1=[x[1] for x in D];
    L2=[x[2] for x in D];
    L3=[x[3] for x in D];

    l1.set_xdata(T1);
    l1.set_ydata(L1);

    l2.set_xdata(T1);
    l2.set_ydata(L2);

    l3.set_xdata(T1);
    l3.set_ydata(L3);

    ax1.set_xlim([0,50]);
    ax2.set_xlim([0,50]);
    ax3.set_xlim([0,50]);
    ax1.set_ylim([-1.5,1.5]);
    ax2.set_ylim([-1.5,1.5]);
    ax3.set_ylim([-1.5,1.5]);

    plt.draw();
    i+=0.10;
  show(block=True);

#---main---
log("main process initializing");
test02();
log("main process terminating");

Easy Peasy;

04 April, 2014

Generating Real-Time Plots with Python

In my previous post we described plotting data using MatplotLib utilities and Python.  While this may be valuable, it becomes notably more valuable when you can generate 'live' plots during run-time.  In a past employment I worked with a series of controls engineers that utilized real-time data plots to debug and develop a highly complex multi-axis weapons system and it was the first time I understood how a real-time plot of sequence of steps simplified the development effort.

Let's get started.
Unlike the previous post, let's create the data and plot it as it is generated.


#!/usr/bin/python
from pylab import *;
import time;

def log(M):
  print "__(log) " + M;

def test01():
  plt.ion();
  fig=plt.figure(1);
  ax1=fig.add_subplot(111);
  l1,=ax1.plot(100,100,'r-');

  D=[];
  i=0.0;
  while (i < 50.0):
    D.append((i,sin(i)));
    T=[x[0] for x in D];
    L=[x[1] for x in D];
    l1.set_xdata(T);
    l1.set_ydata(L);
    ax1.relim();
    ax1.autoscale_view();
    plt.draw();
    i+=0.10;
    time.sleep(1/10.0);
  show(block=True);

#---main---
log("main process initializing");
test01();
log("main process terminating");

The result is a dynamically generated plot that resembles the following;
video

Tie this plotting routine to a system providing run-time information via a socket, or perhaps monitoring network traffic via pcapture libraries and you've got yourself the foundation of a real-time data monitoring system.

Cheers.

01 April, 2014

Plotting with Python

Scripting languages are incredibly powerful, but more powerful when you can visualize the data you are processing.  In this post, we will demonstrate how to quickly plot data sets via Python.

Start with installing Python and a plotting utility known as MatplotLib;


$ sudo apt-get install python python-matplotlib 
Then, let's start with a classic plot, sin(x);



#!/usr/bin/python
from pylab import *;
import time;

def log(M):
  print "__(log) " + M;


def test00():
  D=[];
  i=0.0;
  while (i < 50.0):
    D.append((i,sin(i)));
    i+=0.10;
 
  plt.ion();
  xlabel('radians');
  ylabel('sin(x)');
  grid(True);
  plt.figure(1);
  show();
  T=[x[0] for x in D];
  L=[x[1] for x in D];
  plt.plot(T,L,'b-');
  show(block=True);

#---main---
log("main process initializing");
test00();
log("main process terminating");
The result is calculating a data set followed by plotting the data and allowing the user to manipulate the plots (e.g. zooming, panning, ...).



For more detailed features, refer to the MatlabLib site: http://matplotlib.org/contents.html

Cheers.

27 March, 2014

Tcpdump Examples

As much as I like using Wireshark, I'm a sucker for a command interface.  The trouble is properly defining a filter has been difficult to say the least, boring simple post, but below is a list of brief examples and descriptions.

#!/bin/bash

#--grab the first 10 packets and write to file
  tcpdump -c 10 -i wlan0 -w /tmp/data.pcap

#--grab the first 10 packets to/from host and write to file
  tcpdump -c 10 -i wlan0 host 192.168.1.125 -w /tmp/data.pcap

#--grab the first 10 packets from host and write to file
  tcpdump -c 10 -i wlan0 src host 192.168.1.125 -w /tmp/data.pcap

#--grab the first 10 packets to host and write to file
  tcpdump -c 10 -i wlan0 dst host 192.168.1.125 -w /tmp/data.pcap

#--grab the first 10 packets to/from port and write to file
  tcpdump -c 10 -i wlan0 port 80 -w /tmp/data.pcap

#--grab the first 10 packets to/from net and write to file
  tcpdump -c 10 -i wlan0 net 192.168.1 -w /tmp/data.pcap

#--grab the first 10 packets from network and write to file
  tcpdump -c 10 -i wlan0 src net 192.168.1 -w /tmp/data.pcap

#--grab the first 10 packets from network and write to file
  tcpdump -c 10 -i wlan0 dst net 192.168.1 -w /tmp/data.pcap

#--grab the first 10 packets from network and write to file
  tcpdump -c 10 -i wlan0 '(dst host 192.168.1.125) and (port 443)' -w /tmp/data.pcap