June 22, 2012

Patching vmware vmnet module for Linux 3.2.*

When installing vmware player 4.0.4, I had the nice surprise of finding out that the vmnet kernel module would not properly compile while starting the vmware service. 2012-06-22T15:34:41.039+01:00| vthread-3| I120: Building module vmnet. 2012-06-22T15:34:41.040+01:00| vthread-3| I120: Extracting the sources of the vmnet module. 2012-06-22T15:34:41.046+01:00| vthread-3| I120: Building module with command: /usr/bin/make -j -C /tmp/vmware-root/modules/vmnet-only auto-build SUPPORT_SMP=1 HEADER_DIR=/lib/modules/3.2.0-25-generic/build/include CC=/usr/bin/gcc GREP=/usr/bin/make IS_GCC_3=no VMCCVER=4.6 2012-06-22T15:34:41.835+01:00| vthread-3| I120: Failed to compile module vmnet! Manually directly compiling the module, we see a couple of incompatibility with the kernel header definitions ... Read more

November 24, 2009

Ideone - compiler pastebin

A friend of mine, just tossed me this link.. http://ideone.com/ What makes Ideone different from any other pastebin is its compiler feature; Supporting about 20 programing language, you will be able to live compile (of course with some limitations) your code. Let’s find out the perl version running on that server [sourcecode language=“c”] print $]; [/sourcecode] and result? [sourcecode language=“c”] result: success time: 0s memory: 3248 kB signal: 0 input: no output: ... Read more

July 2, 2009

Check your IP periodically with a small shell script

For those who are subject to dynamically assigned DSL IP, you would probably be familiar with a site such as http://myip.dk Here is a small script I use to fetch my public IP for other script processes updated “due to changes on the site myip.dk, I rewrote the script” #!/bin/bash link=lynx -dump -listonly 'http://myip.dk' | awk -F: '/myip.dk/ && $0 != "" { getline; print $0}' | awk -F " " {'print $2'} curl -s $link | grep ‘“Box”’ | egrep -o ‘[0-9. ... Read more

November 5, 2008

Wrap your shell commands

One of the most annoying matter I have met when administrating a server was following and fixing messes other users (who happen to have root password) would do on the server. Random users with root passwords often know two things… “sh” and “history -c”… and of course “I didn’t do it”. Now, while it is important to keep logs of activities on the server, it is even better to be able to pull up logs of every single commands entered plus their arguments. ... Read more

October 22, 2008

Quick Script to monitor a process

There are numerous programs such as monit which are widely used as to monitor processes and take certain actions in case of different events. Here is a little tip as to quickly monitor an service/process if you aren’t wanting to go through the hassle to configure monit #!/bin/bash r=$(ps cax |grep -c NAME_PROCESS) if [ $r -eq 0 ]; then service NAME_PROCESS restart echo “NAME_PROCESS has crashed” | mail -s “monitoring SERVERID” your_Email_Address fi ... Read more

October 6, 2008

10 tips to optimize your PHP code

if you were to use between print or echo… use echo (Echo is known to be faster than print) when doing string searches or action, do not simply/quickly jump on regex, but first have a look at php api’s string functions such as strpbrk, stripos etc.. Display smart error messages… A lot of young developers like to display a custom error or show systems errors whenever something break. Although it is good practice to alert the user of any error, keep in mind printing Error cost a lot in resources. ... Read more