jueves, 25 de octubre de 2012

HTTP status codes explained in IRC

*p1 is sending GET request since 2001
[p1] and still no response
[p2] 422
[p3] ETOOLONGTIMEOUT
[p3] malformed bitch
[p3] ah no, unprocessable
[p1] i don't do that sick stuff
[p3] unprocessable bitch
[p1] girls quite often reply with 403
[p1] if it doesn't help, they go 404
[p1] some even try 300 to their friend which is very pathetic
[p3] trying to DDOS

martes, 16 de octubre de 2012

VPNs explained in IRC



[p1] meth. I've told you
[p2] lovely
[p2] it's like a VPN
[p2] you're comunicating where others just see noise
[p3] lol
[p3] that's a great quote
[p2] the guys from the other side of the vpn told it to me


domingo, 14 de octubre de 2012

github -> emacs : org-protocol-github-lines

Hello emacsers,

Today I'd like to present a hack I've assembled after being tired of going from github page to emacs looking for a given file/line repeteadly.

Say you collaborate in a project that's hosted in github, and you issue a pull request. If the team is minimally careful, someone will look at your code, and comment on it, pointing conventions you didn't follow, or pointing to buggy code you didn't notice you were introducing. At work, we are continuously doing comments in others pull requests as its part of our workflow.

So, wouldn't it be nice to have a custom button that opens your favourite editor in the correct file and line you're just staring at, but in your browser? Ok, that's what this hack is for.  The puzzle has 3 parts:

Browser

 When you check the pull request someone commented, you normally see something like the following.
 



Then you normally look at the file name, the line and the comment, and try to remember the three pieces of info, go to your editor, fetch the file, line and do the appropiate modifications.


Well, with org-protocol-github-lines  (yeah, the name sucks), you'll be presented with this: 
And the new link will point to "org-protocol://github-comment://kidd/org-protocol-github-lines/org-protocol-github-lines.el/28" .  This is done via a simple chromium userscript. (Alert, I suck at js, it's a complete hack)

Operating System

The second part of the puzzle is teaching your OS that org-protocol:// URIs should be opened with emacsclient. After trying some methods I found on internet and being unable to make any of those working, I went for the naive approach of copying xdg-open to my ~/bin directory, and patch it accordingly to open org-protocol:// URIs with emacsclient.  The complete xdg-open is in the git repo.

Emacs

And the last thing is the elisp part. when emacs receives an uri starting with org-protocol, you can use some org-protocol helpers to decode the parameters and such. The relevant info is in the org-mode page.

There's an alist called org-protocol-projects that you should modify to map "user/repo" -> "path/to/the/root/of/the/repo/(local)" .

And here's a video that shows the whole thing in action.


Demo of org-protocol-github-lines emacs plugin from Raimon Grau on Vimeo.

If you find more places where it makes sense to add those links, or have anything to coment, please use the comments here, or github issues, or find me in #emacs and #emacs-es as rgrau or rgc.


Clone it from https://github.com/kidd/org-protocol-github-lines

lunes, 8 de octubre de 2012

Race conditions explained in IRC.

[j] morning
[j] que hora es?
[m] 8
[t] +1
[j] 9
[rgrau] 9
[t] ah ah
[rgrau] oh, racecondition

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.

sábado, 4 de agosto de 2012

Back to Vec


  If you've followed this blog, or you know me, you know I've been a
   vectorlinux user and collaborator for a few years.  Lately, I didn't
   use it and favoured Ubuntu and Arch. The change was done because I
   needed packages that weren't in the official vl repos, and were not
   trivial to build. And was lazy.

   After 1 year (more or less) I found another opportunity for vl, and
   I have to say I'm happy to have tried it.

Installing vectorlinux

   I'm using a Lenovo thinkpad X61, and it doesn't have CD, so the way
   to get a linux running there is booting through an usb drive.
  
   I used unetbootin + VL light 7.0, and found the first
   issue. There's some missmatch between unetbootin versions and vl
   image format, and my unetbootin left the boot image in
   isolinux/kernel/sata instead of /syslinux/kernel/sata . Just
   copying the directory to the other place solved the booting issue.


Booting

   As usual, everything worked as expected, no glitches, and all
   configs did their job.

Packages

   After installing a linux distro, first thing to do is installing
   the 'must have' apps.
  
   - edit /etc/slapt-get/slapt-getrc and enable a few more repos
   - slapt-get --update
   - slapt-get -i ratpoison

   Nice we have 1.4.5 there :). Then, let's go for emacs. OOps,
   there's just emacs 23.X in the repo.

   As a side note, I have to say that besides not having used vl for a
   year, I kept an eye on the irc channel, and I've kept in touch (and
   sometimes giving a hand or opinion in vl projects) with rbistolfi 
   (one of the devs).

   Long story short. After pinging rbistolfi and asking for emacs
   24.1, I had a working package in 30 minutes. And the effort is not
   lost, but all the work is prepared to be pushed to the repos.
  
   While doing my usual instalations, I found some missing packages in
   the repo, so asked for a way to contribute back. You know, I wrote
   the package that vl still uses to build packages, but now I see the
   workflow is much more streamlined. See it in the NEXT POST (NIY).

Early opinion

The first impression is that the whole system is faster than ubuntu. As always, the package selection is really nice, and not having to install 5 related  -dev packages but just one when I need a feature is really confortable.

I already comited a couple of packages to the repo, and found some bug in sbbuilder that I'll try to tackle this weekend.

Vectorlinux, I'm back!