<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Gergap's Weblog</title>
	<atom:link href="http://gergap.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gergap.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 17 Nov 2011 08:56:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gergap.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Gergap's Weblog</title>
		<link>http://gergap.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gergap.wordpress.com/osd.xml" title="Gergap&#039;s Weblog" />
	<atom:link rel='hub' href='http://gergap.wordpress.com/?pushpress=hub'/>
		<item>
		<title>GIT CRLF hook</title>
		<link>http://gergap.wordpress.com/2010/05/12/git-crlf-hook/</link>
		<comments>http://gergap.wordpress.com/2010/05/12/git-crlf-hook/#comments</comments>
		<pubDate>Wed, 12 May 2010 02:03:03 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=223</guid>
		<description><![CDATA[When Windows and Linux developers are working together on one central repository, like it is done in most companies, it makes sense to use the AUTOCRLF feature of GIT. git config --global core.autocrlf true This way GIT automatically converts CRLF to LF when committing and converts it back when the files are checked out. In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=223&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When Windows and Linux developers are working together on one central repository, like it is done in most companies, it makes sense to use the AUTOCRLF feature of GIT.</p>
<pre>git config --global core.autocrlf true</pre>
<p>This way GIT automatically converts CRLF to LF when committing and converts it back when the files are checked out. In the repository there is always everything stored with LF.</p>
<p>But what happens if a Windows developer forgets to activate this feature? He is committing CRLFs into the repo. This annoys Linux developers but even worse if another Windows developer has the feature turned on, he will get a huge list of modified files, that he didn&#8217;t modify. Why that?</p>
<p>GIT converts LF-&gt;CRLF when checking out on Windows. If the file contains already CRLF, GIT is clever enough to detect that and does not expand it to CRCRLF what would be wrong. It keeps the CRLF, which means the file was implicitly changed locally during the checkout, because when committing it again, the wrong CRLF will be corrected to LF. That&#8217;s why GIT must mark these files as modified.</p>
<p>It&#8217;s good to understand the problem, but we need a solution that prevents that wrong line endings are pushed to the central repo. The solution is to install an update hook on the central server.</p>
<p><span style="color:#767676;background-color:#000000;"> 1 </span><span style="color:#949494;background-color:#262626;">#!/bin/sh</span><br /><span style="color:#767676;background-color:#000000;"> 2 </span><span style="color:#949494;background-color:#262626;">#</span><br /><span style="color:#767676;background-color:#000000;"> 3 </span><span style="color:#949494;background-color:#262626;"># Author: Gerhard Gappmeier, ascolab GmbH</span><br /><span style="color:#767676;background-color:#000000;"> 4 </span><span style="color:#949494;background-color:#262626;"># This script is based on the update.sample in git/contrib/hooks.</span><br /><span style="color:#767676;background-color:#000000;"> 5 </span><span style="color:#949494;background-color:#262626;"># You are free to use this script for whatever you want.</span><br /><span style="color:#767676;background-color:#000000;"> 6 </span><span style="color:#949494;background-color:#262626;">#</span><br /><span style="color:#767676;background-color:#000000;"> 7 </span><span style="color:#949494;background-color:#262626;"># To enable this hook, rename this file to &quot;update&quot;.</span><br /><span style="color:#767676;background-color:#000000;"> 8 </span><span style="color:#949494;background-color:#262626;">#</span><br /><span style="color:#767676;background-color:#000000;"> 9 </span><br /><span style="color:#767676;background-color:#000000;">10 </span><span style="color:#949494;background-color:#262626;"># &#8212; Command line</span><br /><span style="color:#767676;background-color:#000000;">11 </span><span style="color:#d7d787;">refname</span>=<span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$1</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">12 </span><span style="color:#d7d787;">oldrev</span>=<span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$2</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">13 </span><span style="color:#d7d787;">newrev</span>=<span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$3</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">14 </span><span style="color:#949494;background-color:#262626;">#echo &quot;COMMANDLINE: $*&quot;</span><br /><span style="color:#767676;background-color:#000000;">15 </span><br /><span style="color:#767676;background-color:#000000;">16 </span><span style="color:#949494;background-color:#262626;"># &#8212; Safety check</span><br /><span style="color:#767676;background-color:#000000;">17 </span><span style="color:#87d7ff;">if [</span> <span style="color:#87d7ff;">-z</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$GIT_DIR</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">];</span> <span style="color:#87d7ff;">then</span><br /><span style="color:#767676;background-color:#000000;">18 </span>    <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">Don&#8217;t run this script from the command line.</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&gt;&amp;</span><span style="color:#d7875f;">2</span><br /><span style="color:#767676;background-color:#000000;">19 </span>    <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;"> (if you want, you could supply GIT_DIR then run</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&gt;&amp;</span><span style="color:#d7875f;">2</span><br /><span style="color:#767676;background-color:#000000;">20 </span>    <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">  </span><span style="color:#d7875f;">$0</span><span style="color:#87d75f;"> &lt;ref&gt; &lt;oldrev&gt; &lt;newrev&gt;)</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&gt;&amp;</span><span style="color:#d7875f;">2</span><br /><span style="color:#767676;background-color:#000000;">21 </span>    <span style="color:#87d7ff;">exit</span> <span style="color:#d7875f;">1</span><br /><span style="color:#767676;background-color:#000000;">22 </span><span style="color:#87d7ff;">fi</span><br /><span style="color:#767676;background-color:#000000;">23 </span><br /><span style="color:#767676;background-color:#000000;">24 </span><span style="color:#87d7ff;">if [</span> <span style="color:#87d7ff;">-z</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$refname</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">-o</span> <span style="color:#87d7ff;">-z</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$oldrev</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">-o</span> <span style="color:#87d7ff;">-z</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$newrev</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">];</span> <span style="color:#87d7ff;">then</span><br /><span style="color:#767676;background-color:#000000;">25 </span>    <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">Usage: </span><span style="color:#d7875f;">$0</span><span style="color:#87d75f;"> &lt;ref&gt; &lt;oldrev&gt; &lt;newrev&gt;</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&gt;&amp;</span><span style="color:#d7875f;">2</span><br /><span style="color:#767676;background-color:#000000;">26 </span>    <span style="color:#87d7ff;">exit</span> <span style="color:#d7875f;">1</span><br /><span style="color:#767676;background-color:#000000;">27 </span><span style="color:#87d7ff;">fi</span><br /><span style="color:#767676;background-color:#000000;">28 </span><br /><span style="color:#767676;background-color:#000000;">29 </span><span style="color:#949494;background-color:#262626;"># binary extension to ignore in CRLF check</span><br /><span style="color:#767676;background-color:#000000;">30 </span><span style="color:#d7d787;">BINARAY_EXT</span>=<span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">pdb dll exe exp png gif jpg doc vsd vss</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">31 </span><br /><span style="color:#767676;background-color:#000000;">32 </span><span style="color:#949494;background-color:#262626;"># returns 1 if the given filename is a binary file</span><br /><span style="color:#767676;background-color:#000000;">33 </span><span style="color:#d7d787;">function</span> <span style="color:#d7d787;">IsBinary() </span><br /><span style="color:#767676;background-color:#000000;">34 </span><span style="color:#d7d787;">{</span><br /><span style="color:#767676;background-color:#000000;">35 </span>    <span style="color:#d7d787;">result</span>=<span style="color:#d7875f;">0</span><br /><span style="color:#767676;background-color:#000000;">36 </span>    <span style="color:#87d7ff;">for </span>ext <span style="color:#87d7ff;">in</span> <span style="color:#d7875f;">$BINARAY_EXT</span><span style="color:#87d7ff;">;</span> <span style="color:#87d7ff;">do</span><br /><span style="color:#767676;background-color:#000000;">37 </span>        <span style="color:#87d7ff;">if [</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$ext</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">=</span> <span style="color:#87d75f;">&quot;${1##*.}&quot;</span> <span style="color:#87d7ff;">];</span> <span style="color:#87d7ff;">then</span><br /><span style="color:#767676;background-color:#000000;">38 </span>            <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$1</span><span style="color:#87d75f;"> is binary</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">39 </span>            <span style="color:#d7d787;">result</span>=<span style="color:#d7875f;">1</span><br /><span style="color:#767676;background-color:#000000;">40 </span>            <span style="color:#87d7ff;">break</span><br /><span style="color:#767676;background-color:#000000;">41 </span>        <span style="color:#87d7ff;">fi</span><br /><span style="color:#767676;background-color:#000000;">42 </span>    <span style="color:#87d7ff;">done</span><br /><span style="color:#767676;background-color:#000000;">43 </span><br /><span style="color:#767676;background-color:#000000;">44 </span>    <span style="color:#87d7ff;">return</span> <span style="color:#d7875f;">$result</span><br /><span style="color:#767676;background-color:#000000;">45 </span><span style="color:#d7d787;">}</span><br /><span style="color:#767676;background-color:#000000;">46 </span><br /><span style="color:#767676;background-color:#000000;">47 </span><span style="color:#949494;background-color:#262626;"># make temp paths</span><br /><span style="color:#767676;background-color:#000000;">48 </span><span style="color:#d7d787;">tmp</span>=<span style="color:#d7875f;">$(</span><span style="color:#d7ffd7;">mktemp /tmp/git.update.XXXXXX</span><span style="color:#d7875f;">)</span><br /><span style="color:#767676;background-color:#000000;">49 </span><span style="color:#d7d787;">log</span>=<span style="color:#d7875f;">$(</span><span style="color:#d7ffd7;">mktemp /tmp/git.update.log.XXXXXX</span><span style="color:#d7875f;">)</span>    <br /><span style="color:#767676;background-color:#000000;">50 </span><span style="color:#d7d787;">tree</span>=<span style="color:#d7875f;">$(</span><span style="color:#d7ffd7;">mktemp /tmp/git.</span><span style="color:#87d7ff;">diff</span><span style="color:#d7ffd7;">-tree.XXXXXX</span><span style="color:#d7875f;">)</span><br /><span style="color:#767676;background-color:#000000;">51 </span><span style="color:#d7d787;">ret</span>=<span style="color:#d7875f;">0</span><br /><span style="color:#767676;background-color:#000000;">52 </span><br /><span style="color:#767676;background-color:#000000;">53 </span>git <span style="color:#87d7ff;">diff</span>-tree <span style="color:#d7ffd7;">-r</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$oldrev</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$newrev</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&gt;</span> <span style="color:#d7875f;">$tree</span><br /><span style="color:#767676;background-color:#000000;">54 </span><span style="color:#949494;background-color:#262626;">#echo</span><br /><span style="color:#767676;background-color:#000000;">55 </span><span style="color:#949494;background-color:#262626;">#echo diff-tree:</span><br /><span style="color:#767676;background-color:#000000;">56 </span><span style="color:#949494;background-color:#262626;">#cat $tree</span><br /><span style="color:#767676;background-color:#000000;">57 </span><br /><span style="color:#767676;background-color:#000000;">58 </span><span style="color:#949494;background-color:#262626;"># read $tree using the file descriptors</span><br /><span style="color:#767676;background-color:#000000;">59 </span><span style="color:#87d7ff;">exec</span> <span style="color:#d7875f;">3</span><span style="color:#87d7ff;">&lt;&amp;0</span><br /><span style="color:#767676;background-color:#000000;">60 </span><span style="color:#87d7ff;">exec</span> <span style="color:#d7875f;">0</span><span style="color:#87d7ff;">&lt;</span><span style="color:#d7875f;">$tree</span><br /><span style="color:#767676;background-color:#000000;">61 </span><span style="color:#87d7ff;">while read old_mode new_mode old_sha1 new_sha1 status name</span><br /><span style="color:#767676;background-color:#000000;">62 </span><span style="color:#87d7ff;">do</span><br /><span style="color:#767676;background-color:#000000;">63 </span>    <span style="color:#949494;background-color:#262626;"># debug output</span><br /><span style="color:#767676;background-color:#000000;">64 </span>    <span style="color:#949494;background-color:#262626;">#echo &quot;old_mode=$old_mode new_mode=$new_mode old_sha1=$old_sha1 new_sha1=$new_sha1 status=$status name=$name&quot;</span><br /><span style="color:#767676;background-color:#000000;">65 </span>    <span style="color:#949494;background-color:#262626;"># skip lines showing parent commit</span><br /><span style="color:#767676;background-color:#000000;">66 </span>    <span style="color:#87d7ff;">test</span> <span style="color:#87d7ff;">-z</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$new_sha1</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">&amp;&amp;</span> <span style="color:#87d7ff;">continue</span><br /><span style="color:#767676;background-color:#000000;">67 </span>    <span style="color:#949494;background-color:#262626;"># skip deletions</span><br /><span style="color:#767676;background-color:#000000;">68 </span>    <span style="color:#87d7ff;">[</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$new_sha1</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">=</span> <span style="color:#87d75f;">&quot;0000000000000000000000000000000000000000&quot;</span> <span style="color:#87d7ff;">]</span> <span style="color:#87d7ff;">&amp;&amp;</span> <span style="color:#87d7ff;">continue</span><br /><span style="color:#767676;background-color:#000000;">69 </span>   <br /><span style="color:#767676;background-color:#000000;">70 </span>    <span style="color:#949494;background-color:#262626;"># don&#8217;t do a CRLF check for binary files</span><br /><span style="color:#767676;background-color:#000000;">71 </span>    IsBinary <span style="color:#d7875f;">$name</span><br /><span style="color:#767676;background-color:#000000;">72 </span>    <span style="color:#87d7ff;">if [</span> <span style="color:#d7875f;">$?</span> <span style="color:#87d7ff;">-eq</span> <span style="color:#d7875f;">1</span> <span style="color:#87d7ff;">];</span> <span style="color:#87d7ff;">then</span><br /><span style="color:#767676;background-color:#000000;">73 </span>        <span style="color:#949494;background-color:#262626;">#echo &quot;skipping file&quot;</span><br /><span style="color:#767676;background-color:#000000;">74 </span>        <span style="color:#87d7ff;">continue</span> <span style="color:#949494;background-color:#262626;"># skip binary files</span><br /><span style="color:#767676;background-color:#000000;">75 </span>    <span style="color:#87d7ff;">fi</span><br /><span style="color:#767676;background-color:#000000;">76 </span>    <br /><span style="color:#767676;background-color:#000000;">77 </span>    <span style="color:#949494;background-color:#262626;"># check for CRLF</span><br /><span style="color:#767676;background-color:#000000;">78 </span>    git <span style="color:#87d7ff;">cat</span>-<span style="color:#87d7ff;">file</span> blob <span style="color:#d7875f;">$new_sha1</span> <span style="color:#87d7ff;">&gt;</span> <span style="color:#d7875f;">$tmp</span><br /><span style="color:#767676;background-color:#000000;">79 </span>    <span style="color:#d7d787;">RESULT</span>=<span style="color:#d7ffd7;">`</span><span style="color:#87d7ff;">grep</span><span style="color:#d7ffd7;"> -Pl </span><span style="color:#87d7ff;">&#8216;</span><span style="color:#87d75f;">\r\n</span><span style="color:#87d7ff;">&#8216;</span><span style="color:#d7ffd7;"> </span><span style="color:#d7875f;">$tmp</span><span style="color:#d7ffd7;">`</span><br /><span style="color:#767676;background-color:#000000;">80 </span>    <span style="color:#87d7ff;">echo</span> <span style="color:#d7875f;">$RESULT</span><br /><span style="color:#767676;background-color:#000000;">81 </span>    <span style="color:#87d7ff;">if [</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#d7875f;">$RESULT</span><span style="color:#87d7ff;">&quot;</span> <span style="color:#87d7ff;">=</span> <span style="color:#87d75f;">&quot;$tmp&quot;</span> <span style="color:#87d7ff;">];</span> <span style="color:#87d7ff;">then</span><br /><span style="color:#767676;background-color:#000000;">82 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">###################################################################################################</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">83 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;"># &#8216;</span><span style="color:#d7875f;">$name</span><span style="color:#87d75f;">&#8216; contains CRLF! Dear Windows developer, please activate the GIT core.autocrlf feature,</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">84 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;"># or change the line endings to LF before trying to push.</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">85 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;"># Use &#8216;git config core.autocrlf true&#8217; to activate CRLF conversion.</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">86 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;"># OR use &#8216;git reset HEAD~1&#8242; to undo your last commit and fix the line endings.</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">87 </span>        <span style="color:#87d7ff;">echo</span> <span style="color:#87d7ff;">&quot;</span><span style="color:#87d75f;">###################################################################################################</span><span style="color:#87d7ff;">&quot;</span><br /><span style="color:#767676;background-color:#000000;">88 </span>        <span style="color:#d7d787;">ret</span>=<span style="color:#d7875f;">1</span><br /><span style="color:#767676;background-color:#000000;">89 </span>    <span style="color:#87d7ff;">fi</span><br /><span style="color:#767676;background-color:#000000;">90 </span><span style="color:#87d7ff;">done</span><br /><span style="color:#767676;background-color:#000000;">91 </span><span style="color:#87d7ff;">exec</span> <span style="color:#d7875f;">0</span><span style="color:#87d7ff;">&lt;&amp;3</span><br /><span style="color:#767676;background-color:#000000;">92 </span><span style="color:#949494;background-color:#262626;"># &#8212; Finished</span><br /><span style="color:#767676;background-color:#000000;">93 </span><span style="color:#87d7ff;">exit</span> <span style="color:#d7875f;">$ret</span><br /><span style="color:#767676;background-color:#000000;">94 </span></p>
<p>Download it <a href="http://pastebin.com/EAZ2rGDs">here</a>.<br />A pre-commit hook for the local developer repositories would also make sense to get the error already when committing locally, not only when pushing the local changes to the server. But you cannot enforce this technically. This must be done voluntarily by the developer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=223&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2010/05/12/git-crlf-hook/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>Blogilo</title>
		<link>http://gergap.wordpress.com/2010/01/08/blogilo/</link>
		<comments>http://gergap.wordpress.com/2010/01/08/blogilo/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 20:35:33 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/2010/01/08/blogilo/</guid>
		<description><![CDATA[Just found this new blog application &#34;blogilo&#34; which is part of the upcoming KDE4.4. So if you can read this the app works. KDE4 rocks !!! To use blogilo install KDE4.4, or take a look at http://blogilo.gnufolks.org.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=220&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just found this new blog application &quot;blogilo&quot; which is part of the upcoming KDE4.4. So if you can read this the app works.</p>
<p>KDE4 rocks !!!</p>
<p>To use blogilo install KDE4.4, or take a look at <a href="http://blogilo.gnufolks.org">http://blogilo.gnufolks.org</a>.</p></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/220/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/220/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/220/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=220&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2010/01/08/blogilo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>Ardunio Nano V3 Development on Linux</title>
		<link>http://gergap.wordpress.com/2009/08/10/ardunio-nano-v3-development-on-linux/</link>
		<comments>http://gergap.wordpress.com/2009/08/10/ardunio-nano-v3-development-on-linux/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 10:13:29 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[avr]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=202</guid>
		<description><![CDATA[After I&#8217;ve read an interesting article about Arduino I obtained an &#8220;Arduino Nano V3&#8243;, which contains already the newer AVR Atmega 328p micro processor. The starter kit contained also a 3 axis accelerometer (ADXL330), a bread board, an LED, push button and so on. See www.arduino.cc for more information about the arduino itself. The nice [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=202&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After I&#8217;ve read an interesting article about Arduino I obtained an &#8220;Arduino Nano V3&#8243;, which contains already the newer AVR Atmega 328p micro processor. The starter kit contained also a 3 axis accelerometer (ADXL330), a bread board, an LED, push button and so on.<br />
See <a href="http://www.arduino.cc">www.arduino.cc</a> for more information about the arduino itself.</p>
<p><img src="http://gergap.files.wordpress.com/2009/08/starterkit.jpg?w=360&#038;h=270" alt="Arduino Starterkit" title="Arduino Starterkit" width="360" height="270" class="alignnone size-full wp-image-212" /></p>
<p>The nice thing about arduino nano is, that it comes preinstalled with a USB plug so you don&#8217;t need to solder yourself. It&#8217;s just plug &amp; play and you even do not need a power supply, because it&#8217;s powered over USB (external power supply is possible too of course).</p>
<p>The seconds nice thing is that there exists an Open Source IDE, also called &#8220;Arduino&#8221; which make programming really easy also for people without great programming skills. This IDE is written in JAVA, and so is portable. Underneeth the GUI it uses the AVR-GCC toolchain to compile C and C++ programs and links against AVR-LIBC. The most complicated thing to get it running is building a working AVR toolchain, but Gentoo has this nice &#8220;crossdev&#8221; script which can generate complete toolchains including compiler, binutils and libc <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><b>Installing the AVR Toolchain</b><br />
To use crossdev you should add the line &#8216;PORTDIR_OVERLAY=&#8221;/usr/local/portage&#8221;&#8216; to your /etc/make.conf.
</p>
<pre>
crossdev -t avr -s4 --without-headers
ln -s /usr/i686-pc-linux-gnu/avr/lib/ldscripts /usr/avr/lib/ldscripts
emerge avrdude -av
</pre>
<p>There first line executes the crossdev script which compiles the toolchain for AVR (See crossdev &#8211;help for more info). The second line creates a missing symlink due to bug <a href="http://bugs.gentoo.org/show_bug.cgi?id=147155">147155</a>. The third line installs avrdude, a tool for downloading programs to the AVR.</br><br />
If everything succeeded you should be able to run &#8220;avr-gcc &#8211;version&#8221; to check the compiler version. You need at least avr-libc 1.6.4 to support the Atmega328p, but this is already default meanwhile.</p>
<p>Now you can simply download the Arduino IDE from www.arduino.cc, unpack and run it. For compiling you should select the &#8220;Arduino Deumilanove w/ Atmega 328&#8243; via the menu Tools-&gt;Board. The normal nano configuration has no Atmega 328.</p>
<p><img src="http://gergap.files.wordpress.com/2009/08/arduino.png?w=497&#038;h=367" alt="arduino" title="arduino" width="497" height="367" class="alignnone size-full wp-image-209" /></p>
<p>For downloading you have to select your serial port via Tools-&gt;Serial Port. This is /dev/ttyUSB0 normally if it is the first connected tty device.<br />
If you don&#8217;t see this device when you plug in the cable you probably don&#8217;t have the FTDI driver compiled into your kernel.</p>
<p><b>Configuring the FTDI USB serial converter</b><br />
You can activate it via the kernel menu config (you must know how to compile a kernel for that):<br />
Device Drivers -&gt; USB support -&gt; USB Serial Converter support -&gt; USB FTDI Single Port Serial.</p>
<p>To get access to the tty device file you should be in the <b>uucp</b> group. Use &#8220;sudo usermod -a -G uucp &#8221; to add the group to a user. This change requires you to relogin to get active.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=202&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/08/10/ardunio-nano-v3-development-on-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>

		<media:content url="http://gergap.files.wordpress.com/2009/08/starterkit.jpg" medium="image">
			<media:title type="html">Arduino Starterkit</media:title>
		</media:content>

		<media:content url="http://gergap.files.wordpress.com/2009/08/arduino.png" medium="image">
			<media:title type="html">arduino</media:title>
		</media:content>
	</item>
		<item>
		<title>MSDN website standard compliance</title>
		<link>http://gergap.wordpress.com/2009/07/21/msdn-website-standard-compliance/</link>
		<comments>http://gergap.wordpress.com/2009/07/21/msdn-website-standard-compliance/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 07:51:01 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=192</guid>
		<description><![CDATA[Before you ask, I did this just for fun I&#8217;m annoyed that the MS sites doesn&#8217;t work probably in any browser but IE &#8211; what a wonder. I need the site sometimes because I&#8217;m developing portable software that also has to run on Windows, and so I often need to figure out the problems where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=192&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Before you ask, I did this just for fun <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I&#8217;m annoyed that the MS sites doesn&#8217;t work probably in any browser but IE &#8211; what a wonder. I need the site sometimes because I&#8217;m developing portable software that also has to run on Windows, and so I often need to figure out the problems where the MS C++ compiler is not standard conform, but that&#8217;s another story&#8230;</p>
<p>So I asked myself how bad is that standard compliance really. So I put one of the API reference sites into W3C&#8217;s markup validator&#8230;</p>
<p>The result: <span style="color:red;">98 Errors, 10 warning(s)</span></p>
<p>You can recheck that your self using that link <a href="http://validator.w3.org/check?uri=http://msdn.microsoft.com/en-us/library/ms740506(VS.85).aspx&amp;charset=(detect+automatically)&amp;doctype=Inline&amp;group=0&amp;user-agent=W3C_Validator/1.654">Recheck MSDN Site</a></p>
<p>We cannot loose anything so lets check also the CSS <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>The result: <span style="color:red;">Sorry! We found the following errors (18)</span></p>
<p><a href="http://jigsaw.w3.org/css-validator/validator?uri=http://msdn.microsoft.com/en-us/library/ms740506(VS.85).aspx&amp;profile=css21&amp;usermedium=all&amp;warning=1&amp;lang=en">Recheck MSDN Site</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=192&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/07/21/msdn-website-standard-compliance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>About the new kernel exploit</title>
		<link>http://gergap.wordpress.com/2009/07/19/about-the-new-kernel-exploit/</link>
		<comments>http://gergap.wordpress.com/2009/07/19/about-the-new-kernel-exploit/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 09:39:55 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=187</guid>
		<description><![CDATA[I&#8217;m reading so much at the moment about the new &#8220;exploitable&#8221; kernel bug that I need to clarify some things, because many things with this exploit are represented in strange ways that give a wrong impression. 1.) First of all it&#8217;s stupid NULL pointer deference. A stupid bug that no programmer should made, but shit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=187&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m reading so much at the moment about the new &#8220;exploitable&#8221; kernel bug that I need to clarify some things, because many things with this exploit are represented in strange ways that give a wrong impression.</p>
<p>1.) First of all it&#8217;s stupid NULL pointer deference. A stupid bug that no programmer should made, but shit happens. The good thing with such a bug is that it is easy to fix, and the bug was already patched on 6th of July by Mariusz Kozlowsk which shows how fast the community reacts on security issues.</p>
<pre>
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a1b0697..bcbb25e 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -482,12 +482,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
 {
        struct tun_file *tfile = file-&gt;private_data;
        struct tun_struct *tun = __tun_get(tfile);
-       struct sock *sk = tun-&gt;sk;
+       struct sock *sk;
        unsigned int mask = 0;

        if (!tun)
                return POLLERR;

+       sk = tun-&gt;sk;
+
        DBG(KERN_INFO "%s: tun_chr_poll\n", tun-&gt;dev-&gt;name);

        poll_wait(file, &amp;tfile-&gt;read_wait, wait);
</pre>
<p>2.) The bug gets exploitable due to some compiler optimizations. But this is really not a problem in GCC. The optimization makes sense, and the problem occurs only because of this bug. Without this bug the optimization is no problem.</p>
<p>3.) How dangerous is the exploit? Despite some articles I&#8217;ve read it&#8217;s really hard to use this exploit in reality.</p>
<ul>
<li>First of all you need to have the affected kernel installed with the tun code activated. I don&#8217;t even have this tun code activated in my kernel.</li>
<li>To execute the exploit the attacker must have physical access to your computer.</li>
<li>And the attacker must be able to execute a SETUID program that loads some special kernel modules. For installing such an application and making it SETUID the attacker would already need to have root privileges.</i>
</ul>
<p>So this is exploit is interesting from an academic point of view, because two different things, a programming bug and a compiler optimization lead to an exploit, but it&#8217;s really minimum danger for all us normal Linux users.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=187&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/07/19/about-the-new-kernel-exploit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>GIT bash cheats</title>
		<link>http://gergap.wordpress.com/2009/07/09/git-bash-cheats/</link>
		<comments>http://gergap.wordpress.com/2009/07/09/git-bash-cheats/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 10:12:21 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cheat]]></category>
		<category><![CDATA[completion]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=182</guid>
		<description><![CDATA[When you install GIT you should also install the GIT bash completion with it. (On gentoo you just need to set the bash-completion USE flag when emerging git). This makes your life much easier. This can complete git commands like &#8220;git stat[TAB]&#8221; to &#8220;git status&#8221;. Additionally it offers the GIT bash function __get_ps1 for your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=182&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you install GIT you should also install the GIT bash completion with it. (On gentoo you just need to set the bash-completion USE flag when emerging git). This makes your life much easier. This can complete git commands like &#8220;git stat[TAB]&#8221; to &#8220;git status&#8221;. Additionally it offers the GIT bash function <b>__get_ps1</b> for your command prompt. You can integrate this into your &#8220;PS1&#8243; variable to show the current branch of your working dir on your command prompt. That&#8217;s just great, isn&#8217;t it?</p>
<p>Add this to your ~/.bashrc to activate the GIT bash completion and the new command prompt.</p>
<pre>
# load git bash completion
source /usr/share/bash-completion/git
# Cool trick to show current git branch in the command prompt in gentoo colors.
export PS1='\[33[01;32m\]\u@\h\[33[01;34m\] \w$(__git_ps1 " (%s)") \$\[33[00m\] '
</pre>
<p>(Attention: wordpress removes for any reason my &#8220;\ 0 3 3&#8243; sequences (without space) so that you see only 33 instead.)<br />
If you enter your working dir the prompt will look like this.</p>
<pre>
<span style="color:green;">gergap@lt_gergap</span> <span style="color:blue;">~/work/helisim (master) $</span>
</pre>
<p>If you are wondering what this &#8220;\[33...]&#8221; is for, this is just to set some nice colors for the prompt. You can remove that if you don&#8217;t like colors.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=182&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/07/09/git-bash-cheats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>VIM Wild Menu</title>
		<link>http://gergap.wordpress.com/2009/07/08/vim-wild-menu/</link>
		<comments>http://gergap.wordpress.com/2009/07/08/vim-wild-menu/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 07:37:09 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=178</guid>
		<description><![CDATA[I was annoyed by the file name completion in VIM. It completes the whole name of the first match, even if there are a lot of possibilities. That feels like DOS so that you need a lot of &#60;TAB&#62; to iterate to the correct file. I wanted to behave like the BASH to complete only [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=178&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was annoyed by the file name completion in VIM. It completes the whole name of the first match, even if there are a lot of possibilities. That feels like DOS <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  so that you need a lot of &lt;TAB&gt; to iterate to the correct file.<br />
I wanted to behave like the BASH to complete only the longest possible part and then show a list of possible completions with the second &lt;TAB&gt;.<br />
No problem in high configurable VIM. I found out that this two settings do what I want.</p>
<pre>
set wildmode=longest:full
set wildmenu
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=178&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/07/08/vim-wild-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>Does KDE4 on Windows make sense?</title>
		<link>http://gergap.wordpress.com/2009/06/09/does-kde4-on-windows-make-sense/</link>
		<comments>http://gergap.wordpress.com/2009/06/09/does-kde4-on-windows-make-sense/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 07:37:13 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=164</guid>
		<description><![CDATA[I expect there are a lot of opinions to this questions KDE4 is another Open Source success story. So why should a user be interested in running it on Windows, when there are free alternatives like Linux? Is it not one step back? By only supporting free operating systems this would be another reason for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=164&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I expect there are a lot of opinions to this questions <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>KDE4 is another Open Source success story. So why should a user be interested in running it on Windows, when there are free alternatives like Linux? Is it not one step back? By only supporting free operating systems this would be another reason for Windows users, that want to use the cool KDE apps, to switch to free operating systems like Linux. So why are Open Source developers are interested in porting it to Windows?</p>
<p>A lot of good questions, and in my opinion all this is right, but there is this KDE4 Windows port and a lot of Windows users are already using it. So for some users it seems to make sense. One reason I heard is that some users are forced to use Windows in their job and so have no choice. With KDE4 for Windows they can now use all the cool KDE applications, that they are used to use from home and are not limited to the applications that come with Windows.</p>
<p>Open Source means to be free. Let you do with it whatever you want, as long as the result of your work offers the same freedom to all other users. Thus it allows you also to port it to Windows and let it run on a proprietary operating systems.<br />
So at the end &#8211; if people like it or not &#8211; KDE4 on Windows is also part of the freedom of Open Source.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=164&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/06/09/does-kde4-on-windows-make-sense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>Howto recursively replace file headers of source files</title>
		<link>http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/</link>
		<comments>http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 10:02:28 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=160</guid>
		<description><![CDATA[bash awk c c++ java replace file header automatic<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=160&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This scripts can replace file headers from C/C++/JAVA header and source files. Often it&#8217;s necessary to replace the license conditions in multiple source files, update the copyright year, or simply make all file headers consistent. This can be a lot of work, so that&#8217;s why I wrote this scripts.</p>
<p>How it works: The BASH script replace_header.sh is a simple wrapper that executes the AWK script remove_header.awk which implements a basic state machine for recognizing C/C++/JAVA comments (&#8220;// &#8230;&#8221;, &#8220;/* &#8230; */). All comments at the beginning of the file &#8211; also when spanning over multiple lines &#8211; are ignored until the first line without comment is reached. The AWK file ignores all this comments, and prints the rest of the file unchanged. The BASH script creates a new file with your new header.template and adds your code without the old file header to the newly created file. Afterwards it copies the new file over the old one.</p>
<p>Example:</p>
<pre>find . -name "*.h" -exec ~/rh/replace_header.sh {} \;</pre>
<p>Download <a href="http://www.gerhard-gappmeier.de/download/replace_header_scripts.tar.gz">replace_header_scripts.tar.gz</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=160&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/06/03/howto-recursively-replace-file-headers-of-source-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
		<item>
		<title>VIM paste text with line numbers</title>
		<link>http://gergap.wordpress.com/2009/06/01/vim-paste-text-with-line-numbers/</link>
		<comments>http://gergap.wordpress.com/2009/06/01/vim-paste-text-with-line-numbers/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 10:40:51 +0000</pubDate>
		<dc:creator>gergap</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gergap.wordpress.com/?p=151</guid>
		<description><![CDATA[I normally put my code from VIM with syntax highlighting and line numbers turned on on my blog. This is good for readability, but bad if you want to copy paste it from the web site. With vim it&#8217;s easy to remove these line numbers from pasted code. Here is how to do that. Select [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=151&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I normally put my code from VIM with syntax highlighting and line numbers turned on on my blog. This is good for readability, but bad if you want to copy paste it from the web site. With vim it&#8217;s easy to remove these line numbers from pasted code. Here is how to do that.</p>
<ol>
<li>Select the code on the website (no CTRL-C/CTRL-V is needed on Linux, selecting does already the copy)</li>
<li>Start up vim and enter <b>:set paste</b>. This turns off the automatic indentation, to allow keeping the indentation of the pasted code.</li>
<li>Press &#8220;i&#8221; to change to insert mode.</li>
<li>Now click with the middle mouse button into the vim window. That inserts the code.</li>
<li>Press &#8220;Esc&#8221; to change back to command mode.</li>
<li>Now use vim&#8217;s regexp based substitute and replace command to remove the line numbers: <b>:%s/^[0-9 ]\d \=//</b></li>
<li>Explanation: [0-9 ] (Note the space in brackets). This stands for a digit or a beginning space, because the numbers are right aligned. \d stands for a second digit. More than 100 lines I never have in my scripts <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gergap.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gergap.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gergap.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gergap.wordpress.com&amp;blog=4268206&amp;post=151&amp;subd=gergap&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gergap.wordpress.com/2009/06/01/vim-paste-text-with-line-numbers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/11cf53e82ce93261d900f1c652b43e53?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gergap</media:title>
		</media:content>
	</item>
	</channel>
</rss>
