RarestBlog

BitCoin, Future and Crowd Financed Government

Today I thought about the way we pay taxes and BitCoin. The first thought was: let’s assume my employer starts to accept BitCoin and pay me salary in BitCoin. But then government has a problem - it can’t really track all the BitCoin transactions, it has to mostly trust company (and me) to tell it how much have I made. Of course there can be regulations which make it more clear, but let’s continue the thought.

Let’s imagine the taxes paying instead as a Crowd-funded State.

So, basically, State says that you have to spend 40% of your income on Govt. programs.

And then you have something like:

  • Local hospital
    €10 000 000
    FULLY FUNDED

  • Payment for teachers in your state
    €3 200 000 of €5 000 000 collected
    image

  • Payment for doctors in neighbour poor state
    €499 999 of €500 000 collected
    image

  • War with neighbouring country
    €0 of €100 000 000 collected
    image

  • Big Bank Bailout
    €0 of €700 000 000 000 collected
    image

Obviously the prices are in € or in $ or any other state-issued money :) But that doesn’t mean that they can’t accept BitCoin for that.

And then you are free to distribute your funds as you see fit. Then all those programs that people don’t agree with - won’t get funding.

Now that’s some nice future that I want to live in! :)

It will probably be the first time I’d be happy to pay my taxes.

Grucrawler - Simple Crawler for Ruby

Released a generic Redis-based crawler for Ruby today. Very alpha. Use at your own risk.

Has throttling, concurrency and some limits, but that’s about it.

An example to parse a lot of Italian websites:

require 'grucrawler'
require 'colorize'

class ItalianCrawler
  def options
    {
        visit_urls_only_once: true,
        follow_redirects: true,
        concurrency: 5,
        domain_wait: 20, # seconds between visits to the same domain
        max_page_size: 10000000
    }
  end

  def on_init(crawler)
    @crawler = crawler
  end

  def on_page_received(typhoeus_response, nokogiri_html)
    puts "GOT #{typhoeus_response.effective_url.green}"

    # typhoeus_response.body
    # typhoeus_response.request.url
    # typhoeus_response.effective_url
    # nokogiri_html.css('a').each |a| { puts a.text; }
  end

  def follow_link(target_url, typhoeus_response, nokogiri_html)
    return false if target_url.match(/\.(jpg|png|js|css|pdf|exe|dmg|zip|doc|rtf|rar|swf|bmp|swf|mp3|wav|mp4|mpg|flv|wma)$/)

    return true if target_url.include? '.it'

    false
  end

  def debug(message)
    #puts message.blue
  end

  def log_info(message)
    puts message.yellow
  end

  def log_error(typhoeus_response, exception)
    puts exception.to_s.red
  end
end

c = GruCrawler.new(ItalianCrawler.new)
# c.reset() # deletes all memory of all events - useful for restarting crawl
c.add_url('http://www.oneworlditaliano.com/english/italian/news-in-italian.htm')
c.run()

API might change in future, so

gem install grucrawler --version '0.0.5'

for the example below to work.

Here, grucrawler

Why? I’ve got tired of my attempts to get to understand all the complex stuff that goes into configuring all other crawlers. Too complex. I’ve wanted something dead simple.

Have fun!

When You Try Something New and Fail

Today I realized something that probably many people realized before.

We give up too easy. Especially when you are doing something new and try it for a few times and you see that it fails, you think that it’s not good and stop.

That’s the mistake. When I remember anything that I do well - it took me considerable amount of time to get good at it, considerable amount of failures went into that. But I didn’t give up and then I’ve became good at it.

Yet in many other cases I try something and I give up quite soon, when I should have continued.

We need to make habits of what we want to get good at. Only the daily routine can make you good at something.

Don’t give up too easy!

Yabla

If you want to learn a language - go see Yabla (Spanish, French, German, Italian, Chinese).

image

I’m learning German and the biggest problem so far is understanding what natives say (especially in movies, when they speak real fast). Yabla is awesome - it shows you the video with subtitles (nothing new here), and you can loop single phrase (that’s new!) and even slow it down.

Then there is “flashcards” feature. When you watch a video - you can click on unknown word and you see the translation, but in the background Yabla adds it to your Flashcards and you can review them later.

Probably the most useful thing I’ve tried for languages.

Mini Habits

Following the advise in the ”Mini Habits” book, I will try to make a new habit of writing to the blog.

Actually, “Mini Habits” got me a great idea that if you can do something regularly you should cut it in half and in half and in half until the task is so small that it’s more easy to do it than to figure out why should you not do it.

So for the blog posts at first the task was to “Write a blog post”, but that seems like a lot almost always, so eventually the task got to be “Write a 1-line blog post”.

Well, that’s quite easy. And it gets you started. And when you start doing something it’s harder to stop rather than continue, so you almost always exceed your original microscopic plan by far.

Also, ”Habit bull” is really a great app for Android to keep you on track with your new mini-habits.

Install CoreOS on Hetzner

1) Boot into Rescue

2) If you have previously installed RAID, disable it:

mdadm -S /dev/md0
mdadm -S /dev/md1
mdadm -S /dev/md2

3) Clean up partition table:

dd if=/dev/zero of=/dev/sda bs=100M count=1

4) Install CoreOS

cd /tmp

cat >cloud-config.yaml << 'EOF'
#cloud-config

hostname: coreos1

ssh_authorized_keys:
  - ssh-rsa AAAAB3....
EOF

wget https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install
chmod +x coreos-install
./coreos-install -d /dev/sda -C stable -c cloud-config.yaml

5) Reboot

6) You can now do ssh core@your-server.com

Bootstrap 3 / Angular Boilerplate

Just for my own reference..

Bootstrap 3 with old theme

<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://getbootstrap.com/dist/css/bootstrap-theme.min.css">

Angular 1.2

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js"></script>

<script type="text/javascript">
    var app = angular.module('app', []);

    app.controller('MainCtrl', function ($scope) {
      $scope.var1 = '123';
    });
</script>

<div ng-app="app" class="ng-scope">
    <div ng-controller="MainCtrl" class="ng-scope">
        <div class="ng-binding">{{ var1 }}</div>
    </div>
</div>

JSFiddle

http://jsfiddle.net/993gt1Lc/

FollowUpThen

Wanted to recommend a great software that I use daily.

Create an email and send it to

tomorrow@fut.io

This e-mail will return to you tomorrow, at which point you would be able to defer it for any amount of time or be done with it.

The service is called FollowUpThen and it’s awesome!

Some things to try: tomorrow8am@fut.io, nextmonday@fut.io, every3days@fut.io, 5d@fut.io (in 5 days).

Try it! - http://www.followupthen.com/

Gerar PHP

Today I started experimenting with something - PHP-based configuration management (think Chef/Puppet).

Basically I though something like this should be possible:

Package::named("php5-cli mysql-server git imagemagick")
    ->shouldBeInstalled();

Service::named('apache2')
    ->shouldBeInstalled()
    ->shouldBeRunning()
    ->shouldBeRunningAtReboots();


File::named('/var/www/index.html')->write("Bender is great!");

Http::request('http://localhost/')
    ->onSuccess(function($request, $response) {
        Console::log('My new code is "' . $response->getBody() . '"');
    })
    ->run();

User::named('root')
    ->shouldHaveSshKey()
    ->mailPublicKeyOnce('user@super-server.com');

User::named('alex')
    ->shouldBePresent()
    ->haveSshKeyFrom('files/alex.ssh')
    ->shouldBeInGroup('sudo')
    ->shouldHaveNoPasswordSudoFor('/usr/sbin/service')
    ->shouldHaveSudoFor('/bin/vi');

I thought that since PHP has PHPStorm, which has a great auto-completion - it should be much easier to write PHP scripts than Puppet/Chef scripts. Also you have a complete language to help you refactor the code.

And that’s what I actually implemented. It’s still a work in progress, but check it out if you want to.

Git repository