Today, while trying to setup Jenkins for a project, one of the job includes a ant build for a java project. This build has been working pretty well for some time, but i wanted to automate in inside Jenkins. I encountered a problem when i tried to create the new jenkins job, because the ant build references some environment variables.
Monday, February 20, 2012
Tuesday, February 7, 2012
How to display the top x biggest folder under unix linux
As the titles mentions here's a little one liner when you want to find out who's are the top disk space users under a certain directory:
du -sk * | sort -nr | cut -f2 | head -5 | xargs du -sh
The command above show the top 5 offenders in a nice readable way (i.e not in kb which i find hard to read):
$ du -sk * | sort -nr | cut -f2 | head -5 | xargs du -sh 3.2G Offender1 1.8G Offender2 1.3G Offender3 1.1G Offender4 603M Offender5
Monday, February 6, 2012
How to grep for NULL char
Was trying to extract some FIX messages from log files, and more precisely filter out a number of messages like heartbeat. My initial thought was to do something like that:
That works fine, except it's a little bit wasteful. What this command above does is, replace all the null character (that are used as delimiter in FIX messages) by "|". So that got me thinking how I could filter out those without having to replace anything. My first idea was:
That didn't work because grep was interpreting \001 as a back reference. Several variants later (among which the use of sed) and some constructive goggling made me understand that the the problem wasn't coming from grep but from bash and here's the proof.
If you type the following (under linux):
The trick is to tell bash do some quoting (escaping), and you do that by prefixing the string with $:
So putting it all together the original command above becomes:
cat fixlog.log | grep '\[8=FIX.' | tr '\1' '|' | grep -v '\|35=0'
That works fine, except it's a little bit wasteful. What this command above does is, replace all the null character (that are used as delimiter in FIX messages) by "|". So that got me thinking how I could filter out those without having to replace anything. My first idea was:
cat C20120203.log | grep '\[8=FIX.' | grep -v '\00135=D'
That didn't work because grep was interpreting \001 as a back reference. Several variants later (among which the use of sed) and some constructive goggling made me understand that the the problem wasn't coming from grep but from bash and here's the proof.
If you type the following (under linux):
$ echo '\001' | hexdump -C 00000000 5c 30 30 31 0a |\001.| 00000005
The trick is to tell bash do some quoting (escaping), and you do that by prefixing the string with $:
$ echo $'\001' | hexdump -C 00000000 01 0a |..| 00000002
So putting it all together the original command above becomes:
cat fixlog.log | grep '\[8=FIX.' | grep -v $'\00135=0'The mechanism allow you to grep for any arbitrary ASCII character.
Friday, November 25, 2011
How to use easy_install through a proxy
You first need to make sure that the shell variable http_proxy is defined:
$ env | grep http_proxy http_proxy=http://your-proxy.com:yourport
On this done you can run simply run easy_install as follow:
sudo -E easy_install your_packageThe "-E" parameter for sudo preserves your environment (namely variables) which is not the default behavior.
Tuesday, November 22, 2011
How to fix windows 7 install stuck at step "Finalizing your settings"
While trying to install windows 7 on my shiny Macbook, after the whole ordeal i had went through (See here and here for more details), I finally had the install going and was at the last step.
By last step I mean my computer had already rebooted several times, went through "Setting up your computer for first time use", and was at the step "Finalizing your settings".
Unfortunatly this last step took forever. By Forever i mean, after leaving my computer at it the whole night, was still stuck there in the morning.
Subscribe to:
Posts (Atom)