sábado, 22 de septiembre de 2012

the gif is dead, long live the gif

Just a couple of funny links I read last week on gifs, and embeded animations on the web.

Here's a library that uses animated gifs as a way to comunicate with browsers. gifsockets is written as a joke o proof of concept, but anyway the idea is cool.

In the last days, after the presentation of the iPhone 5, there was also some discussions around on how and why they managed to put an animation on that website that would be playable in all devices, and would be high quality and wouldn't weight too much. It's funny how we have to fight the same old problems daily, and there's no fixed solution.

<rant> New platforms are so flaky that they don't even try to comply the standards, and they evolve from naive patch to naive patch to solve immediate problems, making them more and more appart one from the other. Everything is fucking broken, and you have to be an expert even to put a short animation online. And Apple is not the only one doing these tricks.  That same hack has been used for many others. SublimeText, for example also used this trick. Very clever, but fuck, that's not blackbox abstraction, when You have to think about how your animation will be encoded when doing a web.</rant>


Well, and the appropiate HN pages, just in case you wanna dive into the comments.







martes, 18 de septiembre de 2012

emacs checking your temperature

Yesterday I was on my laptop, with the usual tools opened (that means emacs, urxvt+screen and chromium-browser).Nothing strange. I went out for a rollerskating session with a couple of friends and when I came back, the laptop was awfully warm. I mean, keyboard really hot, and when I took the laptop on my hands, it was freaking hot. Luckily it didn't melt :).  A quick glance at top(1) showed that chromium was taking all the cpu, and a big amount of memory. probably some js, who knows.

Just killing the offensive process made my little old thinkpad come back to normal temperature.

Then, to make sure it doesn't happen again, I wrote a little elisp script to warn me in case my lappy is warming beyond acceptable limits. Or even kill chromium-browser in case the temperature is >95C.

So here's the  code. Checking the temperature of the cpu, and acting if needed.

;;; raimonster@gmail.com
; The array returned by battery-statys-function => '((99 . "25330") (76 . "on-line") (100 . "54") (114 . "0 mW") (66 . "charged") (98 . "") (104 . "0") (109 . "0") (116 . "0:00") (112 . "97"))

(defun rgc-check-for-hotness ()
  (interactive)
  (let ((temp (string-to-number
                (cdr (assq (string-to-char "d")
                           (and battery-status-function (funcall battery-status-function)))))))

    (cond ((> temp 95) (async-shell-command "killall -9 chromium-browser"))
          ((> temp 75) (message "FUCK! I'M HOT"))
          (t (message "ok, no problemo")))))

(defvar rgc-hot-timer nil "timer")

(defun rgc-hot-hot-hot ()
  (interactive)
  (setq rgc-hot-timer
        (run-at-time nil (* 60 5) 'rgc-check-for-hotness)))

(defun rgc-stop-hot-checker ()
  (interactive)
  (cancel-timer rgc-hot-timer))
As always in this blog, no rocket science, but (hopefully) useful bits of elisp.