Multiuser screen

June 15th, 2011 § 0 comments § permalink

To make a screen multiuser:

-a : multiuser on

You can also include _multiuser on_ in .screenrc to make all screens start multiuser

Then you connect to it with screen -x

email over ssh/socks with evolution (to dodge wifi cafe firewall)

December 1st, 2010 § 0 comments § permalink

I’ve just been working in a cafe whose wifi blocks outgoing email. So I had to figure out how to send mail through an ssh tunnel. That is, hussle it through the firewall by sending it encrypted to a server elsewhere, and send the email outgoing from there.

For future reference, and in case it’s useful to anybody else, here’s how. This is assuming you are running ubuntu on your own machine, and have ssh access to a server somewhere else that’s capable of sending mail.

We use ssh to set up a SOCKS proxy, over an ssh tunnel. This establishes a port on the local machine (here, port 1234). any traffic sent through that port will emerge from the server at the other end:

ssh -D 1234 username@server.net

Now, install tsocks. This lets you run another program, with all outgoing connections sent via SOCKS

sudo apt-get install tsocks

configure tsocks to use the tunnel you’ve set up

sudo vim /etc/tsocks.conf

look for the default server settings, at the bottom. Edit so that:


server = 127.0.0.1
server_port = 1234

Now start your mail program under tsocks

tsocks evolution 

In order to make external mail sending work under this setup, I had to turn off TLS in evolution. I’m not sure if this is a problem inherent to the socks/ssh setup, or just with my particular situation.

more info: http://ubuntuforums.org/showthread.php?t=791323

finding and editing

July 1st, 2010 § 0 comments § permalink

Search for files containing some text, open them in vim (one per tab)

 grep -l foo ./* | xargs vim -p

Alternatively, to get a single-line list that can be edited and then copy-pasted to a command-line:

grep -l foo ./* | xargs echo

There are more heavy-duty ways of removing lines in output listed here, but I see little reason for using them.t

notify-send

June 20th, 2010 § 0 comments § permalink

Yet another linux trick I keep on forgetting…
To display a notification on the desktop from the command-line:
# apt-get install libnotify-bin
$ notify-send “hello world”

obv. “from the command-line” really means “from a script”, unless you’re in some Evil Dead situation of independently-mobile hands

[reason for looking: trying to get xmonad+dmenu to notify me when I mistype a command, rather than just failing silently]

markdown + vim

June 20th, 2010 § 0 comments § permalink

Since I’m spectacularly dim, it never occured to me that I can run markdown from within vim. Select your text, run !markdown, and wham! bam! everything is replaced by its technicolor HTML twin.

June 8th, 2010 § 0 comments § permalink

A bit of Debian lore I always forget: finding which package is responsible for a certain file:

$ dpkg -S filename

e.g:
$ dpkg -S /usr/bin/lintian
lintian: /usr/bin/lintian

Where Am I?

You are currently browsing the reference category at Dan O'Huiginn.