Friday, 22 February 2013

Oneliner to wrap long line into 80 characters

cat /dev/clipboard | perl -e 'use Text::Wrap;$Text::Wrap::columns = 160;while (<>){print wrap("","",$_);}' > /dev/clipboard

Had to set $Text::Wrap::columns to 160 to correctly wrap cyrillic characters under Cygwin 7.1.

Thursday, 31 January 2013

Useful onliner to make testing in Oracle SQL*Developer a little bit easier

This little script helps to test subroutines using SQL*Developer Run or Debug command.  Just copy code from "Run PL/SQL" window and run the following onliner in a terminal. It uncomments legacy dbms_ouput code and extends capacity of varchar2 variables from 200 to 32767 chars. Now paste clipboard contents back into SQL Worksheet and run.

cat /dev/clipboard | perl -p -e 's/\/\* Legacy output://g; s/\*\///g; s/VARCHAR2\(200\)/VARCHAR2\( 32767 char \)/g;s/^\s+:.*$//g' > /dev/clipboard

Thursday, 10 May 2012

Count empty lines in your source files with this pipe command

grep -Pc "^$" *.cpp *.h *.tpp | awk -F ":" '{ s += $2 } END { print s }'

Sunday, 22 April 2012

Some notes on elegant code

Some thoughts concerning questions that were put (and answered) in Steve McConnells's "Code Complete":
Coding habits 

Thursday, 19 April 2012

Useful E-Texteditor commands and options

--clearstate    : Don't reload files from last session.
--clearlayout   : Resets window layout and positions.
--clearundo     : Clear undo history for all un-milestoned files.
--noupdate      : Do not perform new version check at startup.
More commands 

Wednesday, 11 April 2012

Oracle: Case insensitive regexp search through all sources

select *
from all_source
where regexp_like( text, regexp_search_string, 'i' )

Sunday, 8 April 2012

ASCII-gramm for using wget to clone website

wget -k -N -p -np -r LINK
      |  |  |   |  | 
convert  |  |   |  recursive
  links  |  |   |
     to  |  |   don't go to
  local  |  |   the parent level
         |  |
    do not  get all
  retrieve  images, etc.
     files  to show the page
until they   
 are newer    
then local