Mikeri's tech-babble

2014-08-19

Booting Windows when early boot fails

So this was my problem; an old laptop wouldn't boot Windows XP. After the Grub menu, I would just get a black screen with a blinking cursor when choosing Windows XP. Other installed OSes worked fine.

Ntldr, Ntdetect and boot.ini were all fine. Reinstalling the MBR (running fixmbr or fdisk /mbr, deleting Grub) or running Windows repair would not fix it. Also the boot flag was set.

Turns out the partition itself, not just the disk, has a boot sector, this was probably corrupt. I got it to boot by using Grub, and replacing the line "chainloader +1" with "ntldr /ntldr" in the menu entry. This skips the boot sector on the partition and loads ntldr directly. Wehey, it booted!

Labels: , , , , , , , ,

2011-09-03

How to disable click to raise in Ubuntu Linux using Compiz

One thing I have missed greatly from my days with AmigaOS back in the day is working with overlapping windows without the active window popping to front all the time. One example would be a maximizied web browser and a small window un top of it. Whenever you click on the web browser the small window will dissapear.

Under General compiz options/Focus & Raise Behaviour you can uncheck "raise on click" to get AmigaOS-like behaviour, windows will not move to front when clicking on them. To move a window to front, simply click the title bar.

Something simular would be possible with the focus on hover option but most people find that one annoying.

Labels: , , , , , , ,

2010-01-25

Fixing Windows XP MBR without the install CD

I just had a mishap with a failed Ubuntu install (GRUB failing due to the BIOS having problems with large drives) on a laptop and needed to boot back into XP. "Normally" (or rather, in the past) the XP install CD would do the trick, but because the laptop has a SATA drive the install CD couldn't find any disks.

I could possibly have made a custom install CD (the laptop doesn't have a floppy drive for the SATA drivers the install CD needs) but an easier solution was the great SystemRescueCD. This is completely free and works well.

I booted the included FreeDOS image, typed fdisk at the FreeDOS prompt, selected my XP partition, and hey presto, a rebuild MBR option!

So there you have it, free MBR repair without the dodgy XP install CD. As I didn't find this by Googling for a solution I'm posting it here hoping it will help others in the same pinch.

Labels: , , , , , ,

2009-10-31

Commodore 64 palette file for GIMP

I wasn't able to find a good C64 palette file for GIMP, so I used the values from Philip 'Pepto' Timmermann's brilliant webpage about the C64 colour palette and typed the values into this .gpl file, just in case anyone should have use for it.

Labels: , , , , ,

2009-10-27

Automatic directory spesific saving of torrent-files in Firefox

There is (as far as I know anyway) no easy way to specify which directory to save files in by file types in Firefox. There are addons, but the only good one I found required you to open the Open-or-Save-as requester. Therefore, I made this little shell-script:

#!/bin/bash
mv $1 ~/torrents/
rename 's/\[.*?\]//g' ~/torrents/$1
exit

Save this script and do a chmod u+x on it, then point Firefox to use it on torrent files. (Edit/Preferences/Applications) Obviously, change the directory to where you want your torrent files. Of course this can be used for other file types as well.

The script also strips out those annoying square bracketed site ads like [ISOHunt] etc. (Square brackets seemed to confuse rtorrent here.)

Labels: , , , , , , , , , , , ,

2009-03-22

IPv6 with 6to4 tunneling in Debian made easy

I tried to find an easy way to implement IPv6 via 6to4 on my Debian server, but everything I found required some sort of manual intervention in the case of reboots/new IP addresses from my ISP, etc.

So I made this little init.d script using snippets from all around:

#!/bin/sh
# $Id: tun6to4 init.d script v0.1

#Change "eth1" in the following line to your own public interface:
IPV4=$(ifconfig -a | awk '/eth1/{p=1}p&&/inet addr/{sub(".*:", "", $2);print $2;exit}')

STFADDRESS=$(printf "2002:%02x%02x:%02x%02x::1" `echo $IPV4 | tr "." " "`)

case "$1" in
start)
echo -n "Starting 6to4 tunnel: "
/sbin/ip tunnel add tun6to4 mode sit ttl 64 remote any local $IPV4
/sbin/ip link set dev tun6to4 up
/sbin/ip -6 addr add $STFADDRESS/16 dev tun6to4
/sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1
#The following line enables forwarding from eth0
# /sbin/ip -6 addr add dev eth0 $STFADDRESS/64
echo "."
;;
stop)
echo -n "Stopping 6to4 tunnel: "
/sbin/ip -6 route flush dev tun6to4
/sbin/ip link set dev tun6to4 down
/sbin/ip tunnel del tun6to4
echo "."
;;
restart | force-reload)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: /etc/init.d/tun6to4 {start|stop|restart|force-reload}"
exit 1
esac
exit 0

Modify the first uncommented line with your own lan interface, save the file as /etc/init.d/tun6to4 , then do a:
$ update-rc.d tun6to4 defaults
And you should have IPv6 connectivity up and running automatically. On reboots, the script should find your DHCP assigned IP-address and use it accordingly.

If you want to forward from your LAN, uncomment the commented /sbin/ip line and change eth0 to your LAN interface.

If you get a new IP address you'll have to rerun the script. Oh, and the ipv4-extractor uses awk.

Labels: , , , , , ,

2009-03-01

Blocking a user group from your internal network in Linux

I recently found out that IPtables features owner matching for TCP packets. This means you can block out packets from certain groups from accessing your local network.

In my scenario, I have a Debian server beeing a physical gateway between my local network and the outside world. Now, some of my friends also has shell accounts on this box. And while I do trust them, it's nice to know they can't access all my stuff (like open smb shares) on the local network.

So how is this done? It's dead simple when you know how. Add the following iptables rule:

iptables -A OUTPUT -m owner --gid-owner 2000 -d 192.168.0.0/24 -j REJECT

This will block gid 2000 from accessing the 192.168.0.* network. Obviously, change this for your own needs. Then add a group called guests or something with a matchind gid, I just added the following to /etc/group:

guests:x:2000:

And ofcourse link the guest users to the guest groups. You can edit /etc/group by hand or use the following command for each of the users:

usermod -g 2000 guestusername

Labels: , , , ,