Jun
30
2021
No hover please

Ever watch videos online? Ha ha, of course you do. Now here's what bothers me. I set the video — for example eurosportplayer.com — in full-screen, on a desktop, but I don't really watch continuously, I let it play and come back to it every now and then. Whenever I switch back to that desktop, a gross overlay with the video controls shadows the media for like 5 seconds. Even the slightest mouse movement brings on that despicable thing.

If this is pissing you off too, and if you are using Linux + Xorg/X11, then I have a solution. It's called nohoverplease but feel free to name it whatever you like, like fuckyouroverlay or something. It's an empty and fully transparent window that does nothing at all, it just sits there, maximized, on top of the browser, and won't let it know it's visible or catch mouse movements, so the damn overlay won't show up. I do have bigger problems in life, but it feels good to solve at least the little ones.

[ read more... ]


May
15
2021
JavaScript Sudoku solver

My wife has developed a passion for Sudoku. I do not share it, I've always thought that this is a problem for computers, not humans, so I've never tried to solve one by hand. However, even if it's a high school problem, I thought it'd be a cute little program to work on. This is the obligatory blog post about it.

Update: see bestest version.

[ read more... ]


May
9
2021
New server

“If you don't schedule time for maintenance, your equipment will schedule it for you”

So true! After almost ten years of continuous functioning, one of the hard drives failed and I was left with an unbootable server. Last time I checked it had more than five years uptime. I managed to backup, last minute, things that I should have backed up periodically, and I got a new server, also from Hetzner (whom I warmly recommend, without having any affiliation to them, other than the fact that they are my favorite host for the past 10 years or so).

Sysadmin work sucks. I only do it when the hard drive fails :) so that's about once every 10 years. Still, I was able to put back together my DNS server pretty quickly; also this website, because it's written in Common Lisp. 10 years old software, unchanged, compiled by bleeding edge SBCL running on bleeding edge Arch Linux; now that's stability.

Until the dust settles, comments will be disabled (missing a SMTP server for now). Permanent victims are my old Perl-based websites, including my old blog; I won't bother to get them back up, but there's the Internet Archive if you miss anything.

There'll be a new blog post soon, about Sudoku. I'm not dead yet. :)


Sep
6
2020
Corona US Open and other thoughts

Nice to finally see some live tennis after so long! The US Open has started. Some top players are missing — no Nadal, no Halep (they rather concentrate on Rolland Garros; understandably, since clay is their preferred surface); no Federer (some knee injury).

Some of the bad boys who had the coronavirus are playing, like Djokovic and Dimitrov. The latter just went out. But it was a good match, take a look at the highlights if you like tennis. How strange it feels to watch these intense points without hearing the crowds' murmur of amazement! There are no crowds, because... pandemic! These huge arenas are empty.

Of course, players don't wear a mask during play; on average, a match takes 2-3 hours — it would be impossible to put that effort with a mask. But after the match, the winner gives an interview and that's... with a mask on! Take a look at Sofia Kenin. She's alone, in the middle of the empty court, with the mask on. The interviewer is nowhere to be seen, she's probably not even there.

Is it player's choice to wear the mask here? I don't think so, she's already been all over the place for two hours without a mask. Most probably, these are the regulations, but what could be the purpose? Clearly there is no risk to get infected, nor to infect anyone, because there's no one around! The virus doesn't just fall from the sky; if it did there would be no tennis and we'd stay indoors and homo sapiens would end, which probably wouldn't be too bad.. but I digress. The only purpose that can be is to maintain fear.

The most heartbreaking change is that they are no longer allowed to shake hands. Most players known each other for years, they are friends and they remain friends even after a hard fight; they used to shake hands and hug at the end, which is really what friends do, but now they just tick rackets and that's it. Sad. Meanwhile in footbal:

You can see these images after every goal. Now, I get it, manifestation of joy is part of the game, is something human and it shouldn't be forbidden, but then why not allowing tennis players to shake hands at the end? It just doesn't make sense. Also, while restaurants reopened just days ago with very strict rules, here's our beloved football players:

No distancing, no masks, indoors. This is practically illegal. What I'm trying to say, I guess, is that nothing seems to make sense! I feel like something more sinister than just the virus is going on. I want and try hard not to believe in conspiracy theories, but I feel like some unseen hand is manipulating all of the press and all the governments, worldwide, silencing voices that try to sing a different kind of music.

I find it weird that the Bill and Melinda Gates Foundation is pouring money both into the WHO, which declared the pandemic and dictates the regulations worldwide, and in ID2020, which recognizes “the opportunity for immunization to serve as a platform for digital identity“, which pretty much means they'd like to use vaccines to insert RFID tags into us; and that the press is talking about how the pandemic will not end until a vaccine is available, which kind of implies that vaccination will be mandatory, and all of a sudden conspiracy theories seem to become reality, in your face! They don't even hide!

I'm not exactly “anti-vaxxer”, but I try to get informed and think, and it's not hard to connect these dots. I wouldn't like to get an ID chip inside my body, so I will refuse vaccination... if I can! I think that's the end goal of this “pandemic” — mandatory vaccination of the whole planet, and that could mean digitally stamping everyone. My cat has a chip, but I'm not a cat and I'd rather not have one.


Apr
30
2020
Coronashit

I haven't blogged in a while. I guess I didn't have anything good to say. There's nothing good here either, but I just have to vent my frustration.

1. “Stay the fuck home”

I'm fed up with this shit! When I hear “coronavirus”, “social distancing” or “self-isolation” I almost feel physically ill. That's all we hear these days.

I hate the lockdown. Perhaps it made sense, initially, but it seems to be getting way too far. It's easy to shout “stay the fuck home” when you can work from home, or when you're extremely rich, but what about the others?

My wife closed her after-school. It was a flourishing business. Children loved them. Their parents and their dog loved them. It was an organic, small but profitable business. It was a dream come true! And now it's closed for like two months, with no reopening hopes in sight. With schools closed until fall, she might as well file for bankruptcy.

Like her, there are hundreds of millions. What will these people do? How many of them will kill themselves? Things are quite depressing already: you can't see friends, you can't see family, you have to carry a paper with you at all times, where you declare where you're going to and why, as if that stupid paper would help preventing the spread! Add to this the loss of job/business/income, and no immediate hopes for a better future, and to many people suicide will start looking like a sweet outcome.

Wouldn't these people rather go on with their lifes, even if that means to risk getting infected?

I wish we at least stop parroting the news, stop shouting “stay the fuck home”, that's disrespect for those who did or will lose everything because everybody had to stay home.

2. The media

Why are these guys being censored? I'm just wondering, I mean, they're not just some random dude on Facebook; they are doctors, they have some pertinent opinions, that deserve to be mentioned. They're not saying it's a hoax. The disease is real, but perhaps it's not so bad as to warrant shutting down the planet. The discussion on the mainstream news is completely imbalanced, nobody who dares to question the benefits of the lockdown is allowed. Isn't this at least suspicious?

I'd like to see some balanced discussion, I'd like to see someone objectively analyzing the usefulness of the lockdown, and the long-term effects. Like these two doctors seem to do. But nope, the mass media is universally one-sided: lockdown! Anybody who suggests otherwise is “fake news”. Allow me to be skeptical.

3. The authorities

Politicians announced some gradual relaxing, after May 15. Announcements were made in cautious words and nothing concrete has been said, but some business will be allowed to reopen, like barber shops. The coffee shop where I used to go daily with my colleagues? — mmm nope, that stays closed. They're probably doing the final paperwork for their soon-to-be-history business right now. Or writing their wills.

I find some measures contradictory, if not downright stupid. Why open barber shops and no coffee shops?

Why are we not allowed to go out in groups bigger than three, when there's a hundred people in a grocery store?

It is my understanding that office companies will be allowed to reopen; of course, many of them will chose to continue to work from home, but the point is that they can get people to the office if they like to and that means dozens of people in an open-plan room. Why can't we go out in groups bigger than three, then?

Schools remain closed, because if children go to school they might get infected, and then infect their parents and hell breaks loose. But if their parents go to work, can't the exact same thing happen?

Some people go to church regularly. I'm not one of them, but I understand them. Why can't they attend church for a couple of hours, yet they can stay in an open-plan office for eight hours?

Why can't I drive to another town without having a solid reason — will I get infected in my car? I'd like to visit my parents, is that reason solid enough? Oh, and I can't take my children because then we'd be more than three.

Our PM said the economy will restart when the epidemic is over. Excellent news, thank you very much.

4. Me.

I'm depressed. I guess I'm in the high-risk group, being a smoker for too many years. Still, I'd rather take the risk than live a miserable life for the foreseeable future. If I do get the virus, I ain't going to no fucking hospital; I shut myself indoors and hope for the best, and if I die then so be it!


Dec
10
2017
Emacs and JavaScript in 2017

About an year ago, when it became clear that sooner or later I'll have to write ES6 code, I decided to give js2-mode another look (wow, how time flies!)

Steve Yegge no longer seems to maintain this majestic creation, but as it often happens in the open-source world, quality code finds new home and maintainers. The official fork today is located at https://github.com/mooz/js2-mode, and it's what you get if you install it from Melpa. However, I live on my own fork where I fix bugs as I find them. Eventually, my fixes get merged into the official repo.

On top of js2-mode, Magnar Sveen of emacsrocks.com fame wrote js2-refactor, a collection of tools for working on JavaScript code. It brings new powers at your fingertips — for example, you can select a piece of code and turn it into a function; it figures out what are the variables needed by that piece of code, and turns them into arguments of the new function; and replaces that piece of code with a call to the new function, which is inserted just outside the current function. All that happens in a split second — an operation that would take many seconds to do manually. If you edit JavaScript, and use Emacs, make sure to check js2-refactor.

Before switching to js2-mode + js2-refactor, I had some utilities for editing JS that worked with an external parser (based on UglifyJS). I have ported these tools on top of js2-mode and js2-refactor, so we don't need to call an external parser, and we get support for ES6. I wanted to briefly cover it in this post, and perhaps if more people are interested I will submit a pull request to js2-refactor.

[ read more... ]


Aug
19
2017
Gazing at the numbers: the Collatz sequence

I've been obsessing on this problem for a couple weeks. While thinking on it I made some observations on my own, so it's worth a post on my blog. Note that I'm not a mathematician, so there's more English than Math here (which, for people like me, could in fact make it easier to read). I don't have proofs for the most interesting observations I made, and they might be known already for the trained mind.

If you studied the Collatz conjecture, then you might want to jump to the TL;DR.

The problem

The Collatz conjecture defines a sequence of positive integers that starts with any number $n > 1$, and at each step, in order to get the next number, you apply this simple logic, depending on the parity of the current number $n$:

  • When $n$ is even, the next number is $n / 2$
  • When $n$ is odd, the next number is $3n + 1$

The conjecture states that any such sequence eventually reaches $1$ (of course, we could continue after $1$ but it will loop). For an example, let's start with $n = 6$: 6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1.

[ read more... ]


Jul
30
2017
Don't sudo gnome-disks after beers

So yesterday I was repartitioning an USB stick and I was, say, less vigilant than I usually am when I play with these tools: the wrong disk was selected. I clicked through the confirmation dialogs without thinking too much, and gnome-disks happily removed my /boot and swap partitions. About the third partition, however, it complained with a “can't unmount it” message! (that was the root partition). As I was re-reading the message in horror, I realized I was messing with the wrong disk. Holy shmoly, so it did try to unmount it! "Thanks" goes to whoever made it impossible to remove a mounted partition, and "Thanks NOT!" goes to gnome-disks for not displaying a big fat warning when I try to remove a mounted partition that it can unmount.

[ read more... ]


Mar
18
2017
Pull Request based development (sucks)

Does this workflow sound familiar? The “master” branch is considered sacred, and it's therefore locked so nobody can push directly to it. Before you even start coding, there has to be a task opened in JIRA, and a branch also created from JIRA and linked to that task, and you then start pushing commits to that branch. And when you're done, you submit a Pull Request via Stash, and wait for at least two colleagues to review and approve your patch, and only then can it be merged to master.

As a developer who has been around for almost two decades, I'm going to argue why this workflow sucks. You tell me to run, and then you tie my legs.

[ read more... ]


Mar
5
2017
Tweeg: a Twig to JS compiler

Tweeg is a compiler for the popular PHP template engine Twig. It converts templates to JavaScript. Not being a PHP fan, to say the least, I don't particularly like Twig. But it does the job. At eMAG we're using PHP + Symfony on the server, and Twig is pretty much non-negotiable at this point.

Sometimes we need to render the same template on the server (on initial page load) and also on the client (when we update stuff via AJAX requests). So far, such cases were rare, so we wrote separate templates for JS using a slightly modified version of John Resig's micro-templating. It sucks, but it did the job. However, we will soon face the situation that we'll have to duplicate dozen of templates, just because Twig was not supported in JavaScript. So I took upon myself the lovely task of writing a Twig parser and compiler.

Halfway through, a colleague pointed out a similar package (twig.js). Tweeg was already better in a number of ways, so I didn't give up:

  • Tweeg is a compiler, which twig.js is not. (issue)
  • Tweeg supports string interpolation, which twig.js doesn't
  • Tweeg is much smaller.

eMAG kindly agreed to open-source this package under the MIT license, so here it is. Usage details in the README.

PS: I would welcome a Gulp plugin for it. ;-)


« Before 5 Mar 2017