Recently I have been asked by a friend to define number e. After a little thought, I have came up with: “it’s a base of function, which grows as fast as itself”. It’s not really clear nor correct definition, so I have came up with some source code to visualize the idea:
C = 0.00001
S = 1.0
return C if x < C
b = e(x - C)
b + b * C
puts(e(S) * (S / C))
When I tried to run this code with Ruby 2.1 I have got a very familar exception:
$ ruby e.rb
e.rb:9: stack level too deep (SystemStackError)
Luckily, there is a
old new player in town: Crystal (http://crystal-lang.org/). For those of you who haven’t heard of it yet, it’s an Ruby syntax inspired, compiled and LLVM backed language. One of it’s neat features, is that it can actually run some Ruby scripts without any changes. So without further ado:
$ crystal e.rb
After upgrading one of my computers to 15.04 my system halted on boot after following message: “Starting cryptography system for cryptohome”
This particular machine is using pretty standard LUKS encryption for /home and swap, so it was very suprising that it didn’t work immediately.
Luckily, while 15.04 switched to use systemd for init instead of upstart – there is still an option in GRUB to use upstart. Selecting it worked fine and I had my system up in a minute.
While a quick google didn’t reveal solution, it reminded me of old issues with plymouth (splash screen on boot) and entering password – which made my disable plymouth long time ago. Turns out, super simple solution was to reenable it:
$ sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="splash" # splash = plymouth
$ sudo update-grub
And that suprisingly simply solved the issue!