Start -> run -> rundll32.exe keymgr.dll, KRShowKeyMgr
2010-09-20
Create System Restore Point by VB Script
This can be achieved via a small vbs script:
rp=InputBox("Enter Description for this manual Restore Point")
GetObject("winmgmts:\\.\root\default:Systemrestore").CreateRestorePoint rp, 0, 100
MsgBox("Created Manual Restore Point:" & chr(13) & chr(13) &rp )
rp=InputBox("Enter Description for this manual Restore Point")
GetObject("winmgmts:\\.\root\default:Systemrestore").CreateRestorePoint rp, 0, 100
MsgBox("Created Manual Restore Point:" & chr(13) & chr(13) &rp )
2010-09-14
Disable ipv6 protocol in Windows 7/Vista
- In Registry Editor, locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\
- Double-click DisabledComponents to modify the DisabledComponents entry.
Note If the DisabledComponents entry is unavailable, you must create it. To do this, follow these steps:
In the Edit menu, point to New, and then click DWORD (32-bit) Value.
Type DisabledComponents, and then press ENTER.
Double-click DisabledComponents.
- Type 0xffffffff to disable all IPv6 components, except the IPv6 loopback interface. This value also configures Windows Vista to use Internet Protocol version 4 (IPv4) instead of IPv6 in prefix policies.
That's it!
2010-03-25
Make festival work with Pulseaudio
Debian Squeeze runs PulseAudio which provides a /dev/dsp however festival can't open it:
echo "test" | festival --ttsLinux: can't open /dev/dsp
Using emulation causes a segementation fault:
echo "test" | padsp festival --tts
Segmentation fault
The way to do it right is to create /etc/festival.scm with the following contents:
;;;; Use pulseaudio to output sound
(Parameter.set 'Audio_Command "paplay -n festival $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)
Then use festival as usual:
echo "test" | festival --tts
That's it!
echo "test" | festival --ttsLinux: can't open /dev/dsp
Using emulation causes a segementation fault:
echo "test" | padsp festival --tts
Segmentation fault
The way to do it right is to create /etc/festival.scm with the following contents:
;;;; Use pulseaudio to output sound
(Parameter.set 'Audio_Command "paplay -n festival $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)
Then use festival as usual:
echo "test" | festival --tts
That's it!
2010-02-21
MRTG - Custom monitoring of a linux box using net-snmp (lm-sensors)
Assume you want to monitor the FAN rotation of your CPU and CPU and MB temperature:
Step 1: Set up lm-sensors
rtfmlm-sensors
Step 2: Create check script (e.g. /var/www/mrtg/sensors)
#!/bin/bash
case $1 in
fan)
/usr/bin/sensors | grep fan1| awk '{print $2}'
;;
temp)
/usr/bin/sensors | grep temp1| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
/usr/bin/sensors | grep temp3| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
;;
esac
Step 3: Extend snmpd.conf
extend .1.3.6.1.4.1.2021.50 fan /var/www/mrtg/sensors fan
extend .1.3.6.1.4.1.2021.51 cpu_temp /var/www/mrtg/sensors temp
Step 4: Snmpwalk required OID
rtfm snmpwalk
Step 5: Extend mrtg.conf
Target[atom.fan]: .1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1&.1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1:public@localhost
Title[atom.fan]: CPU Fan speed
PageTop[atom.fan]: <H1>CPU Fan Speed</H1>
MaxBytes[atom.fan]: 5000
ShortLegend[atom.fan]: rpm
YLegend[atom.fan]: RPM
LegendI[atom.fan]: CPU fan speed
Options[atom.fan]: growright,nopercent,unknaszero,gauge,noo
Unscaled[atom.fan]: ymwd
Target[atom.temp]: .1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.1&.1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.2:public@localhost
Title[atom.temp]: Temperature
PageTop[atom.temp]: <H1>Temperature</H1>
MaxBytes[atom.temp]: 100
ShortLegend[atom.temp]: °C
YLegend[atom.temp]: Temperature
LegendI[atom.temp]: CPU Temperature
LegendO[atom.temp]: MB Temperature
Options[atom.temp]: growright,nopercent,unknaszero,gauge
Unscaled[atom.temp]: ymwd
That's it!
Step 1: Set up lm-sensors
rtfmlm-sensors
Step 2: Create check script (e.g. /var/www/mrtg/sensors)
case $1 in
fan)
/usr/bin/sensors | grep fan1| awk '{print $2}'
;;
temp)
/usr/bin/sensors | grep temp1| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
/usr/bin/sensors | grep temp3| awk '{print $2}'| sed "s/[+|°C]//g" | sed "s/\..*$//g"
;;
esac
Step 3: Extend snmpd.conf
extend .1.3.6.1.4.1.2021.50 fan /var/www/mrtg/sensors fan
extend .1.3.6.1.4.1.2021.51 cpu_temp /var/www/mrtg/sensors temp
Step 4: Snmpwalk required OID
rtfm snmpwalk
Step 5: Extend mrtg.conf
Target[atom.fan]: .1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1&.1.3.6.1.4.1.2021.50.4.1.2.3.102.97.110.1:public@localhost
Title[atom.fan]: CPU Fan speed
PageTop[atom.fan]: <H1>CPU Fan Speed</H1>
MaxBytes[atom.fan]: 5000
ShortLegend[atom.fan]: rpm
YLegend[atom.fan]: RPM
LegendI[atom.fan]: CPU fan speed
Options[atom.fan]: growright,nopercent,unknaszero,gauge,noo
Unscaled[atom.fan]: ymwd
Target[atom.temp]: .1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.1&.1.3.6.1.4.1.2021.51.4.1.2.8.99.112.117.95.116.101.109.112.2:public@localhost
Title[atom.temp]: Temperature
PageTop[atom.temp]: <H1>Temperature</H1>
MaxBytes[atom.temp]: 100
ShortLegend[atom.temp]: °C
YLegend[atom.temp]: Temperature
LegendI[atom.temp]: CPU Temperature
LegendO[atom.temp]: MB Temperature
Options[atom.temp]: growright,nopercent,unknaszero,gauge
Unscaled[atom.temp]: ymwd
That's it!
MRTG - Performance monitoring of a linux box using net-snmp
LoadMIBs: /usr/share/mibs/netsnmp/UCD-SNMP-MIB
Target[atom.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
Title[atom.cpu]: Server CPU Load
PageTop[atom.cpu]: <H1>CPU Load - System, User and Nice Processes</H1>
MaxBytes[atom.cpu]: 100
ShortLegend[atom.cpu]: %
YLegend[atom.cpu]: CPU Utilization
Legend1[atom.cpu]: Current CPU percentage load
LegendI[atom.cpu]: Used
LegendO[atom.cpu]:
Options[atom.cpu]: growright,nopercent,unknaszero
Unscaled[atom.cpu]: ymwd
Target[atom.memory]: memAvailReal.0&memTotalReal.0:public@localhost
Title[atom.memory]: Free Memory
PageTop[atom.memory]: <H1>Free Memory</H1>
MaxBytes[atom.memory]: 100000000000
ShortLegend[atom.memory]: B
YLegend[atom.memory]: Bytes
LegendI[atom.memory]: Free
LegendO[atom.memory]: Total
Legend1[atom.memory]: Free memory, not including swap, in bytes
Legend2[atom.memory]: Total memory
Options[atom.memory]: gauge,growright,nopercent,unknaszero
kMG[atom.memory]: k,M,G,T,P,X
Title[atom.mempercent]: Percentage Free Memory
PageTop[atom.mempercent]: <H1>Percentage Free Memory</H1>
Target[atom.mempercent]: ( memAvailReal.0&memAvailReal.0:public@localhost ) * 100 / ( memTotalReal.0&memTotalReal.0:public@localhost )
Options[atom.mempercent]: growright,gauge,transparent,nopercent,unknaszero
Unscaled[atom.mempercent]: ymwd
MaxBytes[atom.mempercent]: 100
YLegend[atom.mempercent]: Memory %
ShortLegend[atom.mempercent]: Percent
LegendI[atom.mempercent]: Free
LegendO[atom.mempercent]: Free
Legend1[atom.mempercent]: Percentage Free Memory
Legend2[atom.mempercent]: Percentage Free Memory
That's it!
Join a string array to a string in Java - like join() in Perl
An implementation of Perl like join() function in Java:
Enjoy!
public static String join(String[] strings, String separator) {
StringBuffer sb = new StringBuffer();
for (int i=0; i < strings.length; i++) {
if (i != 0) sb.append(separator);
sb.append(strings[i]);
}
return sb.toString();
}
Enjoy!
How to fix NO_PUBKEY errors in "apt-get update" operations
Just keep stumbmling upon it every time:
You should run the following to fix it (substitute F1D53D8C4F368D5D with the one from your error message):
Now you can run apt-get update and will not get an error message.
W: GPG error: http://ftp.de.debian.org stable/non-US Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F1D53D8C4F368D5D
W: You may want to run apt-get update to correct these problems
W: You may want to run apt-get update to correct these problems
You should run the following to fix it (substitute F1D53D8C4F368D5D with the one from your error message):
gpg --keyserver subkeys.pgp.net --recv F1D53D8C4F368D5D
gpg --export --armor F1D53D8C4F368D5D | apt-key add -
gpg --export --armor F1D53D8C4F368D5D | apt-key add -
Now you can run apt-get update and will not get an error message.
That's it!
"Fork" in bash w/ timeout
This simple bash script will call “a_very_long_operation” command and wait for LIMIT seconds until it exits with 1.
Otherwise the script will exit with the return code of the command
#!/bin/sh
WAIT=1
LIMIT=10
echo "Forkie"
function fork {
$1 >/dev/null 2>&1
echo $? > $3
rm -f $2
}
FORK_STATUS="/tmp/forkie.fork.$$"
FORK_RETURN="/tmp/forkie.ret.$$"
rm -f $FORK_STATUS $FORK_RETURN
touch $FORK_STATUS
fork "a_very_long_operation" $FORK_STATUS $FORK_RETURN &
TIMEOUT=0
while [ $TIMEOUT -le $LIMIT ]
do
if ! [ -f $FORK_STATUS ]
then
RC=`cat $FORK_RETURN`
rm -f $FORK_RETURN
exit $RC
fi
sleep $WAIT
TIMEOUT=`expr $TIMEOUT + $WAIT`
if [ $TIMEOUT -eq $LIMIT ]
then
exit 1
fi
done
That’s it!
Tutorial to set up Axis2 + Eclipse Galileo + Tomcat Framework
There's a great tutorial how to set up an Axis 2 webservice development framework using recent versions:
Eclipse Galileo
Tomcat 6
Axis 2
Check it out here: http://www.vogella.de/articles/Webservice/article.html
Eclipse Galileo
Tomcat 6
Axis 2
Check it out here: http://www.vogella.de/articles/Webservice/article.html
2010-01-16
External NTFS disk auto mounted read-only in squeeze
Recently I noticed (may be after an update) that my external NTFS disk was mounted read-only after plugging it in. This was strange since the r/w mount worked since a couple of years with ntfs-3g.
The fs mount options were these:
but I got permission denied errors on file creation attempts.
Classic command line mount as super user worked fine, but not for an unprivileged user. I looked hours for hal and udev settings but the solution was obviously much more simple:
Since then the fs mount options became these:
And file creation works like a charm again.
That's it!
The fs mount options were these:
ntfs-3g(rw,nosuid,nodev,uhelper=devkit,uid=1000,gid=1000,dmask=0077)
but I got permission denied errors on file creation attempts.
Classic command line mount as super user worked fine, but not for an unprivileged user. I looked hours for hal and udev settings but the solution was obviously much more simple:
# ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfsSince then the fs mount options became these:
fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=512)
And file creation works like a charm again.
That's it!
Subscribe to:
Posts (Atom)