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...
Affichage des articles dont le libellé est trick. Afficher tous les articles
Affichage des articles dont le libellé est trick. Afficher tous les articles
lundi 3 décembre 2012
samedi 18 février 2012
inspect variables in python pdb
As far as I can search pdb does not provide a command to show the local state. But the python interpreter provides vars() and locals(), which are almost identical btw, and they seem to work in pdb too.
Combine vars() or locals() with the `pp` pdb command to watch them all at once.
Combine vars() or locals() with the `pp` pdb command to watch them all at once.
Inscription à :
Articles (Atom)