z·eeki·sh

tech log on gentoo, linux, and random stuff

restoring startx behavior after upgrading to xorg-server 1.16

leave a comment »

Arch Linux has been imposing an increasing maintenance toll as of late. Many of the changes now feel more like creating solutions so people have problems to work out.

Anyway, after upgrading to xorg-server 1.16, startx stops working, with error messages “cannot open virtual console” and “systemd-logind: failed to get session“. To restore old startx behavior, create a file “/etc/X11/Xwrapper.config” with content

allowed_users = anybody
needs_root_rights = yes

See the man page of “Xwrapper.config” for more information

Written by zsh

July 29, 2014 at 12:27 pm

Posted in /etc

Tagged with

sed one-liner for extracting pictures included in a tex file

leave a comment »

When writing up tex manuscripts, I usually put related data/function plots under the same directory as the tex file, or some sub-dir like ‘figs/’. Often times though, many of them are never actually used in the tex file. while I have no problem with cluttering up my folders with unused plots, it is quite painful when you need to pick out those used plots, for example when tar-balling them to share with a colleague or submit it to some journal. Here is a one-liner to extract a list of used plots in a tex file:

sed -n 's/[^%]*includegraphics[^{]*{\([^}]*\)}.*/\1/p' draft.tex

NB:

  1. draft.tex is the desired tex file from which to extract the list of figures.
  2. The -n tells sed to suppress printing unless instructed to (which will be effected by the tailing /p.
  3. The [^%] will skip plots commented out.

Here is the shell command to generate a tarball containing all necessary files:
tar -cvvzf draft.tgz draft.tex *bbl *bst $(for f in `sed -n 's/[^%]*includegraphics[^{]*{\([^}]*\)}.*/\1/p' draft.tex`; do echo `basename $f .pdf`.pdf; done)

Written by zsh

January 20, 2013 at 11:42 am

Posted in /usr/bin

Tagged with , , ,

actkbd and screen rotation in archlinux

leave a comment »

actkbd is in AUR. I need it so the tablet keys on X220 tablet can serve more use (e.g., differentiate between long and short press, etc.)

In order for the rotation script triggered by actkbd to be able to communicate with X, we need to start actkbd with the DISPLAY=:0 environment variable. The AUR package created the /etc/rc.d/actkbd entry. Just change

[ ! -f $PIDFILE ] && /usr/sbin/actkbd -D -q -p $PIDFILE

to

[ ! -f $PIDFILE ] && DISPLAY=:0 /usr/sbin/actkbd -D -q -p $PIDFILE

Written by zsh

February 20, 2012 at 2:40 pm

Posted in no cat is good cat

Tagged with , , ,

dd-wrt ssh port forwarding quirky

leave a comment »

I guess it is more of a web-gui quirky. Anyway, here is what I desire: I want to move the ssh port of the router itself to say 9999, and forward port 22 to a workstation connected to the router.

What I did, which is wrong:
1) dd-wrt -> services -> services: change port of ssh to 9999
2) dd-wrt -> NAT/QoS -> port forwarding: add port from 22 to workstation-ip:22

What I now have, which is correct thanks to this post, is:
1) dd-wrt -> services -> services: change port of ssh back to 22
2) dd-wrt -> NAT/QoS -> port forwarding: add port from 22 to workstation-ip:22
3) dd-wrt -> administration -> management: change [ssh remote port] to 9999

Written by zsh

February 17, 2012 at 12:27 pm

Wacom Bamboo Create (CTH670) on linux

leave a comment »

Apparently the xf86-input-wacom driver is not enough: one has to manually build the kernel module (for kernel version <= 3.2)

1) get input-wacom driver here: http://sourceforge.net/projects/linuxwacom/files/xf86-input-wacom/input-wacom/
2) unpack and run ./configure. Pay attention to the installation instructions at the end of ./configure output
3) copy kernel modules to /lib/modules/ as instructed.
4) modprobe wacom and enjoy

Written by zsh

February 15, 2012 at 10:53 pm

MKL FATAL ERROR /path/to/libmkl_def.so: undefined symbol: i_free

leave a comment »

I started fooling around with python/scipy with the intention of replacing ruby/gsl. Came across this very weird error.

Minimal script to reproduce: invoke ipython -pylab, then in it,

In [1]: from scipy import *

In [2]: a=zeros(1000); a[:100] = 1; b = fft(a)

In [3]: plot(abs(b))

and ipython spits out the titled error.

Found a solution here: before running ipython,
export LD_PRELOAD=/opt/intel/mkl/10.0.5.025/lib/32/libmkl_core.so

apparently, some symbols are defined in libmkl_core.so instead of libmkl_def.so.

Written by zsh

February 5, 2012 at 1:35 am

Posted in no cat is good cat

Tagged with , , ,

stripping url output from bibtex

leave a comment »

The bibliographical information as supplied by journals usually includes a URL field, and bibtex styles like \bibliographystyle{apsrev} will export the URL field in the resulting .bbl file, very nagging to some of us. One way to get rid of these URL links is to use a customized .bst file, e.g.,

  1. locate apsrev to find where the apsrev.bst file is.
  2. cd to the directory, and invoke grep -v 'format.url output' apsrev.bst > your/manuscript/directory/apsrev-no-url.bst to create a no-url version of the bst file in your manuscript directory (or any other directory in the search path of bibtex).
  3. now, in your manuscript, replace \bibliographystyle{apsrev} with \bibliographystyle{apsrev-no-url}

Written by zsh

January 4, 2012 at 4:19 pm

Posted in /etc

Tagged with , , ,

Follow

Get every new post delivered to your Inbox.