bDay*39 Log

Bomb Royal

O dia começou com 3.

Estava 30 graus em Porto Alegre, eu e a Karin sentamos na mesa 30, a nossa ficha na banca 40 do Mercado Público era 0303330. O meu pedido de café da manhã de aniversário? O Bomb Royale, que vem com 3 bolas de sorvete. Pedi isso pela história no cardápio. Durante a segunda guerra, reuniam numa taça tudo o que havia na banca: sorvete, nata batida e salada de frutas. A banca era não era 30, pois nem tudo é perfeito. Outras tantas coisas também não eram 3, mas a idade sim. Entrei no último ano da minha década de 30, e 39 somado dá 3 (o que é verdadeiro para qualquer múltiplo de 3, ou seja, nada especial).

No almoço, nenhuma alusão ao número 3 ocorreu.

Nasci às 12 horas do ano de 1974, quando não houve horário de verão. Então às 13h, durante o almoço com a minha esposa, filha e sogra, tirei uns momentos para silenciar, mesmo que na mesa do restaurante. Naquele momento, há exatos 39 anos atrás, nasci. Pesquisando o que senti vejo que foi gratidão. Por aquele momento e por tantos outros que ainda virão. Pelas pessoas com quem convivi, ou com quem deveria ter convivido mais. Pelos aprendizados, que fazem com que a vida tenha sentido. Pelos sentidos que se dá ao aprendizado.

Muito em breve estaremos iniciando uma nova fase, com somente uma coisa a aprender: tudo. Uma cultura diferente, novos idiomas, novas formas de entender o mundo.

O dia 18 se encerrou de uma forma interessante. No sofá de casa, no sítio, vendo um bom filme de Bollywood, o último do Yash Chopra, na Netflix de UK. Exatamente à meia-noite olhei para o relógio e anunciei o fim do dia. Só faltou a Natya no sofá, mas havia ligado para ela 25 minutos atrás, então tudo certo. O tipo de coisa que lá será igual.

Talvez o próximo ciclo se inicie com 4, começando com 4 graus (hoje fez 6º em Amsterdam).

GIT to deploy website (in 5 steps)

I believe I just found the easiest and cleanest way to publish a website using GIT. This is based on 2 articles; well, actually one, and a translation. But the translation is a bit different, so…

The article is from Abhijit Menon-Sen, and its translation is from Thiago Belem. Both differs from the approach I used couple years ago, which involved having a full repo at server (let’s call it repo1), outside the public docs, and another bare repo at /www (repo2) pulling from repo1 in the post-commit hook.

The advantage of this method is that you could do little changes on the /www using vi and push them to repo1, which will then execute the hook that would republish the file to /www.

But I admit, it’s a bit confusing. So both articles above have a much cleaner solution that I just tested and it’s working just fine. I won’t be able to vi the server, but that’s a compromise I’m comfortable with.

Step 1: Create the local GIT repository

 Step 2: Prepare the server

ssh into the server, and make sure you have your RSA key on ~/.ssh/authorizedkeys . If you don’t… well, add it! :)

 Step 3: Create a post-receive hook on server

 Step 4: Configure local machine

Step 5: Test the thing!

After the first commit, the normal flow would be:

  • [change local file]
  • git commit -am "Always comment your commits"
  • git push www

Bonus Track: Different Environments
If you have a real website, with billions of billions of users, then you’ll need to test your changes before you push them live (unless you’re like that XX guy).

In that case, just add remotes pointing to different repositories, and repeat the same steps above to configure it. Then you’ll just push to different repos by doing:

Criatividade no Phishing (IR 2013)

Uma coisa que se pode dizer do pessoal que faz Phishing é que são criativos, com certeza.

Phishing é uma forma de fraude eletrônica, caracterizada por tentativas de adquirir dados pessoais de diversos tipos; senhas, dados financeiros como número de cartões de crédito e outros dados pessoais. (http://pt.wikipedia.org/wiki/Phishing)

No dai 1 de maio, recebi um email da “Receita Federal”. De tão simples até parecia legítimo. Eis o email:

IR 2013 Phishing email

Levou aproximadamente meio segundo para pensar que era treta. Mas resolvi ler o email, vai que não é…

A linguagem pareceu adequada. O visual simples. O link não pareceu tão absurdo. Claro que tem umas coisas que facilitam, por exemplo eles colocaram um número qualquer da declaração, não mostram nenhum dado pessoal além do email. Aí fui ver o site que estava hospedando a página de coleta de dados:

url2png

Mandei email para a empresa informando que estavam sendo usados para tentativa de fraude e procurei na receita um email para copiá-los, mas não tem. De qualquer forma, no site da Receita eles estão avisando que existem várias tentativas, então já devem estar cientes.

É preciso ter cuidado… sempre.

JSHint-Inline in Package Control

JSHint-Inline

JSHinting script tags inside html files

First public Sublime Text Extension (works on both versions 2 and 3). JSHint-Inline allows JSHint to run on HTML files, and only requires node.

All required node modules are embed into the plugin, so no need to npm anything.

How to install:

  1. Be sure to have the awesome Package Manager from wBond installed. I’ve already submitted the package, but might take some time to appear on the list.
  2. Open Sublime and go to Preferences > Browse Packages. Open the folder User, and then a terminal window on that folder. On Windows I’m using Git Bash Console window.
  3. $git clone https://github.com/bitbonsai/JSHint-Inline.git
  4. All done. Now when you have an HTML file with script> tags, just choose Tools > Build System > JSHint-Inline
  5. And press CTRL + B. Result?

JSHint Inline

nodejs, npm and sqlite3 [SOLVED]

So… today I decided to install the sqlite3 package in node… but then I got a non-nice error saying I didn’t have make installed. Yes, now I’m on Windows7.

I consider myself a rather eclectic guy when the subject is OSs. At home I have OSX, Windows7 and Ubuntu 12.10, and what I really like is the fact that I use the same code editor for all of them (buy Sublime, the best editor ever) and that I have all servers installed on all of them. Ok, for Windows I downloaded binaries, but they work. Just git clone a website and run it, simple like that.

But then, I got that error above. So I’ll document the steps to make it work here, and save myself (and hopefully others) some time with this notes.

preReqs

Npm is pretty awesome and brainless, but it’s good to take a look at the error log files if a requisite is missing. I had to download Python (and installed python’s win32 extensions) Already have VS2012 installed, so no need for C++ runtime, and the most important: downloaded GNUWin32 Utils. 400 and something packages, look into the folder for .bat files and read them. The first to be executed is download.bat.

After all is set, I’ve tried npm -g install sqlite3; it installed, but can’t use, don’t know why. Then when I installed with npm install sqlite3 (without -g) it created a node_modules folder and placed the module inside it. That did the trick. Working like a charm!

UPDATE

What was missing to make it work installing with -g was NODE_PATH in Environment Variables. Right-click My Computer > Properties > Advanced system settings > Environment Variables and add:

To test it, a little script, save as nodesqlite3.js:

And the result?

 

google maps api

Just found out this… typed my city in change.org, and it filled out the city, state and country… I was amazed. Looking at the network panel, found out this call:

http://maps.googleapis.com/maps/api/js/GeocodeService.Search?4sporto%20alegre&7sbr&9sen-US&callback=_xdc_._t9nhk5&token=32861

And opening this on a new tab, checked this result:

Checking the formatted_address part, and I have the full address. I can then record that into the DB, or that AND the lat/lng. VERY interesting… :)

You gotta luv PHP…

Why I <3 PHP:

Weather Icon on GeekTool

Finally I got it working… after a while the geeklet I was using for Yahoo’s weather icon stopped working, so I took a couple minutes to make it shiny again…

Basically, I’m scraping Weather Channel’s local page, grep for the image tag and sed the src of that image, saving it to /tmp/weather.png. Then the geektool looks for that image and refreshes it every half an hour. The cron also checks for a new image in 30 minutes interval…

The weather.sh is also pretty simple:

And the final result:

New Blog Engine or Jekyll?

So, I’m a little tired of WordPress. Sorry, dude.

When I want to publish something, I want to write in markdown, save the file, commit and BAM! It’s published. I had high hopes on Posterous but then you have spaces, too many features… blablabla. And then you have email html parsing, never looks like I want or adds too much clutter…

I was looking into Jekyll, but then… I’m a PHP guy, would I be able to write something that just works? So I’m thinking about the features and maybe I’m gonna write something, why? Because yes.

  • Markdown for posts/pages
  • git fork publishing
  • ftp publishing
  • no admin hassle
  • URL routes automagically
  • Easy templates

I’ll update my progress, once I have time to start something so unnecessary…