Laurie Santos berättar om ett experiment där hon och hennes kollegor introducerar en slags valuta hos labbaporna. Frågan var om aporna tenderar att begå samma slags ekonomiska misstag som vi människor. Ungefär tio minuter in börjar det bli riktigt roligt. Jag känner igen mig.
I often find myself in the somewhat cumbersome situation that a currently running ssh session stops responding, often due to a lost connection. The normal ctrl+c of course doesn’t work, the ssh client catches all the usual commands, which is very handy while you are still connected to the host but not very handy at all in this case.
My usual approach has been to switch to another terminal window or shell and then killing the process in question. Today I happened to be skimming through the ssh client’s man page and I found a section about escape characters. Suddenly I gazed upon the glory of the disconnect key sequence: a newline followed by ~.. It works like a charm. As always, I thought I should share.
I’m still learning new stuff in Emacs every day. It’s probably one of the main reason why Emacs is my favourite text editor; it’s just plain fun.
I happen to know a little Lisp, which come in handy sometime. Changing or extending the behavíour of a program is seldom easy, fun or even productive. Emacs is of course an exception. Once you know the basics you can do pretty much whatever comes to mind.
Today I made my first attempt at building an “interactive” function. A function that you can run by entering M-x function-name, that is. It’s called facebook-log-fix and I needed it because I really like saving my online conversations. Pidgin does this for me most of the time but when I chat on Facebook I need to save them myself. The problem is that Facebook’s stylesheets takes care of the layout of the chat, so when you simply copy the conversation to a text editor it gets all jumbled up. This simple little function takes care of this for me. Maybe you’ll like it, or just learn something about how to modify Emacs a little. Please tell me if you have got any suggestions for improvements — I’m a pretty big noob when it comes to lisp and Emacs.
Here it goes, just paste it into your .emacs file or whatever.
(defun facebook-log-fix nil"Make proper adjustments to a cut'n'pasted Facebook chat"(interactive); make the function available to the user(message"Trying to cleanup Facebook chat")(save-excursion; restore stuff (point, mark and current buffer) when done; Fancy regexp: (name)\n((anything+\n)*?[non-greedy])(time of day)(replace-regexp"\\(.*?\\)\n\\(\\(?:.*\n\\)*?\\)\\([0-9][0-9]:[0-9][0-9][a|p]m\\)""\\3 \\1 \\2\n"nil0(buffer-size))))
När jag var tolv år gammal insåg jag en sak. Jag insåg att livet oundvikligen kommer att innebära en rad besvikelser, sorger, förluster, misslyckanden, katastrofer och misstag.
När jag var sexton år gammal insåg jag en sak. Jag insåg att allt som är vackert och bra oundvikligen kommer att ta slut på ett eller annat sätt.
När jag var tjugotre år gammal insåg jag en sak. Jag insåg att ett slut även kan vara en början.
När jag var nästan tjugofem år gammal insåg jag en sak. Jag insåg att ju hårdare man anstränger sig för att inte halka omkull, desto mer gör man illa sig när man väl tappar fotfästet.