• Mac OSX ntp

    If you want to sync to a time server other than the default apple provided ones you can enter the address into the box in the ‘Date & Time’ preference pane. To enter multiple servers seperate them with spaces as show in the image below. All this actually does is write the information out to /etc/ntp.conf and restarts the ntp daemon. Remember that the file will get overwritten when you access the preference pane though.


  • Linux raid1 with only 1 disk

    If you need to initialise a raid1 volume with linux software raid but you currently only have a single disk available, use this:

    mdadm --create /dev/md1 --level 1 --raid-devices=2 missing /dev/hda1
    

    You can then mkfs /dev/md1 and then mount and use it as normal. When your second disk is available you can add it into the raid with this command:

    mdadm --add /dev/md1 /dev/sda5
    

    Now the raid will begin to sync, cat /proc/mdstat to check the sync progress


  • iso mounting

    On solaris mounting a .iso via loopback is a little different to linux, first you need to use lofiadm to add a file as a loopback device, then you can mount it in the normal way. An example is below:

    # lofiadm -a /u01/tmp/java_es_05Q1-ga1-solaris-x86-1.iso /dev/lofi/1
    # mount -F hsfs -o ro /dev/lofi/1 /mnt/jes/1/
    


  • Configuring multiple DNS domains

    Okay suppose you are on a corporate LAN and VPN’d into some other private network. You want DNS to resolve the local intranet, but also resolve your VPN’d LAN. If you VPN’d LAN domain is internal.sollicker.com then create;

    /etc/resolver/sollicker.com

    and in this file;

    search internal.sollicker.com sollicker.com

    nameserver 172.16.100.15

    Then run:

    sudo kill -HUP `cat /var/run/lookupd.pid`
    


  • BASH assigning command output into an array

    Often find myself needing to do this but never remember how…

    # flirble=(`ls -ltr ssh* | tail -3 | tr -s ' ' | cut -d ' ' -f 9` )
    # echo ${flirble[*]}
    ssh_host_key ssh_host_dsa_key.pub ssh_host_dsa_key
    # echo ${flirble[0]}
    ssh_host_key
    # echo ${flirble[1]}
    ssh_host_dsa_key.pub
    # echo ${flirble[2]}
    ssh_host_dsa_key
    # echo ${flirble[3]}
    
    # ls -ltr ssh* | tail -3
    -rw-------  1 robin cm-users 539 Aug 11 12:40 ssh_host_key
    -rw-r--r--  1 robin cm-users 614 Aug 11 12:40 ssh_host_dsa_key.pub
    -rw-------  1 robin cm-users 668 Aug 11 12:40 ssh_host_dsa_key
    

    This and more useful array manipulation can be found in Chapter 26 of the Advanced Bash Scripting Guide.


  • Sed regular expressions

    The sed regular expressions are essentially the same as the grep regular expressions. They are summarized below.

    <td>
      matches the beginning of the line
    </td>
    
    <td>
      matches the end of the line
    </td>
    
    <td>
      Matches any single character
    </td>
    
    <td>
      match arbitrarily many occurences of (character)
    </td>
    
    <td>
      Match 0 or 1 instance of (character)
    </td>
    
    <td>
      Match any character enclosed in [] (in this instance, a b c d e or f)<br /> ranges of characters such as <code>[a-z]</code> are permitted. The behaviour<br /> of this deserves more description. See the page on <a HREF="grep.html">grep</a><br /> for more details about the syntax of lists.
    </td>
    
    <td>
      Match any character <em>NOT</em> enclosed in [] (in this instance, any character other than a b c d e or f)
    </td>
    
    <td>
      Match m-n repetitions of (character)
    </td>
    
    <td>
      Match m or more repetitions of (character)
    </td>
    
    <td>
      Match n or less (possibly 0) repetitions of (character)
    </td>
    
    <td>
      Match exactly n repetitions of (character)
    </td>
    
    <td>
      Group operator.
    </td>
    
    <td>
      Backreference - matches nth group
    </td>
    
    <td>
      Matches expression1 or expression 2. Works with GNU sed, but this feature might not work with other forms of sed.
    </td>
    


  • 2 useful html things

    First, a nice css cheat sheet pdf:http://www.ilovejackdaniels.com/css_cheat_sheet.pdf

    And secondly a nice colour picker dashboard widget http://www.colourmod.com/


  • New del.icio.us links

    Down there on bottom of the right hand side there is a list of links from my del.icio.us bookmarks. It is only the ones tagged as useful so other things I tag wont turn up, like photography for example.

    I’ll try and make a specific page on this site of all of the links tagged as useful at some point.


  • Procinfo

    Just found this useful little tool for summerising machine information read from /proc. I can’t find a home page for it but it can be downloaded from ftp://ftp.cistron.nl/pub/people/svm/. It seems to ship by default with at least SUSE 9.3 and Fedora (Broken link http://fedora.redhat.com/) Core 4.

    Example output below

    [root@eddie ~]# procinfo
    Linux 2.6.11-1.1369_FC4 (bhcompile@decompose.build.redhat.com) \
    (gcc 4.0.0 20050525 ) #1 Thu Jun 2 22:55:56 EDT 2005 1CPU [eddie]
    
    Memory:      Total        Used        Free      Shared     Buffers
    Mem:        515372      446196       69176           0      113048
    Swap:      1048568         912     1047656
    
    Bootup: Sun Jul 17 08:47:22 2005    Load average: 0.43 0.22 0.08 1/138 11716
    
    user  :       3:36:41.09   1.7%  page in :        0
    nice  :       1:20:51.42   0.6%  page out:        0
    system:       3:40:27.39   1.7%  swap in :        0
    idle  :   8d 17:08:50.87  96.0%  swap out:        0
    uptime:   9d  1:46:23.08         context : 98642479
    
    irq  0: 784129991 timer                 irq  8:         1 rtc
    irq  1:         9 i8042                 irq  9:         0 acpi
    irq  2:         0 cascade [4]           irq 10:   6170092 CMI8738-MC6, ehci_hc
    irq  3:         5                       irq 11:         0 uhci_hcd:usb2, uhci_
    irq  4:         5                       irq 12:      2114 i8042
    irq  5:         0 uhci_hcd:usb1, yenta  irq 14:   2132585 ide0
    irq  6:         5                       irq 15:   2955294 ide1
    
    [root@eddie ~]#
    


  • DHCP search path

    I fyou need to send a DNS search path to DHCP clients along with all the other details it seems you do it like this (in /etc/dhcpd.conf):

    option domain-name "internal.usefulthings.org.uk usefulthings.org.uk";
    option domain-name-servers 192.168.8.1, 192.168.8.2;
    

    Took me a while to find that one!