As I sometimes use Perl, I decided
to read something about it. And Higher-Order Perl by Mark Jason Dominus
was looking interesting. The book is really nice, it shows
that Perl can be kind of a functional programming language and that
it’s possible to implement almost every feature from other languages in Perl.
Also, after reading the book, I think there’s copious amount
of ways to shot yourself in the leg in Perl.
The problems in the book are interesting and a bit challenging, so I think
it can be worth reading even for people who don’t work with Perl.
About a year ago I made soundlights with Raspberry Pi.
But RPI is a bit of an overkill for this simple task and it’s quite big,
doesn’t have WiFi out of the box and practically can’t be used without a power adapter.
So I decided to port soundlights to ESP8266. The main idea was to reuse as
much as possible from the previous implementation, so the parts with patched
audio visualizer and colors generation are the same. In a few words,
I’ve patched cava to print numbers
instead of showing pretty bars in a terminal. And I’ve generated colors
with a code found on Quora.
And in current implementation I decided to make it very simple to use,
the only requirement is to have a machine with cava and ESP8266
on the same WiFi network. So I chose UDP broadcasting as a way to
send data to ESP8266. And because there’s just 60 LEDs and color of
a LED is three values from 0 to 255, colors for all strip is just
180 bytes. So it fits in one UDP packet.
A few years ago I was using Light Table, the
integration with Clojure REPL was so nice. But the other parts of
the editor and other languages support weren’t that good. And at the
moment the editor looks almost dead.
After that, for Clojure, I switched to Cursive,
and I still use it. It has a nice feature – send to REPL, which
allows users to execute selected code in REPL. But it’s Clojure/ClojureScript
only and requires some hassle to configure.
Nowadays for some stuff, I use Visual Studio Code.
It doesn’t have a nice integration with REPL, but it has integrated terminal.
So I thought, wouldn’t it be nice to just open any REPL in a terminal and
somehow send selected code to the REPL. Without any configuration,
even with REPL on a remote server.
So I wrote a little extension – SendToREPL.
In action with Python REPL:
How does it work? Let’s look at the initial version of the extension:
It just creates a terminal when extension loaded and registers extension.sendToREPL
command. When the command is triggered (by Ctrl+’/Cmd+’ hotkey or from Quick Open)
it gets selected code and sends it to the terminal.
The current version is a bit more advanced, it sends the line with cursor if
nothing selected and squash code in one line for some languages e.g. Perl.
Recently I wanted to read something
about refactoring and about working with not so good code, so I
decided to read Working Effectively with Legacy Code by Michael Feathers.
And it seems to be a good book, it contains a lot of recipes and
techniques for making the code more testable, for removing dependencies
and for making the code better generally.
Although the book is a bit too OOPish and a bit old, I think it’s
So I thought that it will be nice to distinguish different ssh
hosts by color. I found on
how to generate color from a string and wrote a python script that
extracts host from command line arguments and prints fancy sequences:
Recently I decided to
read something more about Kubernetes and found
The Kubernetes Book by Nigel Poulton.
And I’ve made a wrong choice because it’s an introductory book explaining
basic concepts with very simple examples.
I don’t know, maybe it’s a good book to start working with Kubernetes.
Recently I wanted to read
something about graph databases and in the Humble Book Bundle,
I found Graph Databases by Jim Webber, Ian Robinson and Emil Eifrem.
The book is mostly focused on neo4j but has a bit of information about
other databases. It has examples of graph data models and real world use
cases, also the book contains an information about theoretical parts
and neo4j internals. And there’s a lot about Cypher language.
Although in some chapters the book can be described by anything’s a graph if
you’re brave enough.
A lot of people (at least me) tweet airports codes like PRG ✈ AMS
before flights. So I thought it will be interesting to draw a
directed graph of flights and airports. Where airports are nodes
and flights are edges.
Then I tried to receive all my tweets with that marker but stuck with a huge problem,
twitter REST API doesn’t work with emojis in a search query. So I decided to
receive a whole timeline and filter it manually. So only the last
3200 tweets will be parsed.
Working with twitter API is very easy with tweepy:
Apart from using Cloud SQL,
I haven’t touched MySQL for a while, so I decided to freshen up things and read
High Performance MySQL by Baron Schwartz, Peter Zaitsev, and Vadim Tkachenko.
The book feels solid, it explains how MySQL works (and worked before) inside,
what problems storage engines/parser/optimizer/etc have and how to leverage them.
It’s kind of nice that a big part of the book is about MySQL scaling. And it’s
also good that the book has a lot of information about troubleshooting, debugging,
profiling and some MySQL related tools.
Although the book is probably a bit outdated, it covers MySQL versions up to 5.5, but
nowadays the latest version is 5.7.