Monday, June 1, 2015

one liners

Find most recently modified file in a dir tree
find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "





Saturday, May 30, 2015

find multiple files with find -o switch

find . \( -name r_prog1051_credit.ks -o -name r_prog1037_credit.ks \) -print

Tuesday, May 5, 2015

svn+ssh url (interactive vs non interactive shell issues with TortoiseSVN)

3 Ways shown below to access svn via ssh

1. svn+ssh://rprajapa@ora-rbtdev-app.xyz.com/appdata/rbt/repo/rakeshP17n_lastrel

svn+ssh with putty

2. svn+ssh://[username]@[putty saved session name]/path/to/repository

or
3. svn+ssh://[putty saved session name]/path/to/repository




I was facing problems in accessing the repository with above methods.  
- I am on a windows machine using Tortoise svn to access the repo on a REDHAT box
- My Putty pageant had loaded the private key to the server successfully..
- I put in the third url method above in the Repo Browser of TortoiseSvn ([] brackets indicate substitute the value there and do not include the brackets itself)
- The repo exists and the path is correct



The main Issue)
svn command is not in $PATH.
TortoiseSVN runs a non interactive shell to connect to server just like the command below
ssh rprajapa@ora-rbtdev-app.xyz.com "svn"

The above command gave the error "svn command not found"


Solution 1)
When we login in interactively svn command is found
but
for non interactive shell it does not find the command
(some pointers here for why this is so: http://stackoverflow.com/questions/216202/why-does-an-ssh-remote-command-get-fewer-environment-variables-then-when-run-man )

Since TortoiseSvn uses  non interactive shell way of accessing the repo .. we simply need to add
PATH to .bashrc
file contents pasted below

# .bashrc

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

# User specific aliases and functions

export PATH=$PATH:/opt/ubersvn/bin





Solution 2)  Using "ssh forced commands"

Modify the ssh key to include the following at the beginning of the key for example
(substitute your path to svnserve below and also tunner-user)

command="/opt/ubersvn/bin/svnserve -t --tunnel-user=rprajapa" ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBiSfTZ9GVSl4XbSZqaCne6F48HgeSL3AJHDphNzOcTjM9t3WYccDfU7OXkv1dZerISvOSE/Eg+N/0/Ur2QMJpaciknY+LQ== rprajapa


This works for the purposes of TortoiseSvn but it has one drawback.. you cannot use this key to login to server interactively
you will get the following message

( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops partial-replay ) ) )

and it will stay there and you will not get a $ prompt.




Monday, April 27, 2015

Creating a multi hop SSH tunnel by chaining SSH commands and using a intermediate host

$ ssh -A -t -l wb0c rp.mdns.org -p 42121 ssh -A -t -l ora 10.1.1.21

rp.mdns.org is intermediate host here

Thursday, April 23, 2015

syntax highlighting in nano

1. create a .nanorc file in $HOME
2. Sample contents
include /usr/share/nano/asm.nanorc
include /usr/share/nano/c.nanorc
include /usr/share/nano/groff.nanorc
include /usr/share/nano/html.nanorc
include /usr/share/nano/java.nanorc
include /usr/share/nano/man.nanorc
include /usr/share/nano/mutt.nanorc
include /usr/share/nano/nanorc.nanorc
include /usr/share/nano/patch.nanorc
include /usr/share/nano/perl.nanorc
include /usr/share/nano/pov.nanorc
include /usr/share/nano/python.nanorc
include /usr/share/nano/ruby.nanorc
include /usr/share/nano/sh.nanorc
include /usr/share/nano/tex.nanorc
include /home/rprajapa/bin/ks.nanorc
include /home/rprajapa/bin/ksh.nanorc



the syntax highlighting files are in /usr/share/nano

It did not have files for .ks and .ksh   , so I copied the sh.nanorc to ksh.nanorc and ks.nanorc

and edited its contents.. ie also replace sh with ksh and .ks respectively.

(for some reason it does not like $HOME so had to put absolute path /home/rprajapa)

Thats all.. Enjoy.

Wednesday, April 22, 2015

Setting font in gvim - windows 7

Open vim editor

:echo $HOME

at the $HOME location

create a file _vimrc with the following contents
:set gfn=Consolas:h11:cANSI
:syn on

:set was optional for the gfn variable above.

Sunday, March 29, 2015

installing oracle on Centos


curl -O https://linux.oracle.com/switch/centos2ol.sh 
sh centos2ol.sh
 


yum install oracle-rdbms-server-11gR2-preinstall

Followers

About Me

Torrance, CA, United States