show solaris processes ports

sudo pfiles /proc/* 2>/dev/null | nawk '/^[0-9]*:/ { pid=$0 } /port: [0-9]*$/ { printf("%s\t%s\n",$NF,pid);}' | sort -n

the roots of “:=”

i:int=mk(int=100)
i:=mk(int=100)
i:int=100
i:=100

Newsqueak used this coding style.

So I think each language using ‘:=’ is a strong typed language.

convert yaml to xml

First step: convert YAML to JSON

ruby -ryaml -rjson -e 'puts JSON.dump(YAML.load(STDIN.read))' < file.yml > file.json 

emacs dired + tmux navigating

The problem is following:

  • 1 window in tmux has running emacs, with died navigation,
  • 2 window in tmux has a bash,

and I want to have a possibility for quick navigate in bash to emacs’s dired dir.

The following lines I added to .emacs:

;; copy current dir
;;    from dired mode
;;    to   external file ~/.emacs.d/cwd
(require 'dired)
(define-key dired-mode-map "c" 'dired-export-cwd)
(defun dired-export-cwd ()
  (interactive)
  (with-temp-file "~/\.emacs\.d/cwd"
    (insert default-directory)))

And I’ve added the following to .profile:

alias c='eval cd `cat ~/.emacs.d/cwd`'

So when I’m pressing ‘c’ in emacs – the current dir saved, the I pressed a ‘c’ in bash, this dir is loaded.

R command prompt with current time

updatePrompt <- function(...) {options(prompt=paste(Sys.time(),"> ")); return(TRUE)}
addTaskCallback(updatePrompt)

list ps pids

ps -eaf | grep oracle | grep bash | tr -s ' ' | cut -d ' ' -f 3

toto kunioto

italiano

dens, dens, dens…

mvs installation

  • Copy CD dir into you HDD, and modify setup script – apply a patch:

    --- /Users/egor/010.Soft/MVS/setup	2012-12-05 19:28:28.000000000 +0400
    +++ /Volumes/CDROM/setup	2002-08-01 05:00:00.000000000 +0400
    @@ -301,7 +301,7 @@
        FILENAME=${FULLNAME##*/}
        FULLPATH=${FULLNAME%/*}
        TARGET=${FULLPATH##*/}
    -   sed -f conf.sed ${FULLNAME} >${TARGET}/${FILENAME}
    +   sed ${FULLNAME} -f conf.sed >${TARGET}/${FILENAME}
     done
     }
     
    @@ -1275,7 +1275,7 @@
     fi
     echo -e "\n\n${RED}"
     mkdir -p ${TARGET_PATH} >/dev/null 2>&1
    -TMPFILE=`date -u +T%Y%m%d-%H%M%S`
    +TMPFILE=`date --utc +T%Y%m%d-%H%M%S`
     cat >${TARGET_PATH}/${TMPFILE} <setup 2>/dev/null
     cat >${TARGET_PATH}/${TMPFILE} <setup
     if [ $? = 0 ] ; then
    @@ -1748,9 +1748,9 @@
                      SPATH=${RESULT}
                      echo "s%_CDROM%"${SPATH}%g                >>conf.sed
                      echo "s%_CDDIR%"${SOURCE_PATH}%g          >>conf.sed
    -                 sed -f conf.sed ${SOURCE_PATH}/conf/_startterm.bat    >startterm.bat
    +                 sed ${SOURCE_PATH}/conf/_startterm.bat   -f conf.sed >startterm.bat
                      if [ ${A_HERCGUI} = ${TRUE} ] ; then
    -                    sed -f conf.sed ${SOURCE_PATH}/conf/_startgui.bat >startgui.bat
    +                    sed ${SOURCE_PATH}/conf/_startgui.bat    -f conf.sed >startgui.bat
                      fi
                      if [ ${A_C3270} = ${TRUE} ] ; then
                         mkdir -p /usr/share/terminfo/c
    @@ -1760,21 +1760,21 @@
                   *) echo "s%_MYDIR%"${TARGET_PATH}%g          >>conf.sed
                      echo "s%_CDROM%"${SOURCE_PATH}%g          >>conf.sed
                      echo "s%_CDDIR%"${SOURCE_PATH}%g          >>conf.sed
    -                 sed -f conf.sed ${SOURCE_PATH}/conf/_startterm >startterm
    +                 sed ${SOURCE_PATH}/conf/_startterm       -f conf.sed >startterm
                      chmod 777 startterm
                      ;;
       esac
       cpsed ${SOURCE_PATH}/conf/*
       cpsed ${SOURCE_PATH}/conf/*.conf
    -  chmod -R 666 ./conf/*.conf
    +  chmod --recursive 666 ./conf/*.conf
       cpsed ${SOURCE_PATH}/conf/*.rc
    -  chmod -R 666 ./conf/*.rc
    +  chmod --recursive 666 ./conf/*.rc
       cpsed ${SOURCE_PATH}/conf/*.ctl
    -  chmod -R 666 ./conf/*.ctl
    +  chmod --recursive 666 ./conf/*.ctl
       cp  ${SOURCE_PATH}/conf/*.sed    ./conf
    -  chmod -R 666 ./conf/*.sed
    +  chmod --recursive 666 ./conf/*.sed
       cp  ${SOURCE_PATH}/conf/fse*      ./conf
    -  chmod -R 666 ./conf/fse*
    +  chmod --recursive 666 ./conf/fse*
       chmod +x              ./conf
     
       echo -e "${TURQ}Building ${WHITE}./standalone${TURQ} directory"
    @@ -1792,7 +1792,7 @@
     
       cpsed ${SOURCE_PATH}/jcl/*
       #chmod --silent --recursive 666 jcl/*
    -  chmod -R 666 jcl/*
    +  chmod --silent --recursive 666 jcl/*
       chmod a+rwx ./jcl
       echo -e "${TURQ}Building ${WHITE}./scripts${TURQ} directory"
       if test ! -d scripts
    @@ -1800,7 +1800,7 @@
          mkdir scripts
       fi
       cpsed ${SOURCE_PATH}/scripts/*
    -  chmod -R 777 ./scripts
    +  chmod --recursive 777 ./scripts
       cp ./scripts/sub ./jcl/sub
       cd ./scripts
       ln -s ins0030 startstarter
    @@ -1812,25 +1812,25 @@
          cpsed ${SOURCE_PATH}/scripts/*.bat
          cp ./scripts/sub.bat ./jcl/sub.bat
          cp ${SOURCE_PATH}/windows/qws3270/qws3270.ini ./scripts
    -     chmod -R 777 ./scripts
    +     chmod --recursive 777 ./scripts
          chmod +w ./scripts/qws3270.ini
       else
          rm -rf ./scripts/*.bat
    -     chmod -R 777 ./scripts
    +     chmod --recursive 777 ./scripts
          chmod +x ./scripts
       fi
       if [ "${CHOICE}" = "turnkey" ] ; then
    -     sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_mvs.conf >conf/turnkey_mvs.conf
    -     sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_zzsa.conf >conf/turnkey_zzsa.conf
    +     sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_mvs.conf   -f conf.sed >conf/turnkey_mvs.conf
    +     sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_zzsa.conf  -f conf.sed >conf/turnkey_zzsa.conf
          case "${THEOS}" in
     
             linux)    echo -e "${TURQ}Installing startup scripts for linux"
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_setterm    >setterm
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startmvs   >startmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_saclip     >saclip
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_xstartmvs  >xstartmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_kstartmvs  >kstartmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startzzsa  >startzzsa
    +                  sed ${SOURCE_PATH}/conf/_setterm        -f conf.sed >setterm
    +                  sed ${SOURCE_PATH}/conf/_startmvs       -f conf.sed >startmvs
    +                  sed ${SOURCE_PATH}/conf/_saclip         -f conf.sed >saclip
    +                  sed ${SOURCE_PATH}/conf/_xstartmvs      -f conf.sed >xstartmvs
    +                  sed ${SOURCE_PATH}/conf/_kstartmvs      -f conf.sed >kstartmvs
    +                  sed ${SOURCE_PATH}/conf/_startzzsa      -f conf.sed >startzzsa
                       chmod 777 *
                       ;;
             linux-gnu) echo -e "${TURQ}Installing startup scripts for linux-gnu"
    @@ -1853,15 +1853,15 @@
                       chmod +w qws3270.ini
                       ;;
             *)        echo -e "${TURQ}Installing startup scripts" ${THEOS}
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startmvs.bat    >startmvs.bat
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_setterm         >setterm
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startzzsa.bat   >startzzsa.bat
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_saclip          >saclip
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_saclip.bat      >saclip.bat
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startmvs        >startmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_xstartmvs       >xstartmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_kstartmvs       >kstartmvs
    -                  sed -f conf.sed ${SOURCE_PATH}/conf/_startzzsa       >startzzsa
    +                  sed ${SOURCE_PATH}/conf/_startmvs.bat   -f conf.sed >startmvs.bat
    +                  sed ${SOURCE_PATH}/conf/_setterm        -f conf.sed >setterm
    +                  sed ${SOURCE_PATH}/conf/_startzzsa.bat  -f conf.sed >startzzsa.bat
    +                  sed ${SOURCE_PATH}/conf/_saclip         -f conf.sed >saclip
    +                  sed ${SOURCE_PATH}/conf/_saclip.bat     -f conf.sed >saclip.bat
    +                  sed ${SOURCE_PATH}/conf/_startmvs       -f conf.sed >startmvs
    +                  sed ${SOURCE_PATH}/conf/_xstartmvs      -f conf.sed >xstartmvs
    +                  sed ${SOURCE_PATH}/conf/_kstartmvs      -f conf.sed >kstartmvs
    +                  sed ${SOURCE_PATH}/conf/_startzzsa      -f conf.sed >startzzsa
                       ;;
          esac
          if test ! -d dasd
    @@ -1906,22 +1906,22 @@
             fi
          fi
          if [ ${STARTER_INST} = ${TRUE} ] ; then
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_starter.conf >>conf/turnkey_mvs.conf
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_starter.conf >>conf/turnkey_zzsa.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_starter.conf -f conf.sed >>conf/turnkey_mvs.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_starter.conf -f conf.sed >>conf/turnkey_zzsa.conf
          fi
          if [ ${CBT_INST} = ${TRUE} ] ; then
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_cbt.conf     >>conf/turnkey_mvs.conf
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_cbt.conf     >>conf/turnkey_zzsa.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_cbt.conf     -f conf.sed >>conf/turnkey_mvs.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_cbt.conf     -f conf.sed >>conf/turnkey_zzsa.conf
          fi
          if [ ${SRC_INST} = ${TRUE} ] ; then
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_src.conf     >>conf/turnkey_mvs.conf
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_src.conf     >>conf/turnkey_zzsa.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_src.conf     -f conf.sed >>conf/turnkey_mvs.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_src.conf     -f conf.sed >>conf/turnkey_zzsa.conf
          fi
          if [ ${SMP_INST} = ${TRUE} ] ; then
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_smp.conf     >>conf/turnkey_mvs.conf
    -        sed -f conf.sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_smp.conf     >>conf/turnkey_zzsa.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_smp.conf     -f conf.sed >>conf/turnkey_mvs.conf
    +        sed ${SOURCE_PATH}/conf/turnkey${TURNCONF}_smp.conf     -f conf.sed >>conf/turnkey_zzsa.conf
          fi
    -     chmod -R          666 ${TARGET_PATH}/dasd/*
    +     chmod --recursive          666 ${TARGET_PATH}/dasd/*
          chmod a+x                      ${TARGET_PATH}/dasd
          if [ "${DASDLOC}" = "HDSHADOW" ] ; then
             chmod -w ${TARGET_PATH}/dasd/*
    
  • After installing mvs you may generate some files following the instructions on http://www.bsp-gmbh.com/turnkey/cookbook/genmvs.html: on step INS0010 you must change scripts/makeadisk:

    # ckd2cckd -compress 1 -quiet $1 $1.$2 >>../log/mak$1.log 2>&1
    ckd2cckd -q $1 $1.$2 >>../log/mak$1.log 2>&1
    
  • Изменить файл scripts/ins0050,0080:

    # ckd2cckd -compress 1 -quiet ...
    ckd2cckd -q ...
    
  • Изменить файл scripts/sub:

    #netcat -w1 -vv $HOST $PORT < $1
    netcat -w1 -vv $HOST $PORT < $1
    

Be a Professional

  • ‘owning the problem’ – when someone brings a problem to you, you make sure that it is solved and the person with the problem knows when it is solved, even if you need to ask someone else to solve it.
  • admitting mistakes, putting them right as far as you can, and implementing measures to stop them happening again
  • ensuring that anyone who might be adversely affected by what you are doing is consulted or at least informed – what they are doing might be a lot more important to the organisation than what you are doing!
  • ensuring that you use methods which maximise the quality of your work and minimise any adverse consequences for your users. The rest of this section is devoted to a discussion of some of these ‘professional methods’.

http://web.archive.org/web/20060711085731/http://www.mvsbook.fsnet.co.uk/chap01.htm#Section4

use git work-tree to update production/live site

#!/bin/bash

while read oldrev newrev ref
do
  branch=`echo $ref | cut -d/ -f3`

  if [ "master" == "$branch" ]; then
    git --work-tree=/path/under/root/dir/live-site/ checkout -f $branch
    echo 'Changes pushed live.'
  fi

  if [ "dev" == "$branch" ]; then
    git --work-tree=/path/under/root/dir/dev-site/ checkout -f $branch
    echo 'Changes pushed to dev.'
  fi
done

see http://blog.ekynoxe.com/2011/10/22

Follow

Get every new post delivered to your Inbox.