Remote X session

So yeah, there are times when you just need/want a complete X session remotely for some reason.. For example, in my case i have no room to set up a work station at home for my work lappy, so i’d rather use my home PC for the work stuff, however i do not want any work data transfered to my PC.

So, i came to the conclusion that remote controlling the work lappy was a good choice, however i still needed to figure out what to use for that, first option was obviously VNC but thats something i try to stay away from.. So i came to the conclusion that complete X session over SSH was a quite valid idea.. And the tinkering begins!

First of all, we need new local display for the new session.. I figured out that theres 2 good choices here.

#1 Xephyr.

Xephyr :2 -screen 1024x768x32 >/dev/null

#2 new X session in new TTY

sudo X -quiet -nolisten tcp -noreset +xinerama :4 vt1

After figuring out that i want it in new TTY, it was just matter of redirecting the window manager session to the display (:4 in this case)

DISPLAY=:4 ssh -Y -C -c arcfour128 zutto@ dwm

And were done! we have new DWM session in TTY1 for the fun tiems!
Also, you might question why -c arcfour128, and the reason for that is cause its the fastest cipher ssh protocol 2 supports. Not secure, but were in local network so were probably good to go w/o worrying.

More bash awesomeness..

List all videos to list

awk '/.avi|.mkv|.ogm|.wmv|.mp4/ {for(i=1;i<9;i++){ $i="";} print $0}' <(ls -lhR) >> lista

Record desktop audio… Without recording silence..

So basicly what this tiny script does is record 30 minute clips of audio from your desktop (without recording silence), and converts them to mp3 to save space
Why? We needed a bot to record our ts3 conversations and this was quite handy way to do it

while true; do
aika="/tmp/mount/nauha/$(date +%d.%m.%Y-%H:%M:%S) - nauhotus"
echo "$aika"
pacat --record -d 0 | sox -t raw -r 44100 -s -L -b 16 -c 2 - "$aika.wav" silence 1 0.1 0.01% -1 5 0.1% &
sleep 1800
killall -9 pacat
lame "$aika.wav" "$aika.mp3"; rm -rf "$aika.wav" &
sleep 10
echo "scripta restartattu $(date +%d.%m.%Y-%H:%M:%S)"

And below you can find why we did it.. If you understand finnish ;p