Tuesday 8 November 2011

Grub, no count down after failed run, how to fix it

This default grub behavior could be very annoying especially with virtual machines running headless or whatever should stand up after failure. It could be fixed by modifying make_timeout () in /etc/grub.d/00_header: Original code: ****
make_timeout ()
{
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=${2}
fi
EOF
}
**** here is how to fix it: ****
make_timeout ()
{
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=${2}
else
  set timeout=${2}
fi
EOF
}
**** /I know it is a "secure programming" approach in terms of how this code looks like now... and yes, it is/ The original hint is taken from here: http://forum.xbmc.org/showthread.php?t=64857

Tuesday 11 October 2011

cssh - cluster ssh - do your cluster work easier

This is a very simple but powerful tool for interactive work with many machines at once
Just log in to them
cssh node1 node2 node3
and do the same operations on all of them.

It needs x-window (mmm, just wonder if there is a pure-text replacement?) and it is worth to configure ssh keys and perhaps ssh-agent to make your logins easier but still safe.
cssh comes with packages for ubuntu/debian, not sure if redhat/centos rpms catch up here. This project page is http://sourceforge.net/projects/clusterssh/
Many thanks for this tool!

Tuesday 27 September 2011

CPAN of the week

Carp::Always - this is what you need when perl -MCarp=verbose doesn't work the way you expect it. Spotted in some post by JRockway.

Mock::Quick - mock whatever you want, but also takeover/partially override existing modules and classes. The beauty of certainty for TDD or just when escaping from too many dependencies.

Sunday 5 June 2011

Git ignore file

I just find myself like searching for this again and again as I am not a very heavy git user now, but setting global core.excludesfile seems to be very similar to svn/cvs approach.

How to ignore certain types of files in git?

1) Put the excludes in your $GIT_DIR/info/exclude file (.git/info/exclude), if this is specific to one tree.

2) Run git config --global core.excludesfile ~/.gitignore and add patterns to your ~/.gitignore. This option applies if you want to ignore certain patterns across all trees.

/taken from StackOverflow by Emil

Wednesday 16 March 2011

Back ticks equivalent in cmd / windows

How to get a result of one command and use it in another command in Windows shell, like with backticks in Unix/Linux shell?

Here is a working example:
for /f "tokens=1* delims=" %%s in ('gnuwin32\date +"%%Y%%m%%d_%%H%%M"') do echo output_%%s.log

> output_20110215_1057.log


Works in Windows XP, Vista, Windows 7.

Remember:
1) The variable used in a for loop must be a one letter (at least in XP, Vista)
2) gnuwin32 is a set of GNU tools like grep/sed/awk/date which can be run natively in Windows without cost of additonal Cygwin-like layers

Thursday 10 February 2011

Mr Openoffice is happy with default A4 page

This is that kind of thing that you know you want to change, but there is always no time to do it. But it is just a minute, really!

http://selinap.com/2008/12/how-to-set-openoffice-default-page-format-to-a4/

Simply:
1) change page format
2) save it as a template (File -> template)
3) set this template as a default (File -> template -> organize -> commands -> set as a default tpl)

Do it, do it!