movie rental

xslug july meet

Filed under: geek, london, londongeek, uk, upcoming:event=218452, xslt, xslug — Wrote by Otu on Wednesday, July 11th, 2007 @ 7:25 pm

Details of our July meet are finally up on upcoming.
Apologies for the short notice - we wanted to get a venue so we could have a class rather than our normal lovely pub meets.

Details are here, bring friends

http://upcoming.yahoo.com/event/218452

how I hate duplicates

Filed under: Blogroll, apple, geek, londongeek, unix — Wrote by Otu on Monday, June 25th, 2007 @ 8:16 am

My iBook’s hard-drive kept filling up and no amount of df, du magic would tell me what’s taking up all this space: 40GB (Yeah, it’s 3 years old so back off Mr 100 TB ).

Well, today I found out when I kicked open iPhoto to import some pictures from my camera - Yes! Duplicates. Libraries upon libraries of duplicates and triplicates, with each file approx. 1MB large.

I went rooting around and it turns out iPhoto, iTunes have both been creating several copies of the same file on my laptop.

So, I blew them away. How?


io2:~ io2$ cd /Users/io2/Pictures/iPhoto\ Library/
io2:~ io2$ find . -name *.JPG -print | awk '/_[0-9]\.JPG$/' |xargs rm -

Of course no sooner had I done that and twittered about it than Dustin Breese replied with a shorter version.


find . -name \*_[0-9].JPG -exec rm {} \;

Remarks

I totally envy those unix guys with their powerful (perl + awk + sed + pipes + shell) toolbox sitting in their castles looking down at the rest of us

DivX Pro free download

Filed under: Blogroll, divx, free, geek, mac — Wrote by Otu on Friday, June 8th, 2007 @ 1:40 am

The guys over at DivX are giving away free downloads of DivX Pro for a limited time at their website http://www.divx.com/dff/index.php?lang=en&version=mac. Grab your copy and save yourself $20.

Thanks to Tom Morris for finding and twittering this.

reverse looping in python

Filed under: Blogroll, code, geek, python, tech — Wrote by Otu on Thursday, June 7th, 2007 @ 12:53 pm

Neat trick I recently stumbled upon.


Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = range(10)
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print [x for x in l[::-1]]
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

Useful if you have a list which looks like this

l = [1,2,3,4,3,2,3,4,5,6,7,8,54,3,54,6,]

and need to walk backwards while preserving order.

>>> print [x for x in l[::-1]]
[6, 54, 3, 54, 8, 7, 6, 5, 4, 3, 2, 3, 4, 3, 2, 1]

xslug may meet

Filed under: Blogroll, geek, london, upcoming:event=190628, xslt, xslug — Wrote by Otu on Wednesday, May 30th, 2007 @ 9:45 am

Between conversations about cakePHP, privacy on the web (totally dead), PSPs, XBOX and a myraid other things that geeks talk about, we were able to get a few XSLT related things in there, like XSLT jobs going at the BBC, possible applications using XSLT for Hackday London (June 16th). We also tossed around a few ideas of what we ‘d like our next Masterclass to be on - in June (watch out for the details on the mailing list london[at]xslug.org).

We also welcomed 2 new members Nigel Pepper and Nathan Fisher. Sheila was able to join us this time around but unfortunately had her wallet stolen right before our very eyes - well almost. Sorry Ms Ellen :p

Pictures are now up on flickr http://flickr.com/photos/tags/upcoming%3Aevent%3D190628/show/. I think I was the only one taking pictures, so as usual they ‘ll be somewhat random.

Thanks for coming along guys. See you all shortly.

skip first N lines in a file

Filed under: Blogroll, awk, expr, geek, python, tail, tech, unix — Wrote by Otu on Thursday, May 10th, 2007 @ 11:58 pm

To skip the first N lines in a file:

declare a variable to hold the total number of lines in the file. I use awk to calculate this. wc -l /path/to/file would also work(sic)

io2@berlin:~/Desktop$ l=$(awk ' END { print NR }' global.css)

Use expr to calculate the difference between the total number of lines and N, the number you want exclude.

io2@berlin:~/Desktop$ expr $l - N

Tie it all together using the unix tail command


io2@berlin:~/Desktop$ tail -n $(expr $l - N) global.css | less

Of course if this weren’t a test to see how well I *nix, I ‘d personally with a short python script I can call skip_n.py and add to my toolbox


fp = open('/path/to/file', 'r')
lines = fp.readlines(); fp.close()
print "".join(lines[10:]) # skip the first 10 lines and print the rest

Please submit easier/shorter alternatives in the comments. I am no expert ;-)

so would he?

Filed under: Blogroll, claims, geek, tech — Wrote by Otu on Wednesday, April 25th, 2007 @ 10:31 pm

The question is this: “With Scheme would he have done better?”

detained fox

Courtesy of JeffPalm over at JeffPalm.com

automatically twitter your blog postings

Filed under: Blogroll, geek, tech, technorati, twitter — Wrote by Otu on Saturday, March 24th, 2007 @ 3:03 pm

what
A service which allows you to inform twitter when you publish a new earth shattering piece of work on your blog, not unlike this one you are reading.

how
Most blogging tools allow you to add ping servers to your blog. When you write a new blog article, the ping servers are automatically informed and they send out their merry little bots to check it out. What happens after this is hazy, but I have been told there’s cheese, a mice and a chap called Jerome involved. I get very confused at this point as I can’t stand cheese.
In this particular case however, cheese be damned, my little bot goes off to twitter and reports that it’s found a new article fresh off the press/printing block/cesspit (This varies depending on the quality of your writing - in my case, usually the latter I fear).

why
Twitter is a way for ne’r do wells like yours truly to kill time at UK bus stops. Why should this have a reason?

Here, I ‘ll give you one.

You know who this guy: (Mike Arrington)is and this girl: (Abby Lee) and probably him: (Steve Yegge) too, almost definitely this one: (Tim Bray), but I bet you have no idea who this one is. Only kidding, I meant him. I ‘ll assume you also use Twitter, if you don’t then what on earth are you doing reading this epistle? Go away, run as fast as your legs can lift you. For those of you who do, then following http://twitter.com/bl_og means that when our unknown friend above finally writes his Magnum Opus, you will be one of the first people to read it. Hot cakes I believe they are called.

In English:
Bring more readers to your brilliant blog with minimal effort on your part.

alright! enough hype, let me in

Steps:

  1. Login to your blog
  2. Add the URL http://ekanem.de/twitter/ping/ to your blog’s ping server list
  3. Go work on that killer essay which will propel you to the limelight and provide you with all the oysters you ‘ll ever need.

testing twitter ping service

Filed under: geek, tech, technorati, twitter — Wrote by Otu on Thursday, March 22nd, 2007 @ 5:10 pm

this is a post to test http://ekanem.de/twitter/ping/

humans please ignore! robots, do your thing.

running ssh on multiports

Filed under: Blogroll, geek, ssh multiport, tech — Wrote by Otu on Sunday, March 18th, 2007 @ 9:03 am

Disclaimer:

This is purely for information purposes. I, the author am not responsible for any ‘nefarious’ or ‘illegal activities’ which might be undertaken as a result of the lesson learned in this article, including but not limited to proxy avoidance, firewall circumvention, port forwarding and/or shooting yourself in the foot. Ask your network administrator if you are worried about the ramifications of your actions.

Right, with that out of the way: This short tutorial is useful if you wish to run the ssh daemon on a non-standard port.

Scenario
Imagine you happen to regularly sit behind a firewall which blocks all ports except http:80, https:443 and telnet:23 and need to connect to a machine on the internet (internetbox.com perhaps). Since the ssh-daemon on internetbox.com runs on port 22, you cannot connect to your internet box since port 22 is blocked from where you are. So why not have ssh listening on port 23 also?

edit your sshd configuration file using vi / emacs / nano or whatever else rocks your boat. This varies depending on what *nix system you are running,

On debian
vi /etc/ssh/sshd_config

Add a new line which reads

Port 23 # or whatever port you wish to run the ssh-daemon on

save it and restart ssh using the command

/etc/init.d/ssh restart

On rpm based systems (RedHat/ Suse / e.t.c)

vi /etc/rc.d/init.d/sshd

after all the initial comments, add the following line
OPTIONS=”$OPTIONS -p 22 -p 23″

and restart ssh by running

/etc/init.d/sshd restart

When you are back behind your firewall, you can connect to your internet box by running

ssh -p 23 username@internetbox.com


TIP: most places will have those 3 ports listed above open for any number of reasons I don’t care to divulge.
To find out what ports are open on a network, nmap is a useful utility to have around

Formation SAGE © il maestro ignoto