Some useful stuff
Tech stuff Jump to non tech stuff
Here are 2 things recently that google didn’t provide me with a useful result.
I needed a linux server to forward two ports to another machine. This is the script i put in the rc2.d (/etc/rc2.d/) so that it would apply on start up.
#!/bin/sh
IPTABLES=”/sbin/iptables”
# enable ip forwarding
echo “1″ > /proc/sys/net/ipv4/ip_forward
# flush existing tables
$IPTABLES -F
$IPTABLES -t nat -F
# our forwarding policy is to deny
#$IPTABLES -P FORWARD DROP
# enable masquerading on the eth0 (private) network
$IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# forward some ports
$IPTABLES -t nat -A PREROUTING -i eth0 -p tcp –dport 7575 -j DNAT –to 192.168.62.61:7575
$IPTABLES -t nat -A PREROUTING -i eth0 -p tcp –dport 7676 -j DNAT –to 192.168.62.61:7676
(thanks to a collegue who help with this)
The other thing was I needed to crop an image that i don’t have any control over:

It’s generated by last.fm so i couldn’t just crop it and put it in the blog template, It would be possible to crop it using another script but that would add to the processing the page needed especially as this image is generated each time a new song is played.
So to crop it and not resize it and adhear to XHTML 1.0 I decided to use CSS to crop it:
.croplastfm {
display: block;
max-width: 220px;
height: 135px;
background-image: url(‘http://imagegen.last.fm/minimalLightRecent/recenttracks/X3N.gif’);
}
The max-width means that it doesn’t go over the edge, height is the actual height of the image. Then the background is the actual image.
and then in the template of this blog i just use a div, like so;
“< div class="croplastfm" />”
To make this valid in this particular template i had to add it into the li with a link in it.It’s a bit hacky, but it’s valid and it works.
I needed to make some vob files (raw dvd files) smaller so I use transcode to change them into xvid
This works for me pretty much every time with vobs: transcode -i /place/the/vob/is/VTS_01_7.VOB -o /pub/output.avi -y xvid4,ffmpeg -F mpeg4 –export_prof DVD -Z fast -z
occasionally the -z option needs to be taken off ( it flips the video stream) and sometimes the option to swap the colours round (blues and reds) you can do this with -k
I made a profit on a can of coke from the vending machine at work today, someone had left a load of change in the machine which came out when i went to purchase my drink.
I bought my two (desk) neighbours a chocolate bar. I don’t believe in personal gain from someone elses missfortune. I once found a £10 GBP note down my road, I donated it to charity. If I didn’t I would feel guilty, I know if i lost some money i would rather it go to chairty rather flitered away on someone’s wants. What goes around comes around anyway.
Water pipe has been fixed and the washing machine is working fine now. Got a lot done at work today – I need to find out what I can and can’t say.
http://remindme.outerweb.org is now up and running properly – it allows forgetful people like myself to send emails to myself reminding me of things I need to do.
I’m currently on the look out for an IRC network to link with outerweb to help secure it’s future.