<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Albertux~# ./Blog &#187; bash</title>
	<atom:link href="http://albertux.ayalasoft.com/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://albertux.ayalasoft.com</link>
	<description>61 20 64 65 76 65 6c 6f 70 65 72 20 6c 69 66 65</description>
	<lastBuildDate>Thu, 01 Jul 2010 16:23:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<!-- podcast_generator="podPress/8.8" - maintenance_release="8.8.5.3" -->
	<copyright>2008 </copyright>
	<managingEditor>albertoi7@gmail.com (Albertux~# ./Blog)</managingEditor>
	<webMaster>albertoi7@gmail.com (Albertux~# ./Blog)</webMaster>
	<category>posts</category>
	<ttl>1440</ttl>
	<image>
		<url>http://ayalasoft.com/img/podcast02.jpg</url>
		<title>Albertux~# ./Blog &#187; bash</title>
		<link>http://albertux.ayalasoft.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>After three days without programming, life becomes meaningless.</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Technology">
		<itunes:category text="Software How-To" />
	</itunes:category>
	<itunes:category text="Technology">
		<itunes:category text="Podcasting" />
	</itunes:category>
	<itunes:author>Albertux~# ./Blog</itunes:author>
	<itunes:owner>
		<itunes:name>Albertux~# ./Blog</itunes:name>
		<itunes:email>albertoi7@gmail.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://ayalasoft.com/img/podcast01.jpg" />
		<item>
		<title>Switch DNS</title>
		<link>http://albertux.ayalasoft.com/2010/07/01/switch-dns/</link>
		<comments>http://albertux.ayalasoft.com/2010/07/01/switch-dns/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 16:23:33 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[dns]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=3366</guid>
		<description><![CDATA[#!/bin/bash # Author: Albertux (Alberto Isaac Ayala Esquivias) # Script: switch the nameservers (DNS) &#160; if &#91; ! $&#40; id -u &#41; -eq 0 &#93; then echo &#34;Run this script as root&#34; exit fi &#160; if &#91; $# -le 0 &#93; then echo &#34;Usage $0 [open&#124;google&#124;comodo&#124;old]&#34; fi &#160; if &#91; ! -f /etc/resolv.conf.bak &#93; then [...]<p><a href="http://albertux.ayalasoft.com/2010/07/01/switch-dns/">Switch DNS</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Author: Albertux (Alberto Isaac Ayala Esquivias)</span>
<span style="color: #666666; font-style: italic;"># Script: switch the nameservers (DNS)</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #c20cb9; font-weight: bold;">id</span> <span style="color: #660033;">-u</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Run this script as root&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-le</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage $0 [open|google|comodo|old]&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span>  <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf.bak <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf.bak
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> $<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">in</span>
	open<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;# OpenDNS<span style="color: #000099; font-weight: bold;">\n</span>nameserver 208.67.222.222<span style="color: #000099; font-weight: bold;">\n</span>nameserver 208.67.220.220&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
	<span style="color: #000000; font-weight: bold;">;;</span>
	google<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;# Google Public DNS<span style="color: #000099; font-weight: bold;">\n</span>nameserver 8.8.8.8<span style="color: #000099; font-weight: bold;">\n</span>nameserver 8.8.4.4&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
	<span style="color: #000000; font-weight: bold;">;;</span>
	comodo<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;# Comodo Secure DNS<span style="color: #000099; font-weight: bold;">\n</span>nameserver 156.154.70.22<span style="color: #000099; font-weight: bold;">\n</span>nameserver 156.154.71.22&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
	<span style="color: #000000; font-weight: bold;">;;</span>
	old<span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf.bak <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf 
	<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p><a href="http://albertux.ayalasoft.com/2010/07/01/switch-dns/">Switch DNS</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2010/07/01/switch-dns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BASH 4.0</title>
		<link>http://albertux.ayalasoft.com/2009/02/24/bash-4/</link>
		<comments>http://albertux.ayalasoft.com/2009/02/24/bash-4/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 09:03:04 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[develop]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=1808</guid>
		<description><![CDATA[BASH 4.0 http://www.mail-archive.com/cygwin@cygwin.com/msg94439.html ftp://ftp.cwru.edu/pub/bash/bash-4.0.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/bash-4.0.tar.gz #!/usr/bin/bash bash4=$&#40;`echo $SHELL` --version &#124; grep &#34;version 4&#34; &#124; awk '{if (NR!=2) {print $4}}'&#41; if &#91; -z $bash4 &#93; then wget ftp://ftp.gnu.org/pub/gnu/bash/bash-4.0.tar.gz else echo you have bash 4 fi BASH 4.0 is a post from: Albertux~# ./Blog<p><a href="http://albertux.ayalasoft.com/2009/02/24/bash-4/">BASH 4.0</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>BASH 4.0</strong></p>
<p><a href="http://www.mail-archive.com/cygwin@cygwin.com/msg94439.html" target="_blank">http://www.mail-archive.com/cygwin@cygwin.com/msg94439.html</a></p>
<p><a href="ftp://ftp.cwru.edu/pub/bash/bash-4.0.tar.gz" target="_blank">ftp://ftp.cwru.edu/pub/bash/bash-4.0.tar.gz</a><br />
<a href="ftp://ftp.gnu.org/pub/gnu/bash/bash-4.0.tar.gz" target="_blank">ftp://ftp.gnu.org/pub/gnu/bash/bash-4.0.tar.gz</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/bash</span>
<span style="color: #007800;">bash4</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$SHELL</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #660033;">--version</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;version 4&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{if (NR!=2) {print $4}}'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$bash4</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
	<span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.gnu.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>gnu<span style="color: #000000; font-weight: bold;">/</span>bash<span style="color: #000000; font-weight: bold;">/</span>bash-4.0.tar.gz
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> you have <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000;">4</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p><a href="http://albertux.ayalasoft.com/2009/02/24/bash-4/">BASH 4.0</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2009/02/24/bash-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Windows ? Don&#8217;t kill Yourself</title>
		<link>http://albertux.ayalasoft.com/2008/10/27/using-windows-dont-kill-yourself/</link>
		<comments>http://albertux.ayalasoft.com/2008/10/27/using-windows-dont-kill-yourself/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 19:01:41 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[develop]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=747</guid>
		<description><![CDATA[Using Windows ? Don&#8217;t Kill Yourself Supose you are Linux user and you have a Windows system. Alternatives: Cygwin, Mingw or Colinux You need some (or all) of this interpreters: Perl, PHP, Python and Ruby Modify the %PATH% Example you have a bin dir, on C:\ to include the executables on the %PATH% do this: [...]<p><a href="http://albertux.ayalasoft.com/2008/10/27/using-windows-dont-kill-yourself/">Using Windows ? Don&#8217;t kill Yourself</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Using Windows ? Don&#8217;t Kill Yourself</strong></p>
<p>Supose you are Linux user and you have a Windows system.</p>
<p>Alternatives: <a href="http://www.cygwin.com/" target="_blank">Cygwin</a>, <a href="http://www.mingw.org/" target="_blank">Mingw</a> or <a href="http://www.colinux.org/" target="_blank">Colinux</a></p>
<p>You need some (or all) of this interpreters:</p>
<p><a href="http://strawberryperl.com" target="_blank">Perl</a>, <a href="http://www.php.net" target="_blank">PHP</a>, <a href="http://www.python.org" target="_blank">Python</a> and <a href="http://www.ruby-lang.org/en" target="_blank">Ruby</a></p>
<p>Modify the %PATH%</p>
<p>Example you have a bin dir, on <span style="color:#00ff00">C:\</span> to include the executables on the <span style="color:#00ff00">%PATH%</span> do this:</p>

<div class="wp_syntax"><div class="code"><pre class="winbatch" style="font-family:monospace;">set PATH=<span style="color: #66cc66;">%</span>PATH<span style="color: #66cc66;">%</span><span style="color: #008000; font-style: italic;">;C:\bin\</span></pre></div></div>

<p>On Windows Vista, you can use your mouse:</p>
<p>computer &gt; properties &gt; Advances system settings &gt; (continue) &gt;  Advanced &gt; Enviroment Variables &gt; System Variables &gt; Path (edit)</p>
<p>Example run Kompozer on cmd.exe but no modify <span style="color:#00ff00;">%PATH%</span></p>

<div class="wp_syntax"><div class="code"><pre class="winbatch" style="font-family:monospace;"><span style="color: #FF1010; font-weight: bold;">: kompozer.bat save on %WINDIR%</span>
<span style="color: #66cc66;">@</span><span style="color: #ff0000;">&quot;C:\Program Files\Kompozer\kompozer.exe&quot;</span></pre></div></div>

<p>Doble click on your scripts to run:</p>

<div class="wp_syntax"><div class="code"><pre class="winbatch" style="font-family:monospace;"><span style="color: #FF1010; font-weight: bold;">: Perl Scripts</span>
 assoc .pl=Perl.File
 ftype Perl.File=C<span style="color: #FF1010; font-weight: bold;">:\strawberry\perl\bin\perl.exe &quot;%1&quot; %*</span>
 set PATHEXT=<span style="color: #66cc66;">%</span>PATHEXT<span style="color: #66cc66;">%</span><span style="color: #008000; font-style: italic;">;.pl</span>
<span style="color: #FF1010; font-weight: bold;">: Python Scripts</span>
 assoc .py=Python.File
 ftype Python.File=C<span style="color: #FF1010; font-weight: bold;">:\Python26\python.exe &quot;%1&quot; %*</span>
 set PATHEXT=<span style="color: #66cc66;">%</span>PATHEXT<span style="color: #66cc66;">%</span><span style="color: #008000; font-style: italic;">;.py</span></pre></div></div>

<p>Note:</p>
<p>On Windows Vista you need run <span style="color:#00ff00">cmd.exe</span> as Administrator don&#8217;t work as normal user</p>
<p>Apache, PHP and MySQL ?</p>
<p><a href="http://www.apachefriends.org/en/xampp.html" target="_blank">XAMPP</a> and <a href="http://www.server2go-web.de/" target="_blank">Server2Go</a></p>
<p>Notes:</p>
<p>XAMPP: simple, quick and easy install.</p>
<p>Server2Go: is great to make CD demo of a Web Application.</p>
<p>Using Perl or Python as CGI on Windows ?</p>
<p>Using Python 2.6</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!\python26\python.exe</span></pre></div></div>

<p>Using Strawberry Perl:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!\strawberry\perl\bin\perl.exe</span></pre></div></div>

<p>Now your script works on http://localhost/<span style="color:#00ff00">cgi-bin/</span>script.cgi</p>
<p><a href="http://albertux.ayalasoft.com/2008/10/27/using-windows-dont-kill-yourself/">Using Windows ? Don&#8217;t kill Yourself</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/10/27/using-windows-dont-kill-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resize Multiple Images</title>
		<link>http://albertux.ayalasoft.com/2008/10/20/resize-multiple-images/</link>
		<comments>http://albertux.ayalasoft.com/2008/10/20/resize-multiple-images/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 23:44:14 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[develop]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=755</guid>
		<description><![CDATA[Resize Multiple Images In my case i need to change the size of more than 1,000 pictures so using gimp and scale everyone is not a good solution. You need ImageMagick and Bash. Subfolders: script.sh: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/bin/bash # fotos [...]<p><a href="http://albertux.ayalasoft.com/2008/10/20/resize-multiple-images/">Resize Multiple Images</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Resize Multiple Images</strong></p>
<p>In my case i need to change the size of more than 1,000 pictures so using <a href="http://gimp.org/" target="_blank">gimp</a> and scale everyone is not a good solution.</p>
<p>You need <a href="http://www.imagemagick.org/" target="_blank">ImageMagick</a> and Bash.</p>
<p>Subfolders:<br />
<img src="http://ayalasoft.com/img/pictures_subfolders.jpg"></p>
<p>script.sh:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># fotos</span>
<span style="color: #007800;">IFS</span>=$<span style="color: #ff0000;">'\t\n'</span>; <span style="color: #666666; font-style: italic;"># Algunas fotos puede que tengan espacios</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">for</span> j <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #666666; font-style: italic;"># fotos/098-001/ fotos/098-002/ fotos/097-001/ etc...</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$j</span>&quot;</span> = <span style="color: #ff0000;">&quot;Thumbs.db&quot;</span>  <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>  <span style="color: #666666; font-style: italic;"># garbage file on win32</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nothing to do...&quot;</span>
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$j</span>&quot;</span> = <span style="color: #ff0000;">&quot;script.sh&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #666666; font-style: italic;"># this script file :D</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nothing to do...&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Working ...&quot;</span> <span style="color: #666666; font-style: italic;"># do the job</span>
        <span style="color: #666666; font-style: italic;">#convert &quot;$i/$j&quot; -resize 500 &quot;$i/new_$j&quot;</span>
        <span style="color: #666666; font-style: italic;">#mv &quot;$i/new_$j&quot; &quot;$i/$j&quot;</span>
        mogrify <span style="color: #660033;">-resize</span> <span style="color: #000000;">500</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>/<span style="color: #007800;">$j</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>Now all images are width: 500.</p>
<p>Now supose you have a lot of sub directories, you can use this script:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">IFS</span>=$<span style="color: #ff0000;">'\t\n'</span>
<span style="color: #007800;">EXTS</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> jpg gif png JPG GIF PNG <span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">for</span> EXT <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${EXTS[@]}</span>;
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.<span style="color: #007800;">$EXT</span>&quot;</span> <span style="color: #660033;">-type</span> f<span style="color: #000000; font-weight: bold;">`</span>;
	<span style="color: #000000; font-weight: bold;">do</span>
		<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dir</span></span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #007800;">$f</span><span style="color: #000000; font-weight: bold;">`</span>
		<span style="color: #007800;">ff</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$f</span><span style="color: #000000; font-weight: bold;">`</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Working ...&quot;</span>
		<span style="color: #666666; font-style: italic;">#convert &quot;$f&quot; -resize 500 &quot;$dir/new_$ff&quot;</span>
		<span style="color: #666666; font-style: italic;">#mv &quot;$dir/new_$ff&quot; &quot;$f&quot;</span>
                mogrify  <span style="color: #660033;">-resize</span> <span style="color: #000000;">500</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$f</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>[thanks for the advice CyX]</p>
<p><a href="http://albertux.ayalasoft.com/2008/10/20/resize-multiple-images/">Resize Multiple Images</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/10/20/resize-multiple-images/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>rubygems-update issue on Ubuntu</title>
		<link>http://albertux.ayalasoft.com/2008/09/30/rubygems-update-issue-on-ubuntu/</link>
		<comments>http://albertux.ayalasoft.com/2008/09/30/rubygems-update-issue-on-ubuntu/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 22:09:33 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[develop]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=654</guid>
		<description><![CDATA[rubygems-update issue on Ubuntu If you have this problem on your computer: sudo gem update --system Updating RubyGems Bulk updating Gem source index for: http://gems.rubyforge.org/ Updating rubygems-update ERROR: While executing gem ... &#40;Gem::GemNotFoundException&#41; could not find rubygems-update locally or in a repository The problem is RubyGems you need to install manually or use this script [...]<p><a href="http://albertux.ayalasoft.com/2008/09/30/rubygems-update-issue-on-ubuntu/">rubygems-update issue on Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>rubygems-update issue on Ubuntu</strong></p>
<p>If you have this problem on your computer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span>
Updating RubyGems
Bulk updating Gem <span style="color: #7a0874; font-weight: bold;">source</span> index <span style="color: #000000; font-weight: bold;">for</span>: http:<span style="color: #000000; font-weight: bold;">//</span>gems.rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>
Updating rubygems-update
ERROR:  While executing gem ... <span style="color: #7a0874; font-weight: bold;">&#40;</span>Gem::GemNotFoundException<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    could not <span style="color: #c20cb9; font-weight: bold;">find</span> rubygems-update locally or <span style="color: #000000; font-weight: bold;">in</span> a repository</pre></div></div>

<p>The problem is <a href="http://www.rubygems.org/" target="_blank">RubyGems</a> you need to install manually or use this script solution:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#(download the latest on http://rubyforge.org/frs/?group_id=126)</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">43984</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-update-1.3.0.gem
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rubygems-update-1.3.0.gem
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update_rubygems
<span style="color: #666666; font-style: italic;"># now this work:</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done.&quot;</span></pre></div></div>

<p>I found this solution on this web: <a href=" http://rubyglasses.blogspot.com/2008/08/updating-gem-to-120-on-ubuntu.html" target="_blank"></p>
<p>http://rubyglasses.blogspot.com/2008/08/updating-gem-to-120-on-ubuntu.html</a></p>
<p><a href="http://albertux.ayalasoft.com/2008/09/30/rubygems-update-issue-on-ubuntu/">rubygems-update issue on Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/09/30/rubygems-update-issue-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Toshiba Fan On Ubuntu</title>
		<link>http://albertux.ayalasoft.com/2008/09/28/toshiba-fan-on-ubuntu/</link>
		<comments>http://albertux.ayalasoft.com/2008/09/28/toshiba-fan-on-ubuntu/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 21:09:15 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[toshiba]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=611</guid>
		<description><![CDATA[Toshiba Fan On Ubuntu You need to install toshset include on toshutils (do you have lm-sensors ?) sudo apt-get install toshutils This script make the fan run high, low or normal #!/bin/bash case $1 in h&#41; sudo toshset -fan 4 # high ;; n&#41; sudo toshset -fan 5 # normal ;; l&#41; sudo toshset -fan [...]<p><a href="http://albertux.ayalasoft.com/2008/09/28/toshiba-fan-on-ubuntu/">Toshiba Fan On Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Toshiba Fan On Ubuntu</strong></p>
<p><img src="http://ayalasoft.com/img/cputemp.jpg" alt="" /></p>
<p>You need to install toshset include on toshutils (do you have lm-sensors ?)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> toshutils</pre></div></div>

<p>This script make the fan run high, low or normal</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">case</span> $<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">in</span>
	h<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> toshset <span style="color: #660033;">-fan</span> <span style="color: #000000;">4</span> <span style="color: #666666; font-style: italic;"># high</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	n<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> toshset <span style="color: #660033;">-fan</span> <span style="color: #000000;">5</span> <span style="color: #666666; font-style: italic;"># normal</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
	l<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> toshset <span style="color: #660033;">-fan</span> <span style="color: #000000;">6</span> <span style="color: #666666; font-style: italic;"># low</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span></pre></div></div>

<p>If you live in warn places, &#8220;~$ script.sh h&#8221; could be help you a little don&#8217;t use all time this option, to normalize your fan run &#8220;~$script.sh n&#8221;.</p>
<p>There are other tools on toshset &#8220;man toshset&#8221;.</p>
<p><a href="http://albertux.ayalasoft.com/2008/09/28/toshiba-fan-on-ubuntu/">Toshiba Fan On Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/09/28/toshiba-fan-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MySQL Workbench (Linux)</title>
		<link>http://albertux.ayalasoft.com/2008/09/24/mysql-workbench-linux/</link>
		<comments>http://albertux.ayalasoft.com/2008/09/24/mysql-workbench-linux/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 18:16:48 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=604</guid>
		<description><![CDATA[MySQL Workbench (Linux) What is MySQL Workbench ? MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench will be available as a native GUI tool on Window, Linux and OS X. For Ubuntu (8.04) users i made this install [...]<p><a href="http://albertux.ayalasoft.com/2008/09/24/mysql-workbench-linux/">MySQL Workbench (Linux)</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>MySQL Workbench (Linux)</strong></p>
<p>What is MySQL Workbench ?</p>
<blockquote><p>MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench will be available as a native GUI tool on Window, Linux and OS X.</p></blockquote>
<p><a rel="shadowbox" href="http://ayalasoft.com/img/mysql-workbench.jpg"><img src="http://ayalasoft.com/img/mysql-workbench-thumb.jpg" alt="" /></a></p>
<p>For Ubuntu (8.04) users i made this install script (run as root):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># This script tested only on Ubuntu 8.04 (32 bits)</span>
<span style="color: #666666; font-style: italic;"># You need some extra libs to run MySQL Workbench</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> liblua5.1-<span style="color: #000000;">0</span> libzip1 libmysqlclient15off
<span style="color: #666666; font-style: italic;"># Download MySQL Workbench Ubuntu 8.04 Bin Files</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.mysql.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>gui-tools<span style="color: #000000; font-weight: bold;">/</span>mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz
<span style="color: #666666; font-style: italic;"># Download the md5 checksum file</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.mysql.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>gui-tools<span style="color: #000000; font-weight: bold;">/</span>mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5
<span style="color: #666666; font-style: italic;"># Check md5sum</span>
<span style="color: #007800;">real</span>=<span style="color: #000000; font-weight: bold;">`</span>md5sum mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">confirm</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$real</span>&quot;</span> = <span style="color: #ff0000;">&quot;<span style="color: #007800;">$confirm</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #666666; font-style: italic;"># Extract (/usr/local/bin/ /usr/local/lib/mysql-workbench/ /usr/local/share/mysql-workbench/)</span>
	<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz <span style="color: #660033;">-C</span> <span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Wrong MD5, run the script again.&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Note: MySQL Workbench is alpha on Linux</p>
<p>More information about <a href="http://dev.mysql.com/workbench/" target="_blank">MySQL Workbench</a></p>
<p><a href="http://albertux.ayalasoft.com/2008/09/24/mysql-workbench-linux/">MySQL Workbench (Linux)</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/09/24/mysql-workbench-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>About NetCat</title>
		<link>http://albertux.ayalasoft.com/2008/09/11/about-netcat/</link>
		<comments>http://albertux.ayalasoft.com/2008/09/11/about-netcat/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 21:34:15 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=523</guid>
		<description><![CDATA[About NetCat NetCat a great network tool checkout this examples: Create a Small WebServer: while true; do nc -l -p 80 -q 1 &#60; error.html; done Transfer Files: nc -lp $PORT &#62; $FILE cat $FILE &#124; nc -w 1 $HOST $PORT Chat Server: nc -lp $PORT nc $HOST $PORT Spoof Headers: echo -e &#34;GET / [...]<p><a href="http://albertux.ayalasoft.com/2008/09/11/about-netcat/">About NetCat</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>About NetCat</strong></p>
<p>NetCat a great network tool checkout this examples:</p>
<p>Create a Small WebServer:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span>; <span style="color: #000000; font-weight: bold;">do</span> nc <span style="color: #660033;">-l</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-q</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&lt;</span> error.html; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Transfer Files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-lp</span> <span style="color: #007800;">$PORT</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$FILE</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$FILE</span> <span style="color: #000000; font-weight: bold;">|</span> nc <span style="color: #660033;">-w</span> <span style="color: #000000;">1</span> <span style="color: #007800;">$HOST</span> <span style="color: #007800;">$PORT</span></pre></div></div>

<p>Chat Server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-lp</span> <span style="color: #007800;">$PORT</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #007800;">$HOST</span> <span style="color: #007800;">$PORT</span></pre></div></div>

<p>Spoof Headers:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;GET / HTTP/1.1<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> nc <span style="color: #660033;">-v</span> <span style="color: #007800;">$HOST</span> <span style="color: #000000;">80</span></pre></div></div>

<p>Backup System:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-lp</span> <span style="color: #007800;">$HOST</span> <span style="color: #000000; font-weight: bold;">&gt;</span> backup.tar.gz</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> cf - <span style="color: #007800;">$DIR</span>  <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span>  <span style="color: #000000; font-weight: bold;">|</span> nc <span style="color: #660033;">-w</span> <span style="color: #000000;">1</span> <span style="color: #007800;">$HOST</span> <span style="color: #007800;">$PORT</span></pre></div></div>

<p>Remote Shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-lp</span> <span style="color: #007800;">$PORT</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$CMD</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #007800;">$HOST</span> <span style="color: #007800;">$PORT</span></pre></div></div>

<p>Clonning Hard Drive:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-l</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$PORT</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;"><span style="color: #000000; font-weight: bold;">if</span></span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda <span style="color: #000000; font-weight: bold;">|</span> nc <span style="color: #007800;">$HOST</span> <span style="color: #007800;">$PORT</span></pre></div></div>

<p>Port Scanner:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">nc <span style="color: #660033;">-vz</span> <span style="color: #007800;">$HOST</span> <span style="color: #000000;">21</span>-<span style="color: #000000;">80</span></pre></div></div>

<p>Web: <a href="http://netcat.sourceforge.net/" target="_blank">http://netcat.sourceforge.net/</a></p>
<p><a href="http://albertux.ayalasoft.com/2008/09/11/about-netcat/">About NetCat</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/09/11/about-netcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSC JavaScript Collection</title>
		<link>http://albertux.ayalasoft.com/2008/08/24/jsc-javascript-collection/</link>
		<comments>http://albertux.ayalasoft.com/2008/08/24/jsc-javascript-collection/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 07:23:56 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=332</guid>
		<description><![CDATA[JSC JavaScript Collection We need jsmin and gzip, compile the jsmin.c: gcc -o jsmin jsmin.c Script to generate a collection of the javascript files: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/bin/bash &#160; echo &#34;JavaScript Collection&#34; &#160; EXPECTED_ARGS=1 [...]<p><a href="http://albertux.ayalasoft.com/2008/08/24/jsc-javascript-collection/">JSC JavaScript Collection</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>JSC JavaScript Collection</strong></p>
<p>We need <a href="http://www.crockford.com/javascript/jsmin.html" target="_blank">jsmin</a> and <a href="http://www.gzip.org/" target="_blank">gzip</a>, compile the <a href="http://www.crockford.com/javascript/jsmin.c">jsmin.c</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-o</span> jsmin jsmin.c</pre></div></div>

<p>Script to generate a collection of the javascript files:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;JavaScript Collection&quot;</span>
&nbsp;
  <span style="color: #007800;">EXPECTED_ARGS</span>=<span style="color: #000000;">1</span>
  <span style="color: #007800;">E_BADARGS</span>=<span style="color: #000000;">65</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #007800;">$EXPECTED_ARGS</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #780078;">`basename $0`</span> {path of the javascripts}&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$E_BADARGS</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Join the javascript scripts in one file</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/*</span>.js <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.tmp
&nbsp;
<span style="color: #666666; font-style: italic;"># use JSMIN to minifier the script</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.tmp <span style="color: #000000; font-weight: bold;">|</span> jsmin <span style="color: #000000; font-weight: bold;">&gt;</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.min.tmp
&nbsp;
<span style="color: #666666; font-style: italic;"># awk remove the first blank line, gzip compress the script</span>
<span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'FNR&gt;1{print}'</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.min.tmp <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #000000; font-weight: bold;">&gt;</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>collection_scripts.js.gz
&nbsp;
<span style="color: #666666; font-style: italic;"># remove temporal files</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.tmp $<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>.__fullscripts.min.tmp</pre></td></tr></table></div>

<p>Howto: <span style="color:#FFFF00">jsc</span> <span style="color:#00FFFF">public_html/web/js/</span></p>
<p>Now create one php script to replace all javascripts:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;collection_scripts.php&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Content of collection_scripts.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/javascript; charset: UTF-8?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Encoding: gzip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;collection_scripts.js.gz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://albertux.ayalasoft.com/2008/08/24/jsc-javascript-collection/">JSC JavaScript Collection</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/08/24/jsc-javascript-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari On Ubuntu</title>
		<link>http://albertux.ayalasoft.com/2008/08/22/safari-on-ubuntu/</link>
		<comments>http://albertux.ayalasoft.com/2008/08/22/safari-on-ubuntu/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 17:13:17 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wine]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=294</guid>
		<description><![CDATA[Safari On Ubuntu Script to install Safari on Ubuntu 8.04: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #!/bin/bash echo &#34;Safary on Ubuntu Lazzy Script Installer (Ubuntu 8.04)&#34; sudo apt-get install msttcorefonts sudo apt-get install wine echo &#34;Copy some MS-Fonts to local drive_c&#34; cp /usr/share/fonts/truetype/msttcorefonts/Arial*.ttf ~/.wine/drive_c/windows/fonts/ cp /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman*.ttf [...]<p><a href="http://albertux.ayalasoft.com/2008/08/22/safari-on-ubuntu/">Safari On Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Safari On Ubuntu</strong></p>
<p>Script to install <span style="color: #00ff00;">Safari</span> on Ubuntu 8.04:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Safary on Ubuntu Lazzy Script Installer (Ubuntu 8.04)&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> msttcorefonts
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> wine
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Copy some MS-Fonts to local drive_c&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>fonts<span style="color: #000000; font-weight: bold;">/</span>truetype<span style="color: #000000; font-weight: bold;">/</span>msttcorefonts<span style="color: #000000; font-weight: bold;">/</span>Arial<span style="color: #000000; font-weight: bold;">*</span>.ttf ~<span style="color: #000000; font-weight: bold;">/</span>.wine<span style="color: #000000; font-weight: bold;">/</span>drive_c<span style="color: #000000; font-weight: bold;">/</span>windows<span style="color: #000000; font-weight: bold;">/</span>fonts<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>fonts<span style="color: #000000; font-weight: bold;">/</span>truetype<span style="color: #000000; font-weight: bold;">/</span>msttcorefonts<span style="color: #000000; font-weight: bold;">/</span>Times_New_Roman<span style="color: #000000; font-weight: bold;">*</span>.ttf ~<span style="color: #000000; font-weight: bold;">/</span>.wine<span style="color: #000000; font-weight: bold;">/</span>drive_c<span style="color: #000000; font-weight: bold;">/</span>windows<span style="color: #000000; font-weight: bold;">/</span>fonts<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Download SafariSetup and Flash Plugin&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ubuntu-debs.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>SafariSetup.exe
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ubuntu-debs.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>install_flash_player.exe
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Install Safari&quot;</span>
wine SafariSetup.exe
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Install Flash Plugin&quot;</span>
wine install_flash_player.exe
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;finish.&quot;</span></pre></td></tr></table></div>

<div style="text-align:center"><a rel="shadowbox" href="http://ayalasoft.com/img/safari_on_ubuntu.png"><img src="http://ayalasoft.com/img/safari_on_ubuntu_small.png" border="0" alt="" /></a></div>
<p>Reference:<br />
<a href="http://www.ubuntu-unleashed.com/2008/03/howto-install-safari-on-ubuntu-with.html" target="_blank">http://www.ubuntu-unleashed.com/2008/03/howto-install-safari-on-ubuntu-with.html</a></p>
<p><a href="http://albertux.ayalasoft.com/2008/08/22/safari-on-ubuntu/">Safari On Ubuntu</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/08/22/safari-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GeoIP Database MySQL</title>
		<link>http://albertux.ayalasoft.com/2008/08/08/geoip-database-mysql/</link>
		<comments>http://albertux.ayalasoft.com/2008/08/08/geoip-database-mysql/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 09:10:43 +0000</pubDate>
		<dc:creator>albertux</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[unix/linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[geoip]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://albertux.ayalasoft.com/?p=181</guid>
		<description><![CDATA[GeoIP Database MySQL Sometimes we need to know the country of the users on the website, you can know using only the ip address. I write this simple Bash script to install on a new database (or existing database) the table &#8220;geoip&#8221;, now you can use PHP, Python, Perl, Ruby or whatever you want. 1 [...]<p><a href="http://albertux.ayalasoft.com/2008/08/08/geoip-database-mysql/">GeoIP Database MySQL</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>GeoIP Database MySQL</strong></p>
<p>Sometimes we need to know the country of the users on the website, you can know using only the ip address.<br />
I write this simple <a href="http://www.gnu.org/software/bash/" target="_blank">Bash</a> script to install on a new database (or existing database) the table &#8220;geoip&#8221;, now you can use <span style="color: #00ff00;">PHP</span>, <span style="color: #00ff00;">Python</span>, <span style="color: #00ff00;">Perl</span>, <span style="color: #00ff00;">Ruby</span> or whatever you want.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Script: geoip.sh</span>
<span style="color: #666666; font-style: italic;"># Author: Alberto Isaac Ayala Esquivias</span>
<span style="color: #666666; font-style: italic;"># E-mail: &lt;albertoi7@gmail.com&gt;</span>
<span style="color: #666666; font-style: italic;"># Web: http://albertux.ayalasoft.com</span>
<span style="color: #c20cb9; font-weight: bold;">clear</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=====================================-&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; GeoIp MySQL Database Easy Installer. &quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;======================================&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Script Created By http://AyalaSoft.com&quot;</span>;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">stty</span> <span style="color: #660033;">-echo</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;MySQL root password: &quot;</span> mysql_pass; <span style="color: #7a0874; font-weight: bold;">echo</span>
<span style="color: #c20cb9; font-weight: bold;">stty</span> <span style="color: #7a0874; font-weight: bold;">echo</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Do you want to create database of MySQL (y/n): &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> op
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$op</span>&quot;</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Create new database, name: &quot;</span>
	<span style="color: #c20cb9; font-weight: bold;">read</span> database
	mysqladmin <span style="color: #660033;">-u</span> root <span style="color: #660033;">--password</span>=<span style="color: #007800;">$mysql_pass</span> create <span style="color: #007800;">$database</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Which database do you want to use to insert 'geoip' table: &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> database
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Download  [ GeoIPCountryCSV.zip ]&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>UnZip [ GeoIPCountryCSV.zip ]&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">unzip</span> GeoIPCountryCSV.zip
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Insert geoip table to database <span style="color: #007800;">$database</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">awk</span> -F, <span style="color: #ff0000;">' { print $3&quot;,&quot;$4&quot;,&quot;$5&quot;,&quot;$6 }'</span> GeoIPCountryWhois.csv <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #000000; font-weight: bold;">//</span>g <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>geoip.txt
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">777</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>geoip.txt
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;
USE <span style="color: #007800;">$database</span>;
&nbsp;
DROP TABLE IF EXISTS geoip;
&nbsp;
CREATE TABLE geoip (
	ip_begin int unsigned,
	ip_end int unsigned,
	country varchar(2),
	country_name varchar(30)
);
&nbsp;
LOAD DATA LOCAL INFILE '/tmp/geoip.txt'
INTO TABLE <span style="color: #007800;">$database</span>.geoip
FIELDS TERMINATED BY ','
LINES TERMINATED BY '<span style="color: #000099; font-weight: bold;">\n</span>'
(ip_begin, ip_end, country, country_name);
&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> geoip.sql
mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">--password</span>=<span style="color: #007800;">$mysql_pass</span> <span style="color: #007800;">$database</span> <span style="color: #000000; font-weight: bold;">&lt;</span> geoip.sql
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>geoip.txt
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Finish.&quot;</span></pre></td></tr></table></div>

<p><a href="http://albertux.ayalasoft.com/2008/08/08/geoip-database-mysql/">GeoIP Database MySQL</a> is a post from: <a href="http://albertux.ayalasoft.com">Albertux~# ./Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://albertux.ayalasoft.com/2008/08/08/geoip-database-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
