export HOME="/cygdrive/c/Docume~1/MyUserName"
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Friday, October 16, 2009
Cygwin wmaker failures on the wmaker.inst
Removing the errors that occur on the wmaker.inst directory not found ... change the Documents And Settings to the Docume~1 (8 char) notation in the .bashrc
Removing lines context based with -pe
Removing lines with the -pe option.
perl -i -pe '
s/true/false/g;
s/^.+user-preferred.+$//g;
s/^.*(<\/cluster>.*)$/$1 xsi:nil="true">$2/g;
s/^.*(<\/machine>.*)$/$1 xsi:nil="true">$2/g;
if ($_ =~ // ) {
$ssl='on';
}
if ($_ =~ /listen-port/ and $ssl) {
$_ = undef;
$ssl= undef;
}
if ($_ =~ /
}
if ($_ =~ /<\/jta-migrat/ ) { $m = undef; $_ = undef; } ' spa/qas/config/config.xml vi spa/qas/config/config.xml
Wednesday, October 7, 2009
Cygwin Bell Elimination On Backspace
echo set bell-style none >> $HOME/.inputrc
Oracle: Listing All Invalid PLSQL Packages
SELECT count(*) FROM ALL_OBJECTS WHERE owner = 'MYAPP' and OBJECT_TYPE like 'PACKAGE\%' and status = 'INVALID'; ";
Showing CLOB information for Oracle
SELECT dbms_lob.substr(a.user_data.payload, 3000,1) FROM vmsut.tms_queue_table a
Perl And Capturing remote stdout and strerr streams
The script opens the
systemout.log
of the nodeagent and finds the references to the incident streams and shows them on the screen. Helpfull for troubleshooting WebSphere startup problems.#!/usr/bin/perl
open (CMD, "( /usr/bin/ssh foouser\@host1 'cd pf/logs/nodeagent/;cat systemout.log | grep resetIncidentStream | cut -b152-') |")
or die "ERROR: $!";
while () {
print $_, "\n";
open (CMD2, "( /usr/bin/ssh foouser\@host2 'grep -i exception $_') |");
while () {
print "$_";
}
}
close (CMD);
DBIx Statement Debugging
Export the variable and the SQL statements will be echo'ed.
export DBIX_CLASS_STORAGE_DBI_DEBUG=1
Eclipse over XWindows
Running and rendering the remote XWin session of eclipse.
61 set | grep SSH [me@remote ~]$ set | grep SSH SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass SSH_CLIENT='172.18.153.150 49238 22' SSH_CONNECTION='172.18.153.150 49238 10.10.10.3 22' SSH_TTY=/dev/pts/3Use the SSH_CONNECTION ip listed on local to export
60 xhost + 70 ssh -X foouser@ip_remote_host 'export DISPLAY=172.18.153.150:0;/opt/eclipse-3.3.1.1-europa/eclipse/eclipse'Do not use the hostname or worse alias for the remote but use the remote ip address in our example 10.10.10.3 When you do not have a local Xserver running you might see this:... if thats the case change your myhostnameasalias to the network IP address of the remote host, 10.10.10.3..
me@local $ ssh -X 'me@myhostnameasalias' 'export DISPLAY=172.18.153.150:0;java -Xmx1536m -Xms1024m -jar myjar.jar ' Warning: untrusted X11 forwarding setup failed: xauth key data not generated Warning: No xauth data; using fake authentication data for X11 forwarding. Jun 21, 2012 12:01:18 PM java.util.prefs.FileSystemPreferences$2 run INFO: Created user preferences directory. Exception occurred in main() of MyProgram java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68) at sun.awt.X11.XToolkit.To solve this ....(XToolkit.java:89) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at java.awt.Toolkit$2.run(Toolkit.java:834) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826) at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:120) at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1556) at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:130) at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1591) at javax.swing.UIManager.setLookAndFeel(UIManager.java:514) at javax.swing.UIManager.setLookAndFeel(UIManager.java:554)
Adding User for CVS
Adding a linux user to have access to CVS repository
515 adduser -s /bin/bash pgattamaneni
531 usermod -G cvs pgattamaneni
532 passwd pgattamaneni
Reset Root password MySQL
Steps for the resetting root password of the MySQL database user.
# /etc/init.d/mysql stop
# /usr/bin/mysqld_safe --skip-grant-tables --user=root
# mysql -u root
update mysql.user SET password=PASSWORD('newpasswd') where User='root';
flush privileges;
# kill `cat /var/run/mysqld/mysqld.pid`
# /etc/init.d/mysql restart
# mysql -u root -p
Execute remote command on multiple boxes oneliner
You'll have to have password less logon with ssh setup for these commands. In this case the blue command is creating symlinks and x has a list of user@host's
[cmbuild3@pghpscmbldl01 ~]$ cat x | xargs -i{} -t ssh {} '[ ! -e wad ] && ln -s /opt/g/ad/stat/wls/ad/; [ ! -e logs ] && ln -s /var/g/ad/logs/wls/ad/ logs '
[cm@pgh ~]$ cat x
adqas@qpada01
adqas@qpada02
adqas@qpada03
adqas@qpada04
etc
/bin/bash infinite loop oneliner
How to run a command in a loop as a one liner. I always get confused with the semi-colons and dones...
while (true) do curl http://sspq1/cgi-bin/spologin.pl -d "username=x-1&password=fxxx&login=LOGIN"; done; while (true) do perl msdash.pl -e QAS -a PDI-Cluster -r gss 2> /dev/null | grep get; done;For a for in do loop the syntax for the one liner looks like this with an extra semi colon after the for statement declaration.
for i in {1..15}; do wget http://www.hairuwear.com/sites/all/themes/hairuwear/images/slide$i.jpg; done;
WebLogic JRockit jrcmd diagnostics
JRockit Diagnostic Commands
Here is a list of other jrockit commands that can be used for performance tuning .
Here is a list of other jrockit commands that can be used for performance tuning .
22 export JAVA_HOME=/opt/bea/java/jrockit-R27.1.0-jdk1.5.0_08/
23 export PATH=$PATH:$JAVA_HOME/bin
26 jrcmd `ps auxww | grep -v grep | grep gbrServer | awk '{ print $2 }'` print_threads
Finding Classes In Multiple Jars or Directories
Very simple
find
with xargs
as the icing on top, in this example we are looking for the package webservices.find . -name '*.jar' | xargs -i{} -t jar tfv {} | grep -i webservicesIf you have a problem and do not have access to the jar utility an alternative could be and also ITS BLAZINGLY FASTER
$ find . -name '*.jar' | xargs -i{} -t unzip -l {} | grep -i sun.awt.X11GraphicsEnvironment
SSH Password less logon
$ pwd
/home/foouser
$ cd ..
$ ls -rtl
total 32
drwxrwsrwx 2 foouser 0 8192 Jan 23 13:57 foouser
$ chown akaan akaan
$ chmod 700 AKAAN
$ ls -rtl
total 32
drwxr-sr-x 2 foouser 0 8192 Jan 23 13:57 foouser
$ cd foouser
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh
$ vi authorized_keys
~authorized_keys" [New file] 1 line, 218 characters
$ chmod 600 *
$ ls -lrt
total 16
-rw------- 1 foouser 0 217 Jan 23 14:02 authorized_keys
Labels:
ssh
Perl Substitution and Write Oneliner
Always looking for the proper syntax:
bash-3.2$ perl -i -pe 's/751818/akaan/' andre
-i = takes the first argument as a file
-e = execute command
-p = runs command surrounding while (<FILE>) { }
bash-3.2$ perl -i -pe 's/751818/akaan/' andre
-i = takes the first argument as a file
-e = execute command
-p = runs command surrounding while (
Cygwin Xwin startx
Default installation of cygwin and Xwindows
There are two ways of starting up:
There are two ways of starting up:
- opening a bash-shell window and run startx
- opening explorer and run startxwin.bat from /usr/bin
- create ~/.bash_profile
export HOME="C:/Docume~1/[uid]
- create ~/.xserverrc
X :0 -clipboard -silent-dup-error
- create ~/.xinitrc
exec wmakerregarding 2)
Subscribe to:
Posts (Atom)