Archive for the ‘*nix’ Category

glibc-2.7 makecontext issues on x86_64

Monday, December 28th, 2009

Looks like passing 64 bit values(e.g pointers) into makecontext is not working properly on x86_64. We are using makecontext for coroutines implementation and its proper working is vital for us.

I’ve been struggling with this bug for a couple of days and have finally found a solution for it. Actually the solution is trivial it was the actual process of spotting this bug which took so much time. By the way, this issue was resolved in the latest releases of glibc, so nothing to worry about if you are using gcc older than 4.2.4.
(more…)

Redirect build errors into vim

Thursday, December 10th, 2009

Here is a small bash function which wraps the executed command in the shell and redirects all build errors right into vim. In vim you can jump between errors using standard :cn,:cp commands(as well as view them all using :cope).

function vimize () 
{ 
  local file=/tmp/vimize.errors
  if [ "$1" != "" ] ; then
    rm $file 2> /dev/null
    $1 "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" 2>&1 | tee $file
  fi
  grep ': error:' $file 
  if [ "$?" == "0" ] ; then
    vim -q $file -c :copen
  fi
}

Just put it into your ~/.bashrc, reload the shell and ejoy it. It can be used as follows:

$ vimize ./run_some_build_script

Making windows(smb) shares mounting convenient with autofs

Tuesday, November 27th, 2007

Working with windows shares in Linux is kinda painful, especially if you are a console geek and don’t like all that magic Gnome and KDE network applets do for you during connection to some smb server(what even worse these connections are only “visible” in GUI not in console).

I just needed something as low-level as possible and at the same time simple and convenient. Using smbmount with friends(smbumount, smbclient) is a possible way to go but I’m too lazy to type it each time and remember all its options ;)

After some googling around it turned out that autofs could be the right tool. I only had to configure it properly… It took several hours of heavy googling, reading scarce blog posts, hacking with autofs and tearing lots of my hear before I finally got more or less acceptable solution for this problem.

(more…)

Script for adding new MySQL database and user easily

Saturday, October 20th, 2007

At my company we have lots of MySQL databases(usually one for each virtual host) and each database has its unique user. Adding a new database and a user with proper permissions can be quite tedious, that’s why I hacked up the following script which saves some of my precious time ;)

(more…)

A couple of nginx utility scripts

Saturday, October 20th, 2007

In my previous nginx related post I promised to show a couple of utility scripts we use to simplify managing of multiple virtual hosts both under Apache and nginx. Well, here they come ;)

(more…)

Syncman - projects remote deployment for my grandma

Sunday, October 7th, 2007

Syncman Logo

If you’re running a company mainly occupied with development of lots of web sites ranging from tiny promo sites to large portals you most probably should face deployment headaches some day.

How do folks usually deploy their remote applications? Some use manual deployment via FTP, others prefer using rsync or unison, some brave souls deploy simply by updating the project’s Subversion working copy on the remote server, Rails fans usually stick with Capistrano, some smart fellows are said to be using complicated cfengine, etc.

At my company we were not happy with any mentioned above methods of remote project deployment due to either lack of functionality or unnecessary complexity. We simply needed a tool which could use non-technical personnel: managers, web-designers, etc. That’s why we hacked our own simple utility - meet Syncman ;)

(more…)

Speeding up Apache static content serving with nginx

Friday, September 28th, 2007

If you have not already tried using nginx, one of the fastest http and reverse proxy servers in the world, you definitely should try doing so!

Nginx can save lots of CPU cycles simply by “standing” before the main heavy http server(e.g. Apache) and taking the role of serving effectively all static content. Actually it can be your main and the only http server but that’s a story for another day since it will require quite a lot hassle if you already have many virtual hosts served by another server(Apache again).

(more…)