<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet title="CSS_formatting" type="text/css" href="http://www.interglacial.com/rss/rss.css"?>
<!-- name="generator" content="loathsxome/0.99" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91"><channel>
<link>http://blog.xvx.ca</link><title>awg's blog</title>
<description>Rarely Used.</description><language>en</language>

<item><title>Connecting IPv6 Clients to IPv4 Services</title><link>http://blog.xvx.ca/connecting-ipv6-clients-to-ipv4-services</link><description>
&lt;p&gt;
I&apos;ve been playing with IPv6 lately.  My home computer, my laptop, and this
server all have IPv6 addresses through &lt;a
href=&quot;http://www.tunnelbroker.net&quot;&gt;Hurricane Electric&apos;s tunnelbroker.net&lt;/a&gt;,
I&apos;ve been using the IPv6 addresses for SSH, and I&apos;ve made all my webpages
available on IPv6 (the IPv6 version of my blog is at &lt;a
href=&quot;http://blog6.xvx.ca&quot;&gt;blog6.xvx.ca&lt;/a&gt;).  It&apos;s fun to play with, and
ultimately we&apos;ll all be using it anyway.
&lt;/p&gt;

&lt;p&gt;
Some daemons, though, don&apos;t support IPv6 (yet).  To remedy this, I&apos;ve created
6translator, a daemon that shuffles data between IPv6 clients and IPv4 services.
You can &lt;a href=&quot;http://xvx.ca/6translator&quot;&gt;download it from here&lt;/a&gt; and try it
out.
&lt;/p&gt;
</description></item>
<item><title>Installing Debian Packages Locally</title><link>http://blog.xvx.ca/installing-deb-packages-locally</link><description>
&lt;p&gt;
My department is planning to install Ubuntu on all our lab machines, and
probably take away sudo access from everyone who doesn&apos;t truly need it (i.e.
anyone who isn&apos;t a sysadmin).  I&apos;m looking forward to having Ubuntu, but it&apos;s
less useful if I can&apos;t install the software I want with apt-get.  Thus, I started
wondering whether it&apos;s possible to install Debian packages in a non-standard
location, without being root.
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;dpkg&lt;/code&gt; has a &lt;code&gt;--root&lt;/code&gt; option that lets you change the
installation prefix, but it still won&apos;t let you install anything without being
root.  &lt;code&gt;apt-get&lt;/code&gt; will fetch packages, but, again, only as root.  So I
figured I&apos;d write a script to do it all.
&lt;/p&gt;

&lt;p&gt;
The &lt;a href=&quot;http://xvx.ca/~awg/install_local.sh.txt&quot;&gt;script is here&lt;/a&gt;.  It
takes as arguments either the name of a package (like you&apos;d pass to &lt;code&gt;apt-get
install&lt;/code&gt;) or the filename of a .deb, and the prefix to which you&apos;d like to
install it.  It fetches dependencies (and the package itself if necessary),
then unpacks the debs and installs them.  I&apos;m planning to use it in combination
with &lt;a href=&quot;http://www.gnu.org/software/stow/&quot;&gt;stow&lt;/a&gt; to install packages to
&lt;code&gt;$HOME/.local&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;Caveats:&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;If you install more than one package with the same dependency, that
dependency will be installed more than once.  This will cause problems with
stow.  Hopefully common dependencies are already installed on your system.&lt;/li&gt;
&lt;li&gt;It only installs one level of dependencies, so the dependencies might be
missing dependencies, causing things not to work.&lt;/li&gt;
&lt;li&gt;There is probably some terrible bug I don&apos;t know about.  Let me know if you
find one!&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description></item>
<item><title>New Blog Software</title><link>http://blog.xvx.ca/new-blog-software</link><description>
&lt;p&gt;I used to use &lt;a href=&quot;http://www.blosxom.com&quot;&gt;Blosxom&lt;/a&gt; for my blog. It&apos;s
a nice system in that it stores your posts in text files, and displays them in
multiple views automatically.  No database and no PHP required.&lt;/p&gt;
&lt;p&gt;Recently, I found &lt;a href=&quot;http://toroid.org/ams/loathsxome&quot;&gt;Loathsxome&lt;/a&gt;,
which is like Blosxom but with some improvements (and a better name).  I&apos;m now
using it, plus git for wrangling metadata, for this blog and my &lt;a
href=&quot;http://research.xvx.ca&quot;&gt;new research log&lt;/a&gt;.  I&apos;m quite happy with this
setup.&lt;/p&gt;
</description></item>
<item><title>Sending Keystrokes to Applications in Linux (Programatically)</title><link>http://blog.xvx.ca/sending-keystrokes-to-applications</link><description>
&lt;p&gt;Lately I&apos;ve been using the &lt;a href=&quot;http://awesome.naquadah.org/&quot;&gt;Awesome window manager&lt;/a&gt;, a simple dynamic window manager based on &lt;a href=&quot;http://dwm.suckless.org/&quot;&gt;dwm&lt;/a&gt;.  It&apos;s great, but it seems to fight with imwheel, which I&apos;ve long used to map my mouse&apos;s thumb buttons to page-up and page-down.  I wondered: why is there no reasonable imwheel alternative?&lt;/p&gt;

&lt;p&gt;I tried xrebind and xnee, but it wasn&apos;t easy to get either to do what I wanted.  I realized that Awesome has a built-in mouse binding support, but doesn&apos;t have a way to send keystrokes to client applications.  So, I ended up figuring out a little C program that sends a keystroke to the focused client, and telling Awesome to run the program with the appropriate argument when the mouse thumb buttons are pressed.&lt;/p&gt;

&lt;p&gt;Here&apos;s the &lt;a href=&quot;http://xvx.ca/~awg/sendkey.c&quot;&gt;C code&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;X11/extensions/XTest.h&amp;gt;

int main(int argc, char **argv) {
	int keycode;
	Display *dpy = XOpenDisplay(NULL);
	if (!dpy) return 1;

	keycode = atoi(argv[1]);
	
	XTestFakeKeyEvent(dpy, keycode, 0, CurrentTime);
	XCloseDisplay(dpy);
	return 0;
}
&lt;/pre&gt;

&lt;p&gt;And here&apos;s the Awesome config:&lt;/p&gt;

&lt;pre&gt;
mouse
{
        client
        {
            button = &quot;8&quot;
            command = &quot;spawn&quot;
            arg = &quot;exec /home/adam/.local/bin/sendkey 117&quot;
        }
        client
        {
            button = &quot;9&quot;
            command = &quot;spawn&quot;
            arg = &quot;exec /home/adam/.local/bin/sendkey 112&quot;
        }
}
&lt;/pre&gt;

&lt;p&gt;Perhaps someone else will find this useful (or integrate it into Awesome).&lt;/p&gt;
</description></item>
<item><title>Typesetting MIPS Assembly Code in LaTeX</title><link>http://blog.xvx.ca/typesetting-mips-assembly-with-latex</link><description>
&lt;p&gt;
I&apos;m TAing an introductory architecture course this term, and for each lab assignment
I need to present some material in the lab.  Since the course is taught with MIPS (using SPIM),
my presentation slides sometimes need to contain MIPS assembly language.  I use LaTeX and &lt;a href=&quot;http://latex-beamer.sourceforge.net/&quot;&gt;Beamer&lt;/a&gt;
for my slides, so naturally I turned to the listings package to typeset my code.
&lt;/p&gt;
&lt;p&gt;
As it turns out, though, listings doesn&apos;t include a MIPS assmebly language definition,
so while it will happily typeset the code, it won&apos;t do any sort of syntax hilighting.
&lt;/p&gt;
&lt;p&gt;
So, I created a &lt;a href=&quot;http://xvx.ca/~awg/mips.sty&quot;&gt;language definition for MIPS&lt;/a&gt;.  This definition treats all the directives and
instructions supported by SPIM (including pseudoinstructions) as keywords, so listings
will format them as such.
&lt;/p&gt;
&lt;p&gt;
See the &lt;a href=&quot;http://www.ctan.org/tex-archive/macros/latex/contrib/listings/&quot;&gt;listings package documentation&lt;/a&gt; for
how to use this style file.  An &lt;a href=&quot;http://xvx.ca/~awg/mips-example.tex&quot;&gt;example&lt;/a&gt; is:
&lt;/p&gt;
&lt;pre&gt;
\documentclass{article}

\usepackage{listings}
\usepackage{mips}

\begin{document}
\lstset{language=[mips]Assembler}
\begin{lstlisting}
	.text
main:
	# I&apos;m going to output a string.
	li $v0, 4
	la $a0, mystr
	syscall

	# Bye!
	li $v0, 10
	syscall

	.data
mystr:
	.asciiz &quot;This is my string. All mine!\n&quot;
\end{lstlisting}
\end{document}
&lt;/pre&gt;
</description></item>
</channel></rss>
