Marcos Dione: configuring-power-and-hardware-related-events

A month ago I revived my old-laptop-as-server I have at home. I don't do much in it, just serve my photos, a map, provide a ssh trampoline for me and some friends and not much more. This time I decided to tackle one of the most annoying problems I had with it: That closing the lid led to the system to suspend.

Now, the setup in that computer has evolved through some years, so a lot of cruft was left on it. For instance, at some point I solved the problem by installing a desktop and telling it not to suspend the machine, mostly because that's how I configure my current laptop. That, of course, was a cannon-for-killing-flies solution, but it worked, so I could focus in other things. Also, a lot of power-related packages were installed, assuming the were really needed for supporting everything I might ever wanted to do about power. This is the story on how I removed them all, why, and how I solved the lid problem... twice.

First thing to go were the desktop packages, mostly because the screen in that laptop has been dead for more than a year now, and because its new space in the house is a small shelf in my wooden desktop. Then I reviewed the power-related packages one by one and decided whether I needed it or not. This is more or less what I found:

  • acpi-fakekey: This package has a tool for injecting fake ACPI keystrokes in the input system. Not really needed.
  • acpi-support: It has a lot of scripts that can be run when some ACPI events occur. For instance, lid closing, battery/AC status, but also things like responding to power and even 'multimedia' keys. Nice, but not needed in my case; the lid is going to be closed all the time anyways.
  • laptop-mode-tools: Tools for saving power in your laptop. Not needed either, the server is going to be running all the time on AC (its battery also died some time ago).
  • upower: D-Bus interface for power events. No desktop or anything else to listen to them. Gone.
  • pm-utils: Nice CLI scripts for suspending/hibernating your system. I always have them around in my laptop because sometimes the desktops don't work properly. No use in my server, but it's cruft left from when I used it as my laptop. Adieu.

Even then, closing the lid led to the system suspending. Who else could be there? Well, there is one project who's being everywhere: systemd. I'm not saying this is bad, but it is everywhere. Thing is, its login subsystem also handles ACPI events. In the /etc/systemd/logind.conf file you can read the following lines:

#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore

so I uncommented the 4th line and changed it so:

HandleLidSwitch=ignore

Here you can also configure how the inhibition of actions work:

#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes

Please check the config file's doc if you plan to modify it.

Not entirely unrelated, my main laptop also started suspending when I closed the lid. I have it configured, through the desktop environment, to only turn off the screen, because what use is the screen if it's facing the keyboard and touchpad :) Somehow, these settings only recently started to be in effect, but a quick search didn't gave any results on when things changed. Remembering what I did with the server, I just changed that config file to:

HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

That is, “let me configure this through the desktop, please”, and now I have my old behavior back :)


PS: I should start reading more about systemd. A good starting point seems to be all the links in its home page.


sysadmin systemd acpi

Marcos Dione: dear-conference-speakers

Dear conference speakers:

Please test write your slides at 1024x768 resolution, on a projector.

Dear conference organizers:

Please remind your speakers to do so.

Dear conference attendants:

If you are at the back of the room and you can't see the text/code in the slides the speaker(s) is showing, please shout “I cant see shit!” in the appropriate language, and try to embarrass the speaker as much as possible.

Thanks in advance. Yours truly,

-- Marcos.

PS: I've been watching videos of talks in some conferences and I swear to $DEITY at in least 40% of the ones I was interested in, I couldn't read the code on the video. Sometimes the fonts are too small, sometimes the colors are not contrasting enough. Please, at least test your slides on a projector...

PSS: I know the resolution I'm suggesting is low. Be happy I'm not asking for 640x480 :-P

PSSS: Ok, attendants, don't embarrass/harass the speakers :)


rants

Mariano Guerra: This Week in WebAssembly II

Juanjo Conti: Goodreads review: Yo también tuve una novia bisexual (Guillermo Martínez)

El libro tiene 3 partes.

La primera es muy buena.

En la segunda hay un par de capítulos que podrían haber sido omitidos. Referencias: la teoría sobre "refinamientos dicotómicos", aquel en el que se menciona a Sarmiento.

En la tercera decanta hacia final, cerrando muchos caminos. Aunque me faltó la explicación de porqué no manejaba.

Las referencias al 9/11 tampoco son cruciales.

El epílogo es un poco perturbador.

No es tan buena como Crímenes imperceptibles. Creo que lo que me gustó tanto de esta otra es que no le encontré fisuras mientras que en esta pude hacer en ejercicio de reconocer algunas grietas.

Rating: 4/5

Original: https://www.goodreads.com/review/show/1730970828

Marcos Dione: interesting-pycon-talks

Like I said in my last post[1], I'm looking at last PyCon's videos. Here are my selected videos, in the order I saw them:

Ned Batchelder - Machete-mode debugging: Hacking your way out of a tight spot. In fact, I saw this twice.

Larry Hastings - Removing Python's GIL: The Gilectomy

The Report Of Twisted’s Death or: Why Twisted and Tornado Are Relevant In The Asyncio Age

How I built a power debugger out of the standard library and things I found on the internet

Davey Shafik - HTTP/2 and Asynchronous APIs

Sumana Harihareswara - HTTP Can Do That?! Points for informative and funny.

Matthias Kramm - Python Typology Types are comming, so get used to them.

Scott Sanderson, Joe Jevnik - Playing with Python Bytecode Nice, very nice trick. I'm talking about the way the presentation is given.

Brian Warner - Magic Wormhole - Simple Secure File Transfer

And of course, the lighning talks. I always like these, because you can get exposed to any kind of things, some not even remotely connected to Python, but which can get your brain rolling down nice little bunny holes, or at least get a smile from you. So here:

LT#1. Please watch it at least between 20-25m.

LT#2

LT#3

LT#4

And of course, check the other ones, don't stop at my own interests.


[1] Yes, I started writing this a month ago.


python

Facundo Batista: Terminator moralinesco


AVISO: el siguiente texto puede tener spoilers sobre las pelis de Terminator. Yo te avisé.

No voy a entender nunca como en una película permiten violencia, violencia, violencia, violencia, violencia, y no un desnudo.

Y no estoy hablando de sexo, estoy hablando de cuerpos desnudos. Y ni siquiera estoy hablando de una película para niños (que lo podríamos charlar), sino para adultos (toda esa violencia es inaceptable para niños).

El caso puntual es Terminator: Genisys.

Hay varias situaciones, varias, donde el desnudo sería natural. Me refiero a que no es como se ve mucho en esas pelis clase B donde el asesino en vez de matar a la chica durmiendo la mata en la ducha y aprovechan para mostrarla en tetas.

No. En el caso de Terminator, el aparato que usan para moverse en el tiempo sólo lleva cosas cubiertas de material biológico (sí, la base científica de esto es discutible, pero ese es otro tema). Entonces, los humanos (todo biológicos) y robots (estructura artificial pero todos cubiertos de piel "viva") tienen que viajar desnudos.

Por dicha razón, sucede que en la Terminator original sí se ve algo: por ejemplo el culo del terminator...

El terminator de 1984, desde atrás

Pero vemos que en la nueva, que reproduce lo que pasó en la primera (con los cambios necesarios acorde a la vuelta de tuerca del guión), en la misma escena, ¡no muestra nada!

El terminator nuevo, desde atrás

También, en la original Kyle y Sarah se enamoran y tienen sexo (escenas muy ochentosas, pero con desnudos frontales de ambos). En la última los dos personajes se mantienen coqueteando pero sin concretar, prolijamente castos.

Los Kyle y Sarah originales

En la última hay una chica con papel protagónico que viaja en el tiempo. Acá tenemos una situación donde un desnudo sería totalmente natural, y la cámara está "forzadamente alta".

Cuidando la altura de la cámara

Incluso, cuando termina ese viaje en el tiempo, al "llegar al futuro", aparecen en una autopista y casi los pasan por arriba, pero sí: el foco está en taparse, no vaya a ser cosa.

Apareciendo en la autopista

Como vuelta de tuerca, ¿se podría argumentar que a Emilia Clarke le cueste o no quiera aparecer desnuda? No creo, muestra mucho más como Daenerys Targaryen en Game of Thrones.

También podemos pensar que a una película le resulte más complicado distribuirse y hacerse disponible en muchos paises o lugares en función de si muestran una teta o no. Puede ser. Ahí volvemos a que "asusta" o "indigna" más una teta o un culo que gente matándose entre ellos. Y ni hablar de un pene o una vulva... la escena siguiente es de la peli nueva, pero en la vieja es igual...

El terminator, desde adelante

En fin, no entiendo.

Mariano Guerra: This Week in WebAssembly I

(Hopefuly) weekly update on WebAssembly and WebAssembly related projects

Resources

Marcos Dione: ayrton-0.8-Home-Sweet-New-Home

Long time for this release. A couple of hard bugs (which fix was just moving a line down a little), a big-ish new feature, and moving in a new city. Here's the ChangeLog:

  • You can import ayrton modules and packages!
  • Depends on Python3.5 now.
  • argv is not quite a list: for some operations (len(), iter(), pop()), argv[0] is left alone.
  • option() raises KeyError or ValueError if the option or its 'argument' is wrong.
  • makedirs() and stat() are available as functions.
  • -p|--pdb launches pdb when there is an unhandled exception.
  • Fix for line in foo(...): ... by automatically adding the _bg=True option.
  • Better Command() detection.
  • A lot of internal fixes.

Get it on github or pypi!


python ayrton

Juanjo Conti: Goodreads review: Crímenes imperceptibles (Guillermo Martínez)

Muy bueno.

Lo considero una continuación de otra novela del autor: Acerca de Roderer. Y la supera en varios cuerpos.

Uno de los detalles más brillantes es que en varias partes de la novela, cuando se habla de los crímenes, se está hablando en realidad del libro.

La próxima novela del autor que pienso leer es Yo también tuve una novia bisexual. Libro que sospecho como una tercera parte de estas historias donde confundo al autor con el protagonista.

UPDATE: vi la película. La novela es superior en todos los aspectos excepto en uno. SPOILER ALERT. Cuando leen el perfil psicológico del asesino, se da a entender que el protagonista es sospechoso y que lo hace como una forma de cortejo hacia el matemático Seldom. Es muy divertido.

Rating: 4/5

Original: https://www.goodreads.com/review/show/1727226022

Mariano Guerra: Ricardo Forth: a Forth implemented in C, JS, WebAssembly and compiled from C to asm.js and WebAssembly

It comes a time in the life of everyone when you implement a Forth.

The time has come for me.

Presenting Ricardo Forth:

A Forth dialect implemented in C, Javascript, WebAssembly and compiled from C to asm.js and WebAssembly.

This project is based on the 1992 IOCCC entry buzzard.2 (design notes: buzzard.2.design), prettified and then compiled to:

Also reimplemented by translating the C code into Javascript and WebAssebly.

Go check it out if you are curious about asmjs, WebAssembly, Forth or Emscripten/Binaryen.