Archive for the ‘Linux’ Category

Indent/Format the whole buffer in Emacs

Monday, February 8th, 2010

I have had an indent-buffer command like this for some time, which formats the whole current buffer. I used it for java, c++, css, html, xml and lisp.

(defun indent-buffer ()
    "Indent the current buffer"
    (interactive)
    (save-excursion (indent-region (point-min) (point-max) nil))
)

I found the above function at http://www.emacswiki.org/cgi-bin/wiki/ReformatBuffer

Recently I noticed that it was leaving tabs in (which I hate) and trailing spaces.  It was simply just indenting the buffer.

After some more searching today I found the untabify command and I created the following commands.  Mainly because I expected the command to be called something like tab-???

(defun untabify-buffer ()
    "Untabify current buffer"
    (interactive)
    (save-excursion (untabify (point-min) (point-max)))
)
 
(defun tab-to-spaces ()
    "Convert tab to spaces"
    (interactive)
    (save-excursion (untabify (point-min) (point-max)))
)

I then found this page, http://emacsblog.org/2007/01/17/indent-whole-buffer/ which has the best indent/format buffer function.

(defun indent-buffer-2 ()
    "Indent the buffer 2"
    (interactive)
    (save-excursion
        (delete-trailing-whitespace)
        (indent-region (point-min) (point-max) nil)
        (untabify (point-min) (point-max))
    )
)

Home and End key with rxvt

Tuesday, March 31st, 2009

I use cygwins rxvt at work and have had problems with the End and Home key not working.

I also had the same issue at home using rxvt-unicode

on gentoo.

download angels fall movie

After lots of search last night I finally found the fix for urxvt.

Simply add this to your ~/.inputrc file

# home and end keys for rxvt
"\e[7~":beginning-of-line
"\e[8~":end-of-line

when harry met sally movie download suicide blonde movie download

I then tried this at work this morning and found it works on cygwins rxvt too.

SSH and rsync through a socks proxy

Wednesday, December 17th, 2008

I’ve been using Dropbox for quite some time to transfer files from work to my home PCs. This is worked well for months, but I finally filled my dropbox account.

watch life less ordinary a online As I have a linux box at work and a linux box at home I decided to try and setup some simply one way mirroring system.  I.e. mirror documents from work to my home PC.

I looked at using unison, which I used to mirror many other directories but I couldnt get it to connect out from my work PC.   It appears to lack socks support.  I know I could use ssh port forwarding to sync via sockets but this would be more complicated.

I decided to use rsync

dreamland online download

via ssh.

There was one main issue though, I needed to get ssh to work over our proxies.  We have a few http proxies and 1 socks proxy.  The http proxies will not connect to arbitrary ports so I ended up using the socks server.

download religulous dvd

I knew the socks server worked as I’ve used it with putty watch hannah montana the movie online for years, so I just needed to figure out how to setup ssh to use it.

After lots of search and finding articles regarding port forwarding and nothing about using a socks proxy I found 1 good article.

I use gentoo linux so I emerged net-misc/connect which supports socks servers.

emerge -auv net-misc/connect

Once I had the connect utility installed I needed to edit my ssh config file.  I only have 1 user configured on my linux box at work so I edited the ~/.ssh/config file.

This is what I added

Host stokebloke.com
ProxyCommand connect -S user@socks-server:1080 %h %p

Host www.stokebloke.com
ProxyCommand connect -S user@socks-server:1080 %h %p

Host homebox.homelinux.net
ProxyCommand connect -S user@socks-server:1080 %h %p

You can also do the same thing with cygwin too.  Instead of using connect program its called connect-proxy in the network section of the cygwin installer.

After I got this far I needed to configure rsync to work via this ssh connection which, it turns out, is very simple.

rsync --progress -avrz -e ssh src_dir/ user@homebox.homelinux.net:~/dest_dir/

This results in the src_dir existing inside the dest_dir.

AVI to FLV with ffmpeg

Monday, June 9th, 2008

I used to have all my videos on my website as divx or xvid encoded AVI. This is a pain as you have to download the files to play them.

I found FlowPlayer and it works really well. I used to use flvtool to encode videos as flv files but it is not part of gentoo and I had to keep manually downloading and building it all the time to get the updates.

kismat konnection movie

I recently found this article which shows how to use ffmpeg to encode videos as flv files.

ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x256 video.flv

download outlaw trail the treasure of butch cassidy download doctor zhivago dvd

I then use the flv with FlowPlayer like this

<object type="application/x-shockwave-flash"
    data="/include/FlowPlayer.swf"
    width="320"
    height="284"
    id="FlowPlayer1">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="movie" value="/include/FlowPlayer.swf" />
  <param name="quality" value="high" />
  <param name="scale" value="noScale" />
  <param name="wmode" value="transparent" />
  <param name="allowNetworking" value="all" />

  <param name="flashvars" value="config={
		autoPlay: false,
		loop: false,
		initialScale: 'scale',
		showLoopButton: false,
		showPlayListButtons: false,
		playList: [
			{ url: '/media/tux_07.flv' }
		]
		}" />
</object>

See Hintertux 2007 for an example.

Hintertux Video Processing

Saturday, June 7th, 2008

Well, this is crazy. We are back from Hintertux and now its time to start processing the video. My new Helmet cam means that I have loads of footage. 57Gb of raw dv files.

I have started watching the clips and chopping them up into little clips in Cinelerra. Its really a very good application. In my opinion its better than most. The motion tracking and stabilisation is really good.

download hard boiled online download bug s life a movie I did have one problem and it didn’t really like using the XVID AVI files which my helmet camera made so I converted all the files to raw DV files. I used ffmpeg to do this.

fairytale a true story dvd ffmpeg -i video.avi -target pal-dv video.dv

I’ve been processing for days already and I still haven’t processed half of the footage.