ohmkara 1.0

a technical blog.

Archive for the ‘tools’ Category

how long did it take?

leave a comment »

How to measure how long it took to run a command — to benchmark etc. in linux / unix etc.

…]$ time command

Online man-page

Written by deepak

January 26, 2010 at 9:07 am

Posted in linux, my notes, tools

Tagged with

split / join files in linux

leave a comment »

I was looking for a way to split and join files in linux.

“split” command splits — online man

“join” command joins — online man

Another way to join files is (say join two files file1, file2 to a combinedfile)

cat file1 file2 > combinedfile

You can specify sizes. Ex. If you want to split a bigfile (of size 820Mb) to an 700Mb file and the rest

the following ‘may’ work

split -b 734003200  bigfile

And so on see the manpage

Written by deepak

January 26, 2010 at 8:53 am

Posted in linux, my notes, tools

Tagged with

learn to touch type

leave a comment »

I think that touch typing is a useful skill to have, more so for people like me — slated to spend a considerable portion of their life @ coding. I have just started to learn — the tool I am using to learn touch typing is gtypist (GNU Typist) available here — link. Both linux and windows versions are available. It has just a plain text look, nothing fancy, but I liked the tool.

Written by deepak

March 18, 2009 at 11:14 am

Posted in links, tools

Tagged with

‘spice’ up linux

leave a comment »

To spice in linux I recommend ngspice (and post processor ngnutmeg).

# yum install ngspice

should install this (at-least on fedor10).

This page – link – tells what you need to know to get the tool-flow going — A ngspice / ngnutmeg basic how-to / tutorial.(explained in a simpler manner than in man pages)

Just a suggestion on top of link, entering stuff in nutmeg interactive session takes time, better type up a nutmeg command card file like

set hcopydevtype=postscript
hardcopy plot.ps i(vids)

Then you can call it up as

ngnutmeg raw_file.raw < nutmeg_command_card_file

It is faster going this way or so I feel.

Written by deepak

January 14, 2009 at 12:33 pm

Posted in links, my notes, tools

Tagged with

spice mosfet parameter annotator perl script

leave a comment »

This is a very crude perl script (perl experts might have a heart-attack if they read this) but it works (I am just starting to learn perl).

What does it do?

Input: Spice code in which mosfets have only L and W specified — ether in nm,um or lambda units. Does not work if you have already specified AD,AS,PD,PS for some mosfet’s but that is a trivial expansion – do if you want to.

Output: Fully annotated code with AD,AS,PD,PS parameters and lambda to units conversion done for mosfet lines.

The Script: spice_fet.pl

use warnings;
use strict;
# spice_fet.pl (v0.9)
# functionality: To automatically annotate spice file with the AS,AD,PS,PD parameters
# 	Input spice file L and W could be in
# 	1) no units -- implying lambda based line
# 	2) n or u -- nm or um units
# Note: 1) please set the technology node variable $x in the first line of code
# 	2) equations used are as follows if different change it in code
# 	AS=AD=(5*$x*width)
# 	PS=PD=((10*$x) + (2*width))
# Author: deepak
# Timestamp: Wed 14 Jan 2009 08:08 AM

my $x=120e-9;	#my technology node
my $lambda_flag=0;

sub strip	#convert l,w to floating point numbers
{		#and see if the line is lambda based
	my $a=$_[0];
	my $a_int=$a;
	if($a =~ m/(d+)n/i)	#l/w in units of n(m)
	{	$a_int = $1*(1e-9);	}
	elsif($a =~ m/(d+)u/i)	#l/w in units of u(m)
	{	$a_int = $1*(1e-9);	}
	else			#lamda based design
		$a_int *= $x;
		$a *= $x;
		$lambda_flag=1;	#flags the design as lambda based
	return $a_int;
if(($ARGV[0] eq "-h")|($ARGV[0] eq "--help"))	# if help requested
{	#print usage and exit;
	print "usage-- n spice_fet  n";
	exit 0;
open FILE_IN,"","annotated.sp" or die $!;	#open output file -- annotated.sp
	# ex line1: M1 1 2 0 0 N_50n L=120n W=120n
	# ex line2: Mnmos1 net1 net2 net3 net4 model_nmos_120 L=240n W=240n
	# ex line3: M1 1 2 0 0 N_120n L=2 W=6 	-- lambda based line
	my $line;
	if($_ =~ m/M([w s]+)L=(w+)(s+)W=(w+)/i)
		my $l_int = strip($2);	#pass L parameter
		my $w_int = strip($4);	#pass W parameter
		my $ad = (5*$x*$w_int);
		my $as = $ad;
		my $ps = ((10*$x)+(2*$w_int));
		my $pd = $ps;
		if($lambda_flag==1)	#if the line looks like lambda based make it normal
		chomp $_;
		$_ = $_." AD=$ad AS=$as PD=$pd PS=$ps	*annotated by spice_fet.pln";
	print FILE_OUT $_;

It can definitely be optimised but I did not much care about optimization (point of diminishing return).

Written by deepak

January 14, 2009 at 12:07 pm

Posted in my notes, scripts, tools

Tagged with ,

sam2p bulk conversion script

with one comment

I have lots of .jpg files to convert to .eps in a folder, not sure if there is a batch convert option in sam2p  — did not see one in quick glance, hence wrote the following. The following was a bulk conversion bash script that worked for me…

# makeeps.sh
# convert jpg files to eps
for i in $( ls *.jpg* );
    tgt=$(echo $i | sed -e "s/$match/$replace/")
    sam2p $src $tgt

Written by deepak

January 12, 2009 at 5:48 pm

Posted in my notes, scripts

Tagged with ,

adding your shell-scripts dir to path

leave a comment »

This is what my ~/.bashrc file looks like — pretty simple

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

# User specific aliases and function

~/bin is where I put my scripts. Addidng that to the path is what “PATH=$PATH:$HOME/bin” line does. Then all that you need to do is to make the script executable with….

chmod 755 your_script

Written by deepak

January 12, 2009 at 3:39 pm

Posted in my notes, scripts

Tagged with