James Kyle

30 Days with TextMate

I've been a vim user for years, but since moving to OSX I've been hearing a lot about TextMate. Since I always encourage others to keep an open mind and learn new things, I decided to give this editor a solid shot.

For the next 30 days, I'll TextMate for all my editing, coding, and general editing needs. I'll keep a tally of pros and cons that I encounter along the way.

Feature or 'issue' Vim TextMate
Snippets I'm told there's a plugin called SnipMate, haven't tried it yet though Killer feature, highly customizable and flexible (any scripting language you want.)
Stability rock solid Crashes frequently. Not every 5m or anything, but about once or twice a day. *Seems to be related to a bug in the help search menu. You can avoid crashing by not launching commands through the help search.

0 comments

Odd Python 'isms

First, I'd like to readily admit that I'm a Python newbie and more than welcome any corrections to the below hitches I've run into that might lead to a smoother/less discombobulated path.

Some things about Python are very different from the how other scripting languages do them. There's also a fair amount of inconsistencies in the language design that require a higher level of rote memorization. Often there is not a generalized rule or naming convention you can use to navigate your way around the modules and documentation or to intuit how methods or modules should work.

This is my blog page documenting those for easy reference or maybe to just help me memorize them.

The Many Paths to Path

There are two different path modules used with any regularity.
  • os.path
  • sys.path
The os.path module is the environment path of the system. What we'd normally access via constants like ENV['PATH'] in ruby or echo $PATH in bash. The sys.path is the internal path of the python interpreter, it's what we manipulate to add or remove paths to python modules.

There's nothing wrong with this, but often vars like this are available by default so I found myself double checking a lot in the beginning.

Shelling Out and Capturing STDOUT in Python

This is usually brain dead simple. You just back tic like so
output=`echo "foo"&& ls -l; sleep 5`

This will work in perl, ruby, bash, zsh, just about anything...except python. The Python way isn't really difficult, it does require that you ask around till you find the proper method/module then read a few pages to find the example. So here it is:

from subprocess import Popen
cmd1 = ["echo", "foo"]
cmd2 = ['ls", "-l"]
cmd3 = ["sleep", "5"]

tmpout = ""
(output, error) = Popen(cmd1, stdout=subprocess.PIPE).communicate()
tmpout = output
(output,error) = Popen(cmd2, stdout=subprocess.PIPE).communicate()
tmpout += output
(output,error) = Popen(cmd3, stdout=subprocess.PIPE).communicate()
tmpout += output

Directories, directories, and more directories

Need to work with directories? Get ready to start digging. Here's some quick refs to common tasks.
  • To get a list of directories you can use the listdirs method in either the dircache module or the os module, though the os module is the recommended one. dircache makes a cache of the list and does not reread unless something changes.
  • To create a directory you can import the os module and use mkdir
  • To move or copy a directory or file you import the shutil module and use move or copy, OR you can import the os directory and use rmdir, BUT if you want to recursively remove directories you use removedirs AND if you want to remove files, but not directories you use remove. . . or at this point just shell out and use rm since it seems an easier alternative hehe (only embark on this IF you've read the above tutorial on shelling out. :P)

Python Debugger Warts

A good debugger is essential to any sort of development environment. One glaring lapse in pdb (python debugger) is the inability to watch a variables state for changes. I've looked high and low for any way to do this in python and it doesn't seem to be possible. Anyone whose had to track a variable through several copies, reference passes, parsing, modules, and methods knows what a pain the brute force technic of littering all that with "print(foo)" can be....but suck it up and get to it, there's no other way.

In django, controllers are views and views are templates

This sinks in after a while, but if you work with other frameworks and switch back and forth you'll catch yourself looking for your views in the views.py when you should be looking in the templates.

1 comment

Dell Perc 5i on Ubuntu 64

I've been setting up an Ubuntu server on a Dell with a 29xx series with a Perc 5i SAS/SATA RAID controller. It took a bit of digging around and piecing together posts on the ubuntu forums and random blogs, but I'm pretty sure I've got it all up and working. Here's the short story:

  1. Add the deb ports for dell's Open Management tools to your sources.conf
    1. /etc/apt/sources.list: deb ftp://ftp.sara.nl/pub/sara-omsa dell sara
    2. add the sara key to your gpg list
      1. wget http://ftp.sara.nl/debian_sara.asc
      2. sudo apt-key add debian_sara.asc
    3. apt-get update
  2. Install snmp tools
    1. apt-get install snmp snmpd
  3. Install openipmi and ipmitool
    1. apt-get install openipmi
    2. apt-get install ipmitool
  4. Install lib32 ncurses and ia32-libs
    1. apt-get install -f lib32ncurses5
    2. apt-get install -f ia32-libs
  5. Install dell's omsa tools
    1. apt-get install dellomsa
  6. Update your libraries
    1. ldconfig
      1. this takes care of a few errors I got that looked like this
      2. /opt/dell/srvadmin/dataeng/bin/dsm_sa_datamgr32d: error while loading shared libraries: libdcsmil32.so.5: cannot open shared object file: No such file or directory
  7. Place the following init script and put it in /etc/init.d/
    1. Download file "dell_omsa.sh"
  8. Enable snmp in omsa tools
    1. /etc/init.d/dataeng enablesnmp
  9. Execute the dell_omsa.sh script to get up and running
    1. /etc/init.d/dell_omsa.sh
  10. Register the new driver module with omsa
    1. /etc/init.d/instsvcdrv restart
  11. Edit your /etc/snmp/snmpd.conf so it can be used (I take no responsibility if the following settings are not appropriate security for your network)
    1. change: com2sec paranoid default public to com2sec readonly default public
  12. Change the way taht ubuntu starts snmpd
    1. /etc/default/snmpd: change
    2. SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' to
    3. SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -p /var/run/snmpd.pid 127.0.0.1'
  13. /etc/init.d/snmpd restart
  14. /etc/init.d/dataeng restart
  15. Verify snmpd
    1. snmpwalk -OS -v 1 -c public localhost .1.3.6.1.4.1.674.10892.1
  16. Start OMSA web services on reboot
    1. update-rc.d dsm_om_connsvc defaults
  17. Finally, by default you must log into the web admin with the root account. So enable root account
    1. sudo passwd root
  18. One more catch for 64 bit ubuntu users, you must change the lib paths in /etc/pam.d/omauth and install 32 bit pam libs
    1. change all instances of /lib/security/ to /lib32/security
    2. download the i386 versions of the following libs (you can determine the package that provides a particular lib by dpkg -S /path/to/file, e.g. dpkg -S /lib/security/pam_unix.so)
      1. libselinux1_2.0.15-2ubuntu1_i386.deb
      2. libpam-modules_0.99.7.1-5ubuntu1_i386.deb
      3. libsepol1_2.0.3-1_i386.deb
    3. Extract them to a tmp directory
      1. dpkg-deb -x <libname> /tmp/lib32s
    4. then copy the following over to /lib32 and /lib32/security
      1. lib/libsepol.so.1
      2. lib/libselinux.so.1
      3. lib/security/pam_unix.so
      4. lib/security/pam_nologin.so
    5. run ldconfig
  19. You should now be able to log into the OMSA web manager at https://localhost:1311 using your root name password
  20. Having root enabled can be viewed as a security list, so you probably want to add a normal admin user to OMSA's manager group and disable root
    1. adduser dellroot
    2. usermod -g root dellroot # user must be added to the root group to gain admin privileges in OMSA manager

I'd like to thank the sad software blogger for a good bit of this information, especially pertaining to snmp.

0 comments

ZSH networksetup completion

#compdef networksetup
# J. A. Kyle
# March 05 2009

_networksetup() {
local expl curcontext
zstyle -T ":completion:${curcontext}:files" prefix-needed && \
[[ "$PREFIX" != /* && compstate[nmatches] -ne 0 ]] && return 1
_arguments -C \
'-listnetworkserviceorder[Display services with corresponding port and device in order they are tried for connecting to a network. An asterisk (*) denotes that a service is disabled.]' \
'-listallnetworkservices[Display list of services. An asterisk (*) denotes that a network service is disabled.]' \
'-listallhardwareports[Display list of hardware ports with corresponding device name and ethernet address.]' \
'-detectnewhardware[Detect new network hardware and create a default network service on the hardware.]'\
'-getmacaddress <hardwareport or device name>[Display ethernet (or AirPort) address for hardwareport or device specified.]'\
'-getcomputername[Display the computer name.]'\
"-setcomputername <name>[Set the computer's name (if valid) to <name>.]"\
'-getinfo <networkservice>[Display IPv4 address, IPv6 address, subnet mask, router address, ethernet address for <networkservice>.]'\
'-setmanual <networkservice><ip><subnet><router>[Set the <networkservice> TCP\IP configuration to manual with IP address set to ip, Subnet Mask set to subnet, and Router address set to router.]'\
'-setdhcp <networkservice><clientid>[Set the <networkservice> TCP\IP configuration to DHCP. You can set the DHCP client id to the optional <clientid>. Specify "Empty" for <clientid> to clear the DHCP client id.]'\
'-setbootp <networkservice>[Set the <networkservice> TCP\IP configuration to BOOTP.]'\
'-setmanualwithdhcprouter <networkservice><ip> [Set the <networkservice> TCP\IP configuration to manual with DHCP router with IP address set to ip.]'\
'-setv4off <networkservice> [Turn IPv4 off on <networkservice>. ]'\
'-setv6off <networkservice> [Turn IPv6 off on <networkservice>. ]'\
'-setv6automatic <networkservice> [Set the service to get its IPv6 info automatically. ]'\
'-setv6manual <networkservice><address><prefixlength><router>[Set the service to get its IPv6 info manually. Specify <address><prefixLength> and <router>.]'\
'-getdnsservers <networkservice>[Display DNS info for <networkservice>.]'\
'-setdnsservers <networkservice><dns1><dns2><...> [Set the <networkservice> DNS servers to <dns1><dns2><...>. Any number of dns servers can be specified. Specify "Empty" for <dns1> to clear all DSN entries.]'\
'-getsearchdomains <networkservice>[Display Domain Name info for <networkservice>.]'\
'-setsearchdomains <networkservice><domain1><domain2><...> [Set the <networkservice> Domain Name servers to <domain1w <domain2><...>. Any number of Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries.]'\
'-create6to4service <newnetworkservicename> [Create a 6 to 4 service with name <newnetworkservicename>.]'\
'-set6to4automatic <networkservice> [Set the service to get its 6 to 4 info automatically. ]'\
'-set6to4manual <networkservice><relayaddress>[Set the service to get its 6 to 4 info manually. Specify <relayaddress> for the relay address.]'\
'-getftpproxy <networkservice>[Display FTP proxy (server, port, enabled value) info for <networkservice>.]'\
'-setftpproxy <networkservice><domain><port number><authenticated><username><password>[Set FTP proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setftpproxystate <networkservice><on off>[Set FTP proxy to either <on> or <off>.]'\
'-getwebproxy <networkservice>[Display Web proxy (server, port, enabled value) info for <networkservice>.]'\
'-setwebproxy <networkservice><domain><port number><authenticated><username><password>[Set Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setwebproxystate <networkservice><on off>[Set Web proxy to either <on> or <off>.]'\
'-getsecurewebproxy <networkservice>[Display Secure Web proxy (server, port, enabled value) info for <networkservice>.]'\
'-setsecurewebproxy <networkservice><domain><port number><authenticated><username><password>[Set Secure Web proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setsecurewebproxystate <networkservice><on off>[Set SecureWeb proxy to either <on> or <off>.]'\
'-getstreamingproxy <networkservice>[Display Streaming proxy (server, port, enabled value) info for <networkservice>.]'\
'-setstreamingproxy <networkservice><domain><port number><authenticated><username><password>[Set Streaming proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setstreamingproxystate <networkservice><on off>[Set Streaming proxy to either <on> or <off>.]'\
'-getgopherproxy <networkservice>[Display Gopher proxy (server, port, enabled value) info for <networkservice>.]'\
'-setgopherproxy <networkservice><domain><port number><authenticated><username><password>[Set Gopher proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setgopherproxystate <networkservice><on off>[Set Gopher proxy to either <on> or <off>.]'\
'-getsocksfirewallproxy <networkservice>[Display SOCKS Firewall proxy (server, port, enabled value) info for <networkservice>.]'\
'-setsocksfirewallproxy <networkservice><domain><port number><authenticated><username><password>[Set SOCKS Firewall proxy for <networkservice> with <domain> and <port number>. Turns proxy on. Optionally, specify <on> or <off> for <authenticated> to enable and disable authenticated proxy support. Specify <username> and <password> if you turn authenticated proxy support on.]'\
'-setsocksfirewallproxystate <networkservice><on off>[Set SOCKS Firewall proxy to either <on> or <off>.]'\
'-getproxybypassdomains <networkservice>[Display Bypass Domain Names for <networkservice>.]'\
'-setproxybypassdomains <networkservice><domain1><domain2><...>[Set the Bypass Domain Name Servers for <networkservice> to <domain1><domain2><...>. Any number of Domain Name servers can be specified. Specify "Empty" for <domain1> to clear all Domain Name entries.]'\
'-getpassiveftp <networkservice>[Display whether Passive FTP is on or off for <networkservice>.]'\
'-setpassiveftp <networkservice><on off>[Set Passive FTP to either <on> or <off>.]'\
'-setautoproxyurl <networkservice><url>[Set proxy auto-config to url for <networkservice> and enable it.]'\
'-getautoproxyurl <networkservice>[Display proxy auto-config (url, enabled) info for <networkservice>.]'\
'-setautoproxystate <networkservice><on off>[Set proxy auto-config to either <on> or <off>.]'\
'-getairportnetwork[Display current AirPort Network.]'\
'-setairportnetwork <network><password>[Set AirPort Network to <network> using optional <password> if specified.]'\
'-getairportpower[Display whether AirPort power is on or off.]'\
'-setairportpower <on off>[Set AirPort power to either <on> or <off>.]'\
'-getnetworkserviceenabled <networkservice>[Display whether a service is on or off (enabled or disabled).]'\
'-setnetworkserviceenabled <networkservice><on off>[Set <networkservice> to either <on> or <off> (enabled or disabled).]'\
'-createnetworkservice <newnetworkservicename><hardwareport>[Create a service named <networkservice> on port <hardwareport>. The new service will be enabled by default.]'\
'-renamenetworkservice <networkservice><newnetworkservicename>[Rename <networkservice> to <newnetworkservicename>.]'\
'-duplicatenetworkservice <networkservice><newnetworkservicename>[Duplicate <networkservice> and name it with <newnetworkservicename>.]'\
'-removenetworkservice <networkservice>[Remove the service named <networkservice>. Will fail if this is the only service on the hardware port that <networkservice> is on.]'\
'-ordernetworkservices <service1><service2><service3><...>[Order the services in order specified. Use "-listnetworkserviceorder" to view service order. Note: use quotes around service names which contain spaces (ie. "Built-in Ethernet").]'\
'-getappletalk <networkservice>[Display whether AppleTalk is on or off (enabled or disabled) on <networkservice>.]'\
'-setappletalk <networkservice><on off>[Set AppleTalk to either <on> or <off> (enabled or disabled) on <networkservice>.]'\
'-setMTUAndMediaAutomatically <hardwareport or device name>[Set hardwareport or device specified back to automatically setting the MTU and Media.]'\
'-getMTU <hardwareport or device name>[Get the MTU value for hardwareport or device specified.]'\
'-setMTU <hardwareport or device name><value>[Set MTU for hardwareport or device specified.]'\
'-listvalidMTUrange <hardwareport or device name>[List the valid MTU range for hardwareport or device specified.]'\
'-getmedia <hardwareport or device name>[Show both the current setting for media and the active media on hardwareport or device specified.]'\
'-setmedia <hardwareport or device name><subtype><option1><option2><...>[Set media for hardwareport or device specified to subtype. Specify optional <option1> and additional options depending on subtype. Any number of valid options can be specified.]'\
'-listvalidmedia <hardwareport or device name>[List valid media options for hardwareport or device name. Enumerates available subtypes and options per subtype.]'\
'-createVLAN <VLAN name><device name><tag>[Create a VLAN with name <VLAN name> over device <device name> with unique tag <tag>. A default network service will be created over the VLAN.]'\
'-deleteVLAN <VLAN name><device name><tag>[Delete the VLAN with name <VLAN name> over the parent device <device name> with unique tag <tag>. If there are network services running over the VLAN they will be deleted.]'\
'-listVLANs[List the VLANs that have been created.]'\
'-listdevicesthatsupportVLAN[List the devices that support VLANs.]'\
'-isBondSupported <device name ie., en0>[Return YES if the specified device can be added to a bond. NO if it cannot.]'\
'-createBond <user defined name><device name 1><device name 2><...>[Create a new bond and give it the user defined name. Add the specified devices, if any, to the bond.]'\
'-deleteBond <bond name ie., bond0>[Delete the bond with the specified device-name.]'\
'-addDeviceToBond <device name><bond name> [Add the specified device to the specified bond.]'\
'-removeDeviceFromBond <device name><bond name>[Remove the specified device from the specified bond]'\
'-listBonds[List all of the bonds.]'\
'-showBondStatus <bond name ie., bond0>[Display the status of the specified bond.]'\
'-listpppoeservices[List all of the PPPoE services in the current set.]'\
'-showpppoestatus <service name ie., MyPPPoEService>[Display the status of the specified PPPoE service.]'\
'-createpppoeservice <device name ie., en0><service name><account name><password><pppoe service name>[Create a PPPoE service on the specified device with the service name specified. The "pppoe service name" is optional and may not be supported by the service provider.]'\
'-deletepppoeservice <service name>[Delete the PPPoE service.]'\
'-setpppoeaccountname <service name><account name>[Sets the account name for the specified service.]'\
'-setpppoepassword <service name><password>[Sets the password stored in the keychain for the specified service.]'\
'-connectpppoeservice <service name>[Connect the PPPoE service.]'\
'-disconnectpppoeservice <service name>[Disconnect the PPPoE service.]'\
'-version[Display version of networksetup tool.]'\
'-help[Display these help listings.]'\
'-printcommands[Displays a quick listing of commands (without explanations).]'
}

0 comments

Showing tabs in Vim

Now that the lab has decided to use Python, I occasionally run into the dreaded "indentation error" that is darn near impossible to find by eye. This is often due to differences in text editor settings, diff'ing two files, etc. 

I've looked for some easy solution on this, the most common retort is "use a decent editor". Which by decent, they mean whatever you're not using right now and if you follow the suggestions you end up playing marry-go-round with all the most popular editors (emacs, vim, textmate, komodo, Wing, whatever). 

Well, this is the best actual solution I've found when it rears its ugly head.  In vim:
:syn match TAB_CHAR "\t"
:hi link TAB_CHAR Error

After that, you'll see nice highlighted dots showing the indentation depth. Ugly, but then you can pick out the tabs. I'm sure all the other excellent editors above also have this ability. :)



0 comments

Agile Project Setup for Python

This is a quick summarization of the screen casts found at ShowMeDo. It's a good quick reference for getting a project up and going with nosetests, easy_install, virtualenv, pastescript, and sphinx for documentation.

This is not intended to be a zero to go walk through or a cut/paste example. Depending on particular setup, you may need to install various modules before hand etc. For information on doing so, refer to beginner python tutorials and the respective package sites.

$ virtualenv mydemo
$ cd mydemo && source bin/activate
(mydemo) $ easy_install pastescript
(mydemo) $ mkdir src && cd src && paster create mypackage

We want our modules available to interactive shells and such so
(mydemo) $ cd mypackage && python setup.py develop

Setting up testing
(mydemo) $ easy_install nose
(mydemo) $ easy_install coverage

Finally, we install sphinx for professional looking, easy to maintain documentation.
(mydemo) $ easy_install sphinx

Install whatever else you need and you're ready to go.

Many thanks to Christopher Perkins for putting together the screen casts that I based this quick reference on.

0 comments

*FIX* mod_rewrite: could not init rewrite log lock in child

Ran into this issue a couple of times already, duplicating it here so I dont' have to go dig for it again:

Error
[crit] (2)No such file or directory: mod_rewrite: could not init rewrite log lock in child

Fix
<IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteCond %{REQUEST_METHOD} ^TRACE
     RewriteRule .* - [F]
</IfModule>
 

To this:

<IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteCond %{REQUEST_METHOD} ^TRACE
     RewriteRule .* - [F]
     RewriteLog /var/log/apache2/rewrite.log
     RewriteLogLevel 0
</IfModule>


Original reference is here

0 comments

Auto-Configure OSX clients for BackupPC

This script auto-configures osx 10.4-10.5 clients for backup via BackupPC. It creates a hidden backuppc user with standard permissions. Limits that users sudo permissions to rsync, sets up public/private key authentication, fliters all incoming ssh connections using that key to only allow rsync commands.

The project also comes with a Launchd Daemon that starts backuppc at startup and keeps it alive if anything happens.



0 comments

HandBrakeCLI Presets

Found this over at snipplr, thought I'd duplicate here for my own reference:

1) AppleTV
./HandBrakeCLI -i DVD -o ~/Movies/movie.mp4 -B 160 -R 48 -E AAC -e x264 -f MP4 -m -p -b 2500 -x bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:no-dct-decimate=1:trellis=2
 
2) iPod
./HandBrakeCLI -i DVD -o ~/Movies/movie.mp4 -B 160 -R 48 -E AAC -e x264b30 -f MP4 -m -b 1500 -x frameref=1:bframes=0:nofast_pskip:subq=6:partitions=p8x8,p8x4,p4x8,i4x4:qcomp=0:me=umh:nodct_decimate
 
3) PS3
./HandBrakeCLI -i DVD -o ~/Movies/movie.mp4 -B 160 -R 48 -E AAC -e x264 -f MP4 -m -p -b 2500 -x level=41
 
4) PSP
./HandBrakeCLI -i DVD -o ~/Movies/movie.mp4 -B 128 -R 48 -E AAC -e FFmpeg -f MP4 -m -b 1024

original link snipplr.com

0 comments

Command Line Group Management

Adding a user:
dscl . append /Groups/admin GroupMembership gneagle

Removing a user:
dscl . delete /Groups/admin GroupMembership gneagle

Reading the membership of the admin group:
dscl . read /Groups/admin GroupMembership


This comes with a nod to Managing OSX

0 comments

Disable Extended Attributes for Tar Backup

To disable the tar'ing of extended attributes (those pesky ._foo files), export the following variable:

For Tiger:
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true

For Leopard:
export COPYFILE_DISABLE=true


0 comments

Using Cyberduck

Cyberduck is an SFTP (Secure File Transfer Protocol) GUI that is extremely intuitive and easy to use. It works much like that old stand by FTP, but with the added goodness of encryption.

This screencast walks through the steps needed to connect to the Hoffman2 cluster using Cyberduck, how to make a bookmark for quick connections, and how to store your password in your keychain.

This program is free and open source. Remember to donate if you appreciate the author's work so they'll continue to make incredible, useful applications like this one.

0 comments

Fixing errant Share Points

Recently, I ran into an issue where Share Points which were removed from Server Admin were showing up as stale links in my clients. Though not deal breaking, it was annoying as it indicating some sort of corruption in my ldap configuration. 

After digging around, I found that the records still existed in my server's LDAP under /Mounts. Including a duplicate entry for my /Network/Applications entry. By removing these and reloading the clients automount (sudo automount), everything went back to normal.

0 comments

Leopard Server Postfix TLS Error: cannot get private key from file /etc/certificates/mycert.key

The problem here is that postfix is failing on encrypted TLS certs and OSX ServerAdmin created certs are encrypted. The fix is, as should be expected, to unencrypt the cert:

  1. cd /etc/certificates
  2. cp mycert.key mycert.key.saved
  3. openssl rsa -in mycert.key -out mycert.key.out
  4. cp -p mycert.key.out mycert.key
  5. postfix reload

* credit to the apple discussion forums.

0 comments

Creating postfix aliases

Just a reminder of the postfix alias flow. I don't do it enough to remember off the top of my head and this saves me the google time.

  • edit /etc/aliases or /etc/postfix/aliases (one is a symlink to the other)
  • # postalias /etc/aliases
  • # newaliases
  • # postfix reload

0 comments

Fix for missing X11 libraries in Leopard

This solution comes straight from Penny Smalls. I've just put it here for personal reference.

Some small breakage in Leopard - it seems a couple of parts of X11 have been removed. Starting my rails setup, which has GraphicsMagick installed (read here for how), results in this:

dyld: NSLinkModule() error
dyld: Library not loaded: /usr/X11R6/lib/libdpstk.1.dylib
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.9/lib/RMagick.bundle
  Reason: image not found
Trace/BPT trap

Those dylib files do not exist any more. But… I have a backup (I hope you do). I ended up doing this:

$ cd /Volumes/BackupDisk/usr/X11R6/lib
$ sudo cp libdps*1.0* /usr/X11R6/lib/
$ sudo ln -s /usr/X11R6/lib/libdpstk.1.0.dylib /usr/X11R6/lib/libdpstk.1.dylib
$ sudo ln -s /usr/X11R6/lib/libdps.1.0.dylib /usr/X11R6/lib/libdps.1.dylib

All fixed.

0 comments

Compiling lapack 3.1.1 on Leopard

OSX contains an incomplete lapack library by default in the vecLib framework. But if you want the full power of lapack 3.1.1, you have to compile from source. This article documents that process, mostly so when I have to do it again I'll have a reference.

The first thing we notice is that OSX does not contain a fortran compiler in its developer tools. The gfortran project contains a nice dmg installer. Two other options are compiling from source or using macports. I chose macports.
  • $ sudo port install gcc43
Create some convenient links for standard gfortran calls.
  • $ sudo ln -sf /opt/local/bin/gfortran-mp-4.3 /usr/local/bin/gfortran
  • $ sudo ln -sf /opt/local/bin/gfortran-mp-4.3 /usr/local/bin/g77
Next download lapack.tgz source (current 3.1.1 as of this writing) and untar it.
  • $ tar xzvf lapack.tgz
Lapack does not contain the standard configure script, so we have to edit the make.inc ourselves. Copy the make.inc.example to make.inc, then apply this patch. Download file "make.inc.patch"
  • $ patch < make.inc.patch
That's it, all that's left is to compile. I do so with 6 make threads.
  • $ make -j6


0 comments

Fix for max attachment size stuck at 0 bug in leopard server

There's a bug in Server Admin which makes the max attachment size stick at 0 MB preventing file uploads. To fix this:

  • Manually set your preferred attachment size in /etc/wikid/wikid.conf under the maxattachmentsize key
  • Save file
  • restart the team server on the command line
    • sudo serveradmin stop teams
    • sudo serveradmin start teams

0 comments

Adding SharePoints for Leopard Client

As of Leopard client, SharePoints can be added via flat text files rather than directly with dscl. The files are located at:

/var/db/dslocal/nodes/Default/config/SharePoints

Located within this directory are plain text xml plists describing the SharePoints options. Creating a new SharePoint is as easy as copying one of these files and modifying the directory paths and share name attributes for the desired new share. Aslo, eliminated the sharepoint_group_id and the sharepoint_account_uuid since I do not know how to reproduce these.

After that, just stop/start AppleFileShare services:

# launchctl unload /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
# launchctl load /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist

The new SharePoint should be accessible to normal users as well as entered in the Local LDAP directory under SharePoints.

0 comments

Git Tips

Delete a remote branch

To delete a remote git branch from repo origin, the following syntax is used:

git push origin :heads/branch_to_delete


Delete a remote branch from your local repository

git branch -d -r origin/branch_to_delete

Note that this does not remove the branch from the main repo.

0 comments