Thursday, June 13, 2019

Enable and Disable Word Wrap for iTerm on MacOSX

lifted directly from https://apple.stackexchange.com/a/210666/115119 Props to @michid Disable line wrapping:
`tput rmam`
Enable line wrapping:
`tput smam`

Sunday, May 6, 2018

show me lines between two line markers / identifiers with perl

Start makers = 'begin - remote_properties' End markers = 'end - remote_properties'
perl -ne 'next unless /begin - remote_properties/ .. /end - remote_properties/;print' testfile.tibco_beGenerator

Friday, September 29, 2017

du calculate totalsize of list of files

Reading list of files and calculate the total size cat /tmp/deletepurg.txt| tr \\n \\0 | du -skh --files0-from=- --total

Friday, September 1, 2017

reading 3 lines in one time in oneliner perl

  cat PDDV_hosts.txt | perl -e 'while (my $frs=<>) { chomp $frs; $sec=<>; chomp $sec; $th=<> ;printf "%s,%s,%s", $frs, $sec, $th; }'

Thursday, July 20, 2017

Sledgehammer with sudo over remote hosts

dsh ls /etc/bashrc | perl -ne 'BEGIN { printf "export ss=\${1};shift;export args=\$@;" }{ $_=~s/://g;@x=split /\s+/;printf "ssh -t %s \"echo \${ss} | sudo -S -u tibcosilver \${args} \"\n",$x[0], $x[2]}' | tee out
perl -i -pe "s/#/'/g" out
echo "Please run: . out [Password]"

Friday, June 2, 2017

TIBCO Obfuscate encypt and decrypt : how to ...

Decrypt.java
import com.tibco.security.ObfuscationEngine;
public class Decrypt {

  public static void main(String[] args) throws Exception {
try {
    System.out.println(ObfuscationEngine.decrypt(args[0]));
} catch (Exception e ) {
}
    System.out.println(ObfuscationEngine.encrypt(args[0].toCharArray()));
  }
}
Compile
javac -cp /opt/tibco/RA1.1/tra/5.9/lib/TIBCrypt.jar  Decrypt.java
Run
java -cp .:/opt/tibco/RA1.1/tra/5.9/lib/TIBCrypt.jar:/opt/tibco/RA1.1/tpcl/5.9/lib/slf4j-log4j12-1.5.2.jar:/opt/tibco/RA1.1/tpcl/5.9/lib/slf4j-api-1.5.2.jar:/opt/tibco/RA1.1/tpcl/5.9/lib/log4j-1.2.15.jar:.  Decrypt "$@"
$ ./run.sh HelloWorld
#!oUNDLWlfuOH60LsUdl/qjrkGRADiglWRuw5Z4mGaUFU=
$ ./run.sh '#!oUNDLWlfuOH60LsUdl/qjrkGRADiglWRuw5Z4mGaUFU='
HelloWorld
#!UsKsGea13VhSx9H+IRO9xrgqRjFQn4RC2n8LybKGyPtgss4cYLwXbKt/Clc++ljpVQsAqhsMJE3sJqk9JY4xJi3LnRXW7rCK/layTvt+xXxqpZB9sX8JjqQUxNn1FrjokjFAKrPTNGM=

Tuesday, May 16, 2017

reconstructing oracle connect string from userenv details

select sys_context('userenv','IP_ADDRESS') || '=' || sys_context('userenv','instance_name')  || '.' || sys_context('userenv','db_domain') from dual;