Sunday, 23 September 2012

Adjusting console column width number in R.

options(width=Sys.getenv("COLUMNS"))


It may be put in ~/.Rprofile to initialize during startup, but the Squeeze version (2.11.1) seems to be bugged out and does not work. My attempt in being a smartass

options(width = system("echo $COLUMNS", intern = TRUE))

does not work either.

Sunday, 2 September 2012

Finding kanji I haven't studied yet in my main deck



Present in Heisig:

鼠汰闇鼈雛韮

sqlite3 ~/.anki/decks/Japanese.anki 'select * from facts'|sed -E 's/(.)/\1\n/g'|sort|uniq > /tmp/used_kanji && for kanji in `sqlite3 -header ~/.anki/decks/Heisigs\ Remember\ the\ Kanji\ \(RTK\)\ 13.anki 'select value from (select * from cards left join facts on facts.id=cards.factid where type=-1) as t left join fields on t.factid=fields.factid where fieldmodelid=(select id from fieldmodels where name="Kanji")'`; do grep -F $kanji /tmp/used_kanji|tr -d '\n' ; done ; echo; rm /tmp/used_kanji

Any:

汰薤辣鐶闇雛韭韮鼈鼠

sqlite3 -header ~/.anki/decks/Heisigs\ Remember\ the\ Kanji\ \(RTK\)\ 13.anki 'select value from (select * from cards left join facts on facts.id=cards.factid where type!=-1) as t left join fields on t.factid=fields.factid where fieldmodelid=(select id from fieldmodels where name="Kanji")' > /tmp/unlocked_kanji; for kanji in $(sqlite3 ~/.anki/decks/Japanese.anki 'select * from facts'|sed -E 's/(.)/\1\n/g'|sort|uniq|grep -v '*'); do if ! grep -qF "$kanji" /tmp/unlocked_kanji; then echo $kanji; fi ; done |tr -d '\n'; echo; rm /tmp/unlocked_kanji

Obsoletee! Obsoletee! With Anki 2.0!