Using caffeinate to keep your macbook from sleeping

I use a Macbook Pro, running macOS Catalina, and have often found that it will sometimes go to sleep at unfortunate times. Namely, when I am downloading or uploading stuff. So this little HOWTO will show you one way you can prevent that.

Just use the caffeinate command. Simply open a terminal and enter:

Last login: Sat Jul 11 17:56:01 on console
yourname@your-MacBook-Pro ~ % caffeinate -s

As long as your system is on AC power, that command should prevent your system from entering sleep mode. Now your downloads/uploads will continue uninterrupted. And when you’re done, simply press CTRL+C while focussed on the terminal to cancel the command. You’re welcome.

How Europe is failing the test again: geopolitical effects of the financial crisis and the Covid19 pandemic

In July 2015, Greece was almost kicked out of the Eurozone over a difference of opinion on how to deal with the economic depression, because Europe’s finance ministers didn’t like Varoufakis (the Greek minister of finance at the time), and because of the “Sparpolitik“—a German phrase refering to austerity measures—mentality that characterized the attitude of important northern European member states. The negative impact this debacle has had on the public image of Europe is enormous, and no doubt did little to convince Britons to remain in the EU. The message is clear: net contributors with a solid budget are okay, everyone else should shut up and bend over to receive a stern caning. In light of these events, one is tempted to think it hardly a coincidence that the only other place we call ‘Europe’ in our solar system is the inhospitable cold dark ice-moon in orbit around Jupiter.

What are the effects of the way the financial crisis was dealt with? Well, to start with it evidently brought the ‘Brexit’ closer. And ever since a major country like Great Britain turned its back on the EU, more cracks have begun to develop in the European dream. Indeed, it isn’t just the UK we should be worried about. Look at Turkey, for example. Turkey is one of the biggest economies on continental Europe, and 13th world wide. It is also the second most powerful member of NATO, after the United States. And Turkey used to aspire to EU membership. But Turkey’s potential membership of the EU is conditional upon a number of important reforms. Yet having seen the mess Europe is in right now, do you think Turkey will be in a hurry to make those reforms? Even if Turkey ever did, they certainly won’t for the foreseeable future, if indeed ever. In fact, considering the strategic location of Turkey in todays geopolitical arena, Europe needs Turkey more than Turkey needs Europe. The interests of the EU have thus been dealt heavy blows on two critical fronts. But it doesn’t stop with the deluge of poor war refugees Turkey is holding near it’s borders as “trump” cards, mere pawns in a terrible chess game, ready to be let loose upon the West.

Speaking of Trump; despots everywhere must certainly be rejoicing as the United States have withdrawn military support from key regions in the middle east. Is it really a coincidence that any region Trump is unlikely to build a golf resort or hotel seems to require no military intervention from the US these days? Yet how else does one explain Trump’s willingness to use military force against mostly peaceful anti-racism protesters in his own country, while withdrawing his troops from an actual warzone in Syria filled with ISIL militants? And Europe’s lack of cohesion and flacidly scattered armies cannot hope to fill this void in any meaningful sense. One wonders if Europe is really just an Economic entity, there are certainly politicians who view Europe as such. But who can possibly be that naive? This is the time for a united European military presence. Call it a European army, or call it a coalition force. Whatever, just do something. What is the alternative? We are seeing it. Look at the millions of refugees collecting in Greece and Turkey: one country hardest-hit by the financial crisis, the other glad to have a bargaining chip. One would hope the EU would be smarter than that, and more than just an Economic union designed to line the pockets of a few oligarchs and multinationals, using lucrative international trade agreements, corporate tax benefits, and mercantilism. But apparently that’s really all it is.

And then there is Russia. If there is one thing Russians are good at, it is exploiting weakness. And right now, Greece and Syria are the Achilles’ heels of Europe in that sense. What is the economic leverage Russia has? Gas pipelines! And what is coming to Greece all of a sudden? Gas pipelines! Straight from the Kremlin, into the boiler of Mr. Mitsotakis. After Greece, Russia has also expanded it’s influence in the middle-east. Trump withdraws his troops, Turkey invades the border zone of Syria, and all of a sudden Poetin rides in barechested on a full-blooded Arabian stallion to settle the conflict and save the day. This is not a coincidence. The US have left the world stage, and Poetin is one of the players happily stepping in to fill the void. How does the increased clout of Russia, combined with the USA’s increased aggression against the International Court in The Hague, improve the position of the relatives of the MH17 victims? Is it more, or less likely that justice will be served, and that the bereeved will receive compensation? I’ll give you a minute to think about that, bearing in mind that six years after the fact—and long after the responsible parties have been identified—little if any progress has been made. That’s not just Russia’s fault, it is also the EU’s fault and a consequence of USA’s growing weakness in the global political arena.

And then Covid19 happened. And again we see the EU falling apart like a clumsy first move in a Jenga game. After all the bickering during the financial crisis, and just as southern Europe was seeing clear signs of recovery, it starts all over. Again the northern European states withdraw to their trenches of austerity. But then how ironic that this time the North is assuming a more Keynesian economical view for their own countries: spend now when the crisis hits hard, make cutbacks when things are fine again. We have a huge buffer and interest rates are at an all time low. Yet when it comes to the southern states, it’s the “Sparpolitik” message all over again. That’s just as stupid as saying that antibiotics works for everyone in your country, but not for anyone with a foreign passport. Do we really need to be in a European union that is this idiotic, that looks no further than what is right in front of its nose? What’s the point?

Through tragically incompetent, it is at the same time not entirely unamusing to look to the way the USA is “handling” the Covid19 problem—mostly by doing nothing, it seems. Much like each country in Europe, each state in the USA is dealing with covid19 individually, without any meaningful coordination with the surrounding states. Oh, and they need not look for leadership at the White House, because it has gone golfing. The lack of unity mirrors Europe almost exactly. States that impose stricter lockdowns are typically hit less hard, and poorer states are left to fend for themselves for access to life-saving resources. It will be interesting to see, though tragic for those severely afflicted by the corona virus, how the situation will develop in the coming months. Like many epidemiologists I predict resurgance of the virus in the USA (mostly) and Europe (to lesser extent), with densely populated relatively poor areas hit hardest of all, and expediated by the lifting of air travel restrictions. But it will be a lesson for Europe and USA alike: the best strategy is to fairly distribute resources amongst the (member)states, to listen to experts for advice to develop informed policy, to impose equal measures for all, to intervene at the highest possible level when necessary, and to promote solidarity throughout. This advice has the virtue of being universal: it applies to covid19, to wars and economic malaises alike, to Europe, to the USA, to the world… indeed, to the known galaxy. But if history has taught us anything, it is that good advice is unlikely to be followed and  history lessons are rarely learned. So as folly again blindly marches forth, every sensible person should fear for the future of the European Union.

How to install POVScript+ (MOLScript) on macOS

When I was working on my MSc thesis—on a subject involving a lot of protein science—I wanted to be able to generate my own protein structure models from PDB format files that are available from the Protein Databank Archive. However I quickly discovered that the more capable programs either require users (even students) to purchase a license, or that most of the freely available programs are incapable of generating scalable, publication quality graphics.

During my searches I found two programs that I believed would be able to produce the high-quality images I wanted: CCP4 and POVScript+. Both programs are free to use, but whereas CCP4MG is available as a precompiled binary for macOS, POVScript+ is not. That means that you must build the POVScript+ tools from scratch. This is certainly not a trivial task for the casual computer user. But even users familiar with more hands-on operating systems—like Slackware Linux, or FreeBSD—may also encounter minor frustrating issues. So here I will explain how I got it all to work. I assume you have a basic understanding of the UNIX file structure, and that you understand at least the basics of using a terminal program to enter commands.

The first requirement is that you will need to have installed Xcode from Apple. This is a so-called SDK (Software Development Kit), and it is free to download from Apple’s website. [UPDATE: You can also install just the XCode “Command Line Tools” package, which will take up a lot less space on the hard drive.] Make sure that you have enough free space on your system, because it takes up over 10 Gigabytes after installation. And it is also worth mentioning that if you just installed Xcode—and thus have never used it—that you will not be able to compile anything at all. Try anyway and all you’ll get is an error message saying that the C compiler doesn’t work. Even though it’s brand new.

First run “sudo xcodebuild -license” and accept the damn license, then you’re good to go.

But the compiler works just fine of course. What that confusing error message is actually trying to communicate is that you first have to accept the license agreement from Apple before you can use Xcode. So all you do is first run gcc by itself and then Xcode will tell you what you need to do.

You want to be agreeable here.

Next you will need the GNOME libraries (called GLIB). Simply follow these instructions. First copy the shell script to wherever you want to build GLIB (using the “Save link as…” option) and then open a terminal, cd into that directory, and execute the script using the command “sh gtk-osx-build-setup.sh” (keep in mind that if you try executing the script directly with the command “./gtk-osx-build-setup.sh“, that you may first have to make the script executable by using the command “chmod u+x gtk-osx-build-setup.sh“). Then continue with jhbuild as instructed.  It should start building everything automagically, though it may take a while for it to finish since it’s a relatively big build. It might be a good time to have a long coffee break.

Once GLIB is done, the other thing we need to have is the GTS Library. First download the source files here. Then execute the configure script, substituting  the “/path/to/gtk” bit with the actual location of your gtk directory: “./configure –with-glib-prefix=/path/to/gtk/inst/lib PKG_CONFIG=/path/to/gtk/inst/bin/pkg-config“. Then run “make” followed by “make install“. Done. On to the final step.

Finally we have arrived at the last step, where we start building POVScript. First download the sources here, and after unpacking you change directory into the newly created povscript directory and execute “./configure –with-gif=no –with-jpeg-lib=/path/to/gtk/inst/lib –with-png=no –with-jpeg-inc=/path/to/gtk/inst/include“. Again you must substitute all paths with ones that are correct for your system. If this goes well, just execute “make” to build POVScript. Running “make install” doesn’t seem to work (at least on my system), so instead I just create two symbolic links in /usr/local/bin that point to the binaries molauto and molscript that are located in the /src subdirectory.

So now if you download protein 5EC5.PDB (in pdb format) from the Protein Databank Archive, you can use the following command “molauto /path/to/5ec5.pdb | molscript -ps -out /path/to/5EC5.ps” to create something awesome like this:

5EC5

Hopefully you should now be able to create similar models. If you managed to get POVScript+ working, then you can finalize by deleting some stuff you don’t need. And there is a lot of stuff you don’t need! The whole GTS Library build directory with sources can be trashed since you already installed the libs on your system. And from the gtk directory (containing over 2 gigabytes of data!) you only need the subdirectory “.../gtk/inst“.  Once you delete the source files, you will have reclaimed about 1.8 gigabytes of valuable memory space. And finally you can also delete Xcode—unless you plan to build more projects, of course.