Saturday, December 24, 2011

VNC on SuSE and openSuSE

wanted to have VNC server installed on SUSE10 and openSUSE12
but it looks like both vino and Xvnc doesn't support copy & paste between local and remote...
found x11vnc works out of the box with copy & paste, to have to up running by default after server boots up:

cat /etc/SuSE-release 
openSUSE 12.1 (x86_64)
VERSION = 12.1
CODENAME = Asparagus

- x11vnc is in the repo of openSUSE12
zypper install x11vnc
x11vnc -storepasswd /etc/x11vnc.passwd
- add the following line to rclocal:
/usr/bin/x11vnc -sleepin 30 -o /var/log/x11vnc.log -forever -noncache -noxfixes -noxdamage -rfbauth /etc/x11vnc.passwd -display :0 -auth `ps -eaf | grep Xorg | awk {'print $15'}` &


cat /etc/SuSE-release 
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10

- find x11vnc-0.9.2-1.guru.suse101.x86_64.rpm and install it
- add the following line to rclocal:
/usr/bin/x11vnc -sleepin 30 -o /var/log/x11vnc.log -forever -noncache -noxfixes -noxdamage -rfbauth /etc/x11vnc.passwd -display :0 -auth /var/lib/gdm/:0.Xauth &

Tuesday, December 20, 2011

rc.local on SuSE and openSuSE



create a file under:
/etc/rc.d/rclocal



--- USE the following header in the file content ---
#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Felix Wu
#
# /etc/init.d/rclocal
#
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 5
# Default-Stop: 0 1 2 3 6
# Description: Felix's rclocal
### END INIT INFO
--- EOF ---

to make it effective:
chmod 755 rclocal
chkconfig rclocal on

Thursday, December 8, 2011

# of threads in a process under Linux

How to check number of threads in a process under Linux? top doesn't show it, but option "m" in ps will.
I put a space in front and after PID so it doesn't grep longer PID that contains the shorter PID in same sequence.

ps -elm | grep " $PID " | grep -v grep | wc -l
e.g.

ps -elm | grep " 9919 " | grep -v grep | wc -l

Wednesday, December 7, 2011

speed up Notes under Linux

This is only tested under an eclipse based Notes in Linux.

I changed the following, adjust the memory size to fit your system:
/opt/ibm/lotus/notes/framework/rcp/deploy/jvm.properties
vmarg.Xmx=-Xmx768m
vmarg.Xms=-Xms512m

I see the following files for sametime and Symphony, so probably the same jvm parameters for those but I have not tested them:
/opt/ibm/lotus/Sametime/rcp/deploy/jvm.properties
/opt/ibm/lotus/Symphony/framework/rcp/deploy/jvm.properties

Thursday, December 1, 2011

meego 1.2 syslinux hang after boot

installed meego-netbook-ia32-chrome-1.2.0 on my very first AspireOne A110L
it randomly hangs when boot up, quite annoying that I need to power on and off several times to get pass by this...
the screen would show a SYSLINUX message then everything just frozen!

looks like some boot loader timing issue to me, the following change seems to do the trick:
/boot/extlinux/extlinux.conf
prompt 1

timeout 10

Wednesday, November 30, 2011

unlock desktop under openSUSE12

Not sure if this is just an openSUSE default gnome setting or a new gnome setting, but after you installed openSUSE12 with gnome desktop, the desktop is locked! cannot right click, cannot see any files/directories under your desktop, it is just weird.  To unlock it, run gnome-tweak-tool from terminal:


gnome-tweak-tool
Desktop -> Have file manager handle the desktop

Back to normal again :-)

Tuesday, November 29, 2011

Windows Server 2008R2 CTRL-ALT-DEL doesn't work for VNC


So MS decided to disable software emulation of CTRL-ALT-DEL in Windows Server 2008R2, guess it propose some more vulnerability to Windows.. it caused some grief when using VNC viewer..

1. run -> gpedit.msc

2. Computer Configuration > Administrative Templates > Windows components -> Windows Logon Options -> "Disable or enable software Secure Attention Sequence".

3. Change the following:
Enabled
Services and Ease of Access applications

Thursday, November 24, 2011

python web login script


this script assumes the login website first return a page with session ID, second page would present the login and password field associated with the session ID.


on redhat, make sure you have python installed and also install mechanize:
yum install python-mechanize.noarch


#!/usr/bin/python
import mechanize
from urllib2 import urlopen
from ClientForm import ParseResponse


res1 = mechanize.urlopen("http://login.domain.com/")
#print res1.read()
forms = ParseResponse(res1, backwards_compat=False)
form1 = forms[0]


print "sessionID "
print form1["sessionID"]


res2 = mechanize.urlopen(form1.click())
#print res2.read()
forms = ParseResponse(res2, backwards_compat=False)
form2 = forms[0]


print form2


form2["username"] = "myusername"
form2["password"] = "mypassword"
urlopen(form2.click())
print urlopen(form2.click()).read()

Thursday, November 17, 2011

java default sizes

to see the default stack, heap sizes in IBM JRE/JDK, run this command:
java -verbose:sizes -version

Tuesday, November 8, 2011

Ubuntu chkconfig equivalent

what's the command line service config tool in ubuntu for different runlevel?

apt-get install sysv-rc-conf

Wednesday, July 27, 2011

Empathy logs in Ubuntu

Empathy logs your conversation by default and it seems to store its log in different locations between different releases? on ubuntuforum thread people found it under:
~/.gnome2/Empathy/logs
~/.local/share/Empathy/logs
~/.local/share/empathy


On my Ubuntu 10.10 I found them here:

~/.local/share/TpLogger/logs

Friday, July 8, 2011

Ubuntu 10.10 on Acer AspireOne 522

quite a few issues with Ubuntu 10.10 on AOD522


Problem #1 - it keeps hanging after login:
disable the atl1c driver and update the initramfs image:
add in /etc/modprobe.d/blacklist.conf this line
blacklist atl1c
update-initramfs -u



Problem #2 - getting AMD video driver to work:
sh ati-driver-installer-11-6-x86.x86_64.run --buildpkg Ubuntu/maverick
apt-get install -y debhelper dh-modaliases libqtgui4 execstack
sh ati-driver-installer-11-6-x86.x86_64.run --buildpkg Ubuntu/lucid
aticonfig --initial
aticonfig --resolution=0,1280x720

Problem #3 - speaker doesn't turn off after headset plugged in:
apt-get install pavucontrol
/etc/modprobe.d/options.conf
options snd-hda-intel model=laptop,dell-vostro position_fix=0,1

If you don't like the new interface with mutter, you can get the old netbook-launcher back:
apt-get install netbook-launcher-efl





Tuesday, July 5, 2011

USVN with Active Directory

to make USVN's LDAP working with Active Directory was tricky, use the following in config.ini

alwaysUseDatabaseForLogin = "admin"
authAdapterMethod = "ldap"
ldap.options.host = "domain.com"
ldap.options.port = "389"
ldap.options.username = "CN=username,CN=users,DC=domain,DC=com"
ldap.options.password = "password"
ldap.options.useStartTls = "0"
ldap.options.useSsl = "0"
ldap.options.bindDnFormat = "%s"
ldap.options.bindRequiresDn = "1"
ldap.options.baseDn = "DC=domain,DC=com"
ldap.options.accountCanonicalForm = "0"
ldap.options.allowEmptyPassword = "0"
ldap.options.optReferrals = "0"
ldap.options.accountDomainName = ""
ldap.options.accountDomainNameShort = ""
ldap.options.accountFilterFormat = "(&(objectClass=user)(sAMAccountName=%s))"
ldap.createGroupForUserInDB = "1"
ldap.createUserInDBOnLogin = "1"

Thursday, April 7, 2011

JIRA instance restarter

Just a simple script I use to watch for JIRA process, in case if it dies the script would restart it automatically.  This can be used for whatever process.  Note: it's using ps awwx under Solaris.

#!/bin/sh


jira=$1

pid=`/usr/ucb/ps awwx | grep java | grep "$jira"  | awk {'print $1'}`

if [ "$pid" = "" ]
then
    pid=0
fi
if [ $pid -gt 1 ]

then
    echo $jira" - JIRA is running fine"
else
    echo $jira" - JIRA is not running, trying to restart... "
    echo $jira"bin/restart.sh"
    $jira"bin/restart.sh"
fi


----------------------------------------------------------------
few more JIRA house keeping daily scripts:


## lock-cleanup.sh

#!/bin/sh
JIRA_HOME=/opt/global/jira
if [ -f $JIRA_HOME/index/comments/write.lock ];
then
    rm $JIRA_HOME/index/comments/write.lock
fi
if [ -f $JIRA_HOME/index/issues/write.lock ];
then
    rm $JIRA_HOME/index/issues/write.lock
fi


----------------------------------------------------------------
## backup-cleanup.sh 
#!/bin/sh
JIRA_HOME=/opt/global/jira
DAYS=30
find $JIRA_HOME/backup/ -name "*.zip" -ctime +$DAYS -exec rm {} \;

Friday, April 1, 2011

concrete5 add-ons install in FreeBSD

concrete5.org provides lots cool add-ons that can be installed by GUI in your concrete5 site.  The add-on is a archive zip file where it needs to be unzipped to your concrete5 web directory on the server.  If you try to install it by GUI with one click and your backend is running on FreeBSD, you going to see an install failed message without further details.  The root cause is that concrete5 hardcoded the path of unzip under /usr/bin/unzip

fix:
install unzip from FreeBSD ports, it will be located in /usr/loca/bin/unzip
cd /usr/ports/archivers/unzip
make ; make install ; make clean

make a symbolic link to it:
cd /usr/bin/
ln -s /usr/local/bin/unzip unzip

now you are done, enjoy one click install!

Tuesday, March 22, 2011

converting decimals to binary & hex

Trying to keep brain from getting rusty... coded some simple functions in C that takes a decimal and spits out binary and hex.  Thought I might share it, enjoy!



#include
#include

void dec2bin(int dec);
void dec2hex(int dec);

int main(char *argv[])
{
    int i,j,num,tmp;

    scanf("%d",&num);
    printf("dec: %d\n",num);
    printf("bin: ");
    dec2bin(num);
    printf("\nhex: ");
    dec2hex(num);
}

void dec2bin(int dec)
{
    if (dec>0)
    {
        dec2bin(dec>>1);
        if (dec&1>=1)
            printf("1");
        else
            printf("0");
    }
}

void dec2hex(int dec)
{
    if (dec>0)
    {
        if (dec<10)
            printf("%d",dec);
        else if (dec>15)
        {
            dec2hex(dec/16);
            dec2hex(dec%16);
        }
        else
            printf("%c",dec-10+'A');
    }
    else
        printf("0");
}

Monday, March 7, 2011

using ipod shuffle under linux

I've been using gtkpod with my ipod shuffle.  A while ago, not sure what I have done when loading new songs into it, seems everything is corrupted, in gtkpod and hipo both shows the old songs, but when I play it there were only a few new songs available on the device and old ones were not in there.  Tried both gtkpod and hipo to delete the songs to start from fresh but had no luck.  At the end, command line tools does th trick, install gnupod-tools

gnupod_INIT -m /media/IPOD
gnucheck_--fixit -m /media/IPOD