~/

dokku memo

Where dokku is installed?

Suppose when user is root, /root/dokku is the place.

Docker has lots of regression due to active development, how can I downgrade using with dokku?

Change /root/dokku/Makefile.

diff --git a/Makefile b/Makefile
-       apt-get install -y lxc-docker
+       apt-get install -y lxc-docker-0.7.2

Then run make install.

Nothing has been deployed, how can I debug?

Put file /home/dokku/dokkurc, and write export DOKKU_TRACE=1, it helps a lot to debug.

Ubuntu version

Use Ubuntu 13.04, not 13.10 till docker 0.8.0 is released (or more later)? See: https://github.com/dotcloud/docker/issues/1300

What the hell of container's status of Ghost?

https://github.com/dotcloud/docker/issues/2419 https://github.com/dotcloud/docker/issues/3231

66e54df6717        mysql/dev:latest           /usr/sbin/mysqld       About an hour ago   Ghost                                         hungry_archimede

:(

%i, %I

%w(foo bar baz).map(&:to_sym)

can be written with %i from Ruby2.0

%i(foo bar baz)

http://doc.ruby-lang.org/ja/2.0.0/doc/spec=2fliteral.html

%i!STRING! : 要素がシンボルの配列(空白区切り) %I!STRING! : 要素がシンボルの配列(空白区切り)。式展開、バックスラッシュ記法が有効

Destructuring assignments

These are Destructuring assignments.

someObject =
  a: 'foo'
  b: 'bar'

{ a, b } = someObject

console.log a # -> 'foo'
console.log b # -> 'bar'
class Foo
  constructor: (a) ->
    @a = a

class Foo
  constructor: (@a) -> # is equivalant to above
class Foo
  constructor: (params) ->
    @a = params.a

class Foo
  constructor: ({@a}) -> # Destructuring assignments can be used here as well

Though I'm not sure it is readable :P

We have lots of workshops in our company.

In our company (paperboy&co.), we have lots of workshops or semminars everyday. One of them is "Association to the interpretation in English with everyone".

It's held during lunch time. First we pronounce, and translate the given part. Then the man antipop who is like English professor with sincerity and the lady chocolatina who is actress (yes, indeed she is!) gave us an explanation each sentences or correct us wrong pronunciation.

When i first attended, to be honest, felt it's rather funny because it was really English class of university than English class which i ever had in real.

antipop describes the intention and the way how to go ahead (though it is Japanese). i'm really thankful to have this opportunity and definitely believe everybody in our company should join this chance, it's fun, seriously :)

Proc and ===

even = ->(x) { (x % 2) == 0 }

# we can use Proc#call
even.call(2)
even.call(3)

# also available to use ===, instead of using Proc#call
even === 2
even === 3

# we can use === in case statement as well.
fizzbuzz = ->(x) { (x % 3) == 0 && (x % 5) == 0 }
fizz = ->(x) { (x % 3) == 0 }
buzz = ->(x) { (x % 5) == 0 }

(1..100).each do |i|
  puts case i
  when fizzbuzz then "fizzbuzz"
  when buzz     then "buzz"
  when fizz     then "fizz"
  else i
  end
end

learned from RubyTapas#037 introducing more practical use case. it seems there must be a chance to use sometime :)

Misunderstanding about the configuration of of znc

I love znc, A irc bouncer. Today, i introduce znc to younger colleague. Then i realized i was wrong to configure of znc.

When we $ znc --makeconf, it generates .znc/configs/znc.conf. It's something like this.

<User freenode>
    Pass = sha256#foobarfoobarfoobarfoobarfoobar
    Nick = banyan
...

    Server = irc.freenode.net 6667
</User>

<User bogus_user>
    Pass = sha256#foobarfoobarfoobarfoobarfoobar
    Nick = banyan
...

    Server = irc.somewhere.net 6667 raw_password
</User>

The section of Pass, we should use my (own) password, not the password of IRC server. How to generate it? use $ znc --makepass command. then paste it.

If irc server requires password, we should add raw password to Server section. Server = irc.somewhere.net 6667 raw_password

i didn't distinguish between these passwords so always was confused to configure it :S

Also we encountered this error message.

<*status> Cannot connect to IRC (Cannot assign requested address (Is your IRC server's host name valid?)). Retrying...

I wasn't sure, but this post helps me :)

Webistrano settings for lazy assets:precompile (if assets are not changed, don't invoke rake assets:precompile)

1, install capistrano-lazy-assets in webistrano environment.

2, add recipe at webistrano

load 'deploy/assets'
require 'capistrano-lazy-assets'

3, deploy_via by remote_cache

deploy_via :remote_cache
repository_cache    cached-copy

That's it. in my case, 400sec -> 30sec.

Yet if we changed assets, it takes 400sec as originaly does. turbo-sprockets-rails3 is also useful which recompiling changed assets, based on a hash of their source files.

30%~40% faster. 400sec -> 280sec.

Released fluent-plugin-filter_keys #fluentd

fluent-plugin-filter_keys has been released.

Some of the plugin assumes the key is always exists, so this plugin help to check if the given key is exists in the event log.

<match test.**>
  type filter_keys

  add_tag_prefix filter_keys.
  ensure_keys    foo, bar
</match>

@lamanotrama gave me this idea.

proc

options = { transform: -> s {"<#{s}>"}, upcase: true }

filters = []
if options[:upcase]
  filters << -> string { string.upcase }
end
if options[:transform]
  filters << options[:transform] # callback function
end

results = %w(foo bar)
filters.each do |filter|
  results = results.map(&filter)
end

puts results # <FOO>
             # <BAR>