Friday, February 19, 2010

Time Machine Preference Pane

http://timesoftware.free.fr/timemachineeditor/

Thursday, February 18, 2010

Changing hostname in macos

Stop DHCP screwing up your Mac OS X hostname

I'v got Snow Leopard, but DHCP is screwing my hostname all the time to something very random. Another thing that /etc/hostconfig goes away, while System Preferences in the Sharing tab does not sets hostname as hostname. Thus all older recipes are not really applicable anymore, once you're on Snow Leopard (I love changes). The cure is how to setup your hostname to, e.g. "Zeus" (that's mine one) like this (terminal and sudo privileges are required):

sudo scutil --set ComputerName zeussudo
scutil --set HostName zeussudo
scutil --set LocalHostName zeus

Monday, February 15, 2010

Setting up a SVN Server

Edit the file /etc/apache2/mods-available/dav_svn.conf and add the following lines at the end.


DAV svn
SVNParentPath /var/svn
SVNListParentPath on
AuthType Basic
AuthName "Foosball SVN Repo"
AuthUserFile /etc/subversion/passwd
Require valid-user


Restart Apache.

Missing JavaHL when using Subclipse on MacOS

The easiest thing to do is download and install the OSX package that is provided on openCollabNet. This installs Subversion, including the JavaHL library, into /opt/subversion. It then makes a symlink for the JavaHL library into /Library/Java/Extensions. This is a global location that the OSX JVM looks in when loading libraries via JNI. So basically, if you install this package, there is nothing else you need to do. It is OK to install this after you have installed Subclipse.

Tuesday, February 9, 2010

WLAN AutoConfig Service Failed To Start

Just a quick one today, I had a client come to me this morning with their Lenovo R61 notebook with Vista as the OS, complaining that they couldn’t get their wireless connection working. After a clean reboot the Error Dialog box that cam up said “Error Code: 1747 WLAN AutoConfig service failed to start”. So I tried to open up Event Viewer to have a look and that failed to load as well stating that the Windows Event Log Service failed to start.

So I opened up the Services MMC and tried to manually start the Windows Event Log Service and no luck, didn’t start. SO I did a bit of hunting and found that it could be related to a corrupt Windows Vista TCP/IP Winsock Catalog. So I ran the following command in the command prompt with admin privileges.

netsh winsock reset

What this does is reset the Winsock Catalog to a clean state or default configuration. After a reboot everything was fine.

Using CURL with cookies and authentication

The script is as follows.... Just replace URL, user and password with the appropriate strings.

#!/bin/bash
# Acquire RAT Page cookie
curl \
--trace-ascii curl1.log \
-c cookies.txt \
URL
#
# Sleep 2 seconds for operation to complete
sleep 2
#
# Acquire actual RAT Home Page using cookie
curl \
--trace-ascii curl2.log \
-b cookies.txt \
-u username:password \
URL
#
echo "Done"

Dynamips start and stop scripts

Start Script

echo "Creating Loopback Interface tap 10"
sudo modprobe tun
sudo tunctl -t tap10
sudo ifconfig tap10 169.254.10.1 netmask 255.255.255.0 up
echo "Created Loopback with IP Address 169.254.10.1"
echo "Starting Dynamips on Port 7300"
sudo nice -10 dynamips -H 7300 &
echo "Done"

Stop Script

echo "Shutting Down Loopback Interface tap 10"
sudo ifconfig tap10 down
echo "Killing Dynamips Processes"
sudo ps -ef | grep "dynamips -H 7300" | grep -v "grep" | awk '{print $2}' | xargs -l1 -i kill {}
echo "Done"

Tuesday, February 2, 2010

Using xargs to poll using SNMP

All SNMP OID's are present in snmp-packets file.

cat snmp-packets | grep -i "Object Name" | awk '{print $3}' | xargs -l1 -i snmpbulkget -Cn0 -Cr19 -c public -v 2c 172.16.153.140 {}