Seja bem vind@, se você é um debiano (um baiano que usa debian) faça parte de nossa comunidade!


Docker, infraestrutura simples e rápida

24 de Março de 2015, por Desconhecido - 0sem comentários ainda

O que é Docker

Uma plataforma aberta para desenvolvedores e administradores de sistemas, usada para construir, executar e distribuir máquinas.

Tudo isso é possível por conta da Docker Engine, que é um forma de empacotamento portável, simples e pequena de infraestrutura, que constitui facilmente várias máquinas executando no mesmo kernel, porem isoladas logicamente, usando as tecnologias LXC, AUFS e BTRFS.

Parece uma máquina virtual, não é? Porém é diferente!

Parece uma máquina virtual, não é? Porém é diferente!

Continuando sobre o conceito da plataforma Docker, eles disponibiliza também um serviço de Nuvem para armazenar e compartilhar imagens prontas, criadas tanto pela comunidade responsável pelo Docker, como por qualquer outra pessoa interessada, e o melhor, sem custo!

Cada pessoa registrada no serviço tem a possibilidade de criar um número ilimitado de máquinas públicas (todos podem ver e baixar) e apenas uma máquinas privada na conta gratuita.

Imagens e Containers

Uma máquina docker pode ser composta de várias camadas. E essas camadas se dividem em dois tipos; Imagens e Containers.

  • Imagens: Uma vez as máquinas em execução essas camadas são montadas como somente leitura. Elas podem ser compartilhadas por várias máquinas, ou seja, uma vez modificadas afetam todas as máquinas que usam essas imagens.
  • Containers: Essas camadas são montadas como leitura e escrita. É onde de fato estão as modificações da máquina em execução. Toda modificação realizada em uma imagem é feita a partir de um container.
Imagens e containers, perfeita sinergia.

Imagens e containers, perfeita sinergia.

Instalando o Docker

Se você usar Debian Jessie ou superior, não terá problemas. Basta executar o comando abaixo:
# aptitude install docker.io

Caso não utilize GNU/Linux, pode usar o boot2docker.

Conhecendo alguns comandos básicos

Infelizmente o docker ainda não tem uma interface web ou gráfica desktop suportada de forma estável pela sua comunidade oficial, sendo assim falaremos aqui apenas de comandos no shell.

Segue abaixo os comandos mais básicos do docker:

docker pull [nome da imagem]
: Baixar imagem
docker images : Listar imagens
docker run [nome da imagem] : Iniciar a imagem
docker ps  : Listar containers
docker exec [id do container] [comando] : Executa comandos no container

Mais comandos, podem encontrar nesse link.

Instalando uma máquina e executando em 2 minutos

Dois comandos, e o tempo gasto será apenas de download:

# docker pull nginx
# docker run -d -p 80:80 nginx

Pronto! Sua máquina estará funcionando.

O parâmetro -d, informa que a máquina será executada em background e o parâmetro -p informa que toda requisição da porta 80 no ip do hospedeiro, será redirecionado para a porta 80 da máquina que acabou de ser iniciada.

Sem persistência

Lembrando que as mudanças são apenas aplicadas no container, toda vez que desligar a máquina, na verdade você estará desmontando essa camada, e ao iniciar a máquina a partir de uma imagem será criado um novo container, ou seja, terás uma máquina “novinha em folha”.

Para desligar um container em execução, use o comando abaixo:

# docker stop <id do container>

É possível reiniciar um container que foi “desligado”. Usando o comando abaixo:

# docker start <id do container>

Obs: Lembrando que todos os dados de memória RAM serão perdidos, apenas os dados em disco serão armazenados e reutilizados na próxima execução.

Por hoje é só, aguardem novos artigos sobre Docker, pois falaremos sobre modificação de imagens, mapeamento de disco, criação de máquinas “do zero” e outras coisas interessantes sobre o docker.

Fonte : https://docs.docker.com/reference/



rrg: visualize the require hierarchy in Ruby projects

20 de Março de 2015, por Desconhecido - 0sem comentários ainda

Yesterday I was hacking on some Ruby code and getting a weird error which I thought was caused by mutually recursive require statements (i.e. A requires B, and B requires A). Later I realized that this is not an issue in Ruby, since the intepreter keeps track of what has already been required and will not enter a loop. But during the investigation I came up with something that turned out to be useful.

rrg will read the source code of a Ruby project and generate a graph based on the require statements in the code; nodes represent the source files and an arrow from A to B means that A contains a `require ‘B’` statement.

From the README:

Just run rrg at the root of your project. rrg will parse the code inside lib/, and generate a graph description in the Graphviz format. You can pipe the output to Graphviz directly, or store it in a file and process it to generate an image.

If you call rrgv instead, it will automatically process the graph with Graphviz, generate a PNG image, and open it.

Let’s see some examples. First the classical “analysing itself” example, the require graph for rrg itself:

Not very interesting, since all of the logic is currently in the main binary and not on library code. But 1) when I do the refactorings I want to, there will be more library code and 2) while writing this I implemented also parsing scripts in bin/.

Now chake which is a slightly larger project:

An even larger (but still not that big) project, gem2deb:

Note that these visualizations may not be accurate representations of the actual source code. In Ruby, nothing stops one from implementing class A::B in lib/x/y.rb, but most reasonable code will make sure that filenames and the classes namespaces actually match.

If you are working on a sane codebase, though, visualizing graphs like this helps understand the general structure of the code and perceive possible improvements. The gem2deb graph gave me some ideas already and I didn’t even paid much attention to it yet.



MuseScore 2.0 is great, try it!

14 de Março de 2015, por Desconhecido - 0sem comentários ainda

A bit of context: two years ago I joined an undergraduate program in electroacoustic music composition at the Université de Montréal. Fortunately the faculty has decided to use mostly free software in the classes. They recently moved from Max/MSP to Pure Data to teach algorithmic composition. OpenMusic has been used for computer assisted composition classes. On acoustics classes, Sonic Visualiser is the recommended tool. For everything related to audio processing and sound synthesis we mainly use Python pyo library and Cecilia, both developed by the professor himself. Other many free softwares are used for building digital musical instruments in the courses: Arduino, SuperCollider, OpenCV, openFrameworks etc.

So far I touched two proprietary softwares for my classes. First it was Reaper, a sequencer which has been recently adopted in replacement of Pro Tools in some grades. Reaper has a less unfair distribution model compared to Pro Tools and despite being a closed piece of software it somewhat looks like a community-oriented project, being developed by a small team of free software enthusiasts. Being an amazing, complete and still lightweight DAW I hope it goes free some day in the future (I've read about this possibility somewhere in a forum that I can't find now). Anyway, after some months playing with Reaper I went back to Ardour. Because it's free, not because it's better (Reapper still seems unbeatable here).

The other was Finale, an alternative to MuseScore for music notation. I used it for three compositions mainly due to its playback capabilities. As a middle-aged music student I don't have the internal ear enough developed to listen orchestral textures, articulations and other details provided by expensive VST stuff. However, I found editing with Finale a pain in the ass. It's so bugged that I thought I were using a sort of alpha version. Basic editing is much more logical and elegant with MuseScore. After all, these first experiences with Finale didn't convince me that such realistic playbacks are adding any value to my music. I suspect that moving back to soundfonts or even composing with no playback at all will probably force me to exercice more critical/analytical listening whenever I need to understand the effects of a specific instrumental gesture and instrument combinations. So, I'm back to MuseScore. Not only because it's free, but also because it's better (at least for my current needs).

MuseScore has allowed me to easily edit music scores in a free operating system, using a small and not so powerful laptop. Unable to donate money to this amazing project I've been happily giving some time to it, by testing new releases, reporting issues, translating to portuguese and making available unofficial Debian packages while the current maintainer prepares the official one, which seems to be coming very soon. If you're a Finale/Sibelius user and don't strictly need that universe of orchestral VSTs samples for your music work, please give MuseScore a try. Have a quick look at its online handbook and in a few minutes you will be able to experience the real pleasure of music scoring using a computer. You can try different soundfonts, including the so nice Sonatina Symphonic Orchestra.

Below is a screenshot of MuseScore 2.0, which will be released very soon. You can download the RC version for your system in the MuseScore website.

/images/mscore2.png

MuseScore 2.0



Freeing myself from flickr

11 de Março de 2015, por Desconhecido - 0sem comentários ainda

A flickr standard account gives you a free as in facebook service (I really wanted to reuse it!!!). I don't know about the pro account, but I don't believe it will give you much respect. Anyway, I realized that my photo albums in flickr are still online. And I'm currently unable to access my photos locally. I needed to download all them, then I decided to give flickrbackup a try. I started coding it a few years ago because at that time there was no free tools available for that. And then I abandoned it, too bad I feel. But for my surprise it worked without issues! And that's all I needed in my Debian box:

$ apt-get install flickrbackup

$ mkdir myflickr

$ flickrbackup -o myflickr/

(this will open a default browser for authentication and will automatically get the API key, then I just need an ENTER to start getting all my albums)

I'm not sure whether there're other free tools (as in freedom) for that, but before paying for a license or trusting an online service for downloading your sets please give flickrbackup a chance :)

I'll probably set a piwigo instance in a vps. But I fear php. So, suggestions on web galleries are very welcome.



C#2

9 de Março de 2015, por Desconhecido - 0sem comentários ainda

Vai passar... é só uma frase.