gorn.ch

Tobias Ebnöther's personal blog

xchat on OSX / Command as alt

Hi all, long time no see :)

Lately I got more and more unstatisfied with Colloquy so I decided to go back to xchat. Since xchat aqua seems unmaintained I opted for "the real thing" on X11. Unfortunately MacPorts once again failed to build it (I think I never managed to sucessfully build something with it that has some deps) so I had too look for something else.

Bruno pointed me at Homebrew which looks totally awesome. There was no Formula for xchat but it was pretty easy to create one. After only two hours my commit was accepted and it's in the main branch now :)

To be able to nicely switch channels I decided to map the command (⌘) key to alt aka meta. For that purpose I added the following lines to my ~/.Xmodmap:

clear Mod1
clear Mod2
keycode 63 = Meta_L
keycode 66 = Mode_switch
add Mod1 = Meta_L
add Mod2 = Mode_switch
Related Entries:
Setting up relayhost for postfix on OSX (with ssl and authentication)
MacHeist Software Bundle
Leopard native apache with custom (64bit) PHP
Leopard PHP / Apache Package with pecl support
Taming firefox temp files on osx
Comments (4)  Permalink

Setting up relayhost for postfix on OSX (with ssl and authentication)

Ok several co workers asked me how to make the command line mail tool use a proper mailserver under osx. The problem is that it sends mails directly which will not be accepted by most of the mailservers.

If you only want to send your mail plaintext over a mailserver and not use any authentication you just have to add this line to your /etc/postfix/main.cf:

relayhost = gorn.ch

If your mailserver allows SSL encryption you should also add the following lines:

smtp_sasl_auth_enable = yes
smtp_sasl_security_options =

Now finally if your mailserver requires a login you need some more steps to do. First add the following line to your main.cf:

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Now create a file called /etc/postfix/sasl_passwd make sure it's only readable by root because you will have to put in your password there the syntax looks like this:

gorn.ch username:password

Finally run this and you should be good to go. Send a mail over the commandline to make sure it works. :)

sudo postmap hash:/etc/postfix/sasl_passwd
Related Entries:
xchat on OSX / Command as alt
MacHeist Software Bundle
Leopard native apache with custom (64bit) PHP
Leopard PHP / Apache Package with pecl support
Taming firefox temp files on osx
 Permalink

MacHeist Software Bundle

A few days ago I bought the macheist bundle. In my opinion this years bundle is great. I allready converted nearly ALL of my useraccounts to 1password generated password. Played around with snapz pro (now I can blog cool screencasts in great quality :) and CSSEdit. Also I used AppZapper to Zap iStopMotion since I will not produce a movie anyways, just wanted to take a look. Probably more detailed reviews will follow.

But now to get more (free) apps you need to referr people to buy it. Actually I don't like to do this, but I like to get free apps :) So if you read this and are going to buy the bundle, please use this link: https://www.macheist.com/buy/invite/89925
Related Entries:
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
Leopard native apache with custom (64bit) PHP
Leopard PHP / Apache Package with pecl support
Taming firefox temp files on osx
 Permalink

Leopard native apache with custom (64bit) PHP

With massive! help from Marc Ammann I was able to build a PHP Binary that loads with the Leopard shipped Apache.

First I got iconv source from apple and took the libiconv/include/iconv.h.build.in file. It seems that apple uses different headers in the build process than installed. So the build headers use precompiler flags that gcc doesn't know (it's most likely some sort of XCode stuff which I don't know anything about). After removing that stuff the file looks like this.

With this file as a replacement for /usr/include/iconv.h PHP will build with CFLAGS='-arch x86_64' and load with the native apache afterwards. It's even possible to build the pecl memcache extension like that (but don't forget the right arch).

For completion that were my configure flags:
CFLAGS='-arch x86_64' ./configure \
'--with-zlib' \
'--with-apxs2=/usr/sbin/apxs' \
'--prefix=/usr/local/php5' \
'--with-iconv' \
'--with-xsl' \
'--disable-xmlreader' \
'--with-jpeg-dir' \
'--with-png-dir=' \
'--enable-bcmath' \
'--with-curl' \
'--with-ldap' \
'--enable-mbstring' \
'--enable-soap'
Related Entries:
Leopard PHP / Apache Package with pecl support
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
Jackalope presentation and status
MacHeist Software Bundle
Comments (8)  Permalink

Leopard PHP / Apache Package with pecl support

After some hours of blood and sweat I finally managed to get a nicely working Apache / PHP Setup (YES! With a working version of pecl).

I usually us the great! package from Marc which does unfortunately not work nicely on Leopard yet (I hope it's not too much stress for him :) ).

Until he is done (and I switch back) I can provide this package which is very dirty and untested (works for me).


If you'd like to install it try like that:

Unpack to /usr/local like this
cd /usr/local
tar xjvf <the package>

Then you need to make some changes in /etc/apache2/httpd.conf
Change the following line:
ServerRoot "/usr"
To this:
ServerRoot "/usr/local/httpd"

COMMENT (type a # on the beginning of the line) the following lines:
LoadModule cache_module libexec/apache2/mod_cache.so
LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
LoadModule bonjour_module libexec/apache2/mod_bonjour.so

Finally UNCOMMENT (remove the #) this line:
#LoadModule php5_module libexec/apache2/libphp5.so

Now you just need to start your brand new apache / php setup like the following:
sudo /usr/local/httpd/sbin/apachectl start 


If you want to build your own setup here is what I did:
Related Entries:
Leopard native apache with custom (64bit) PHP
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
Jackalope presentation and status
MacHeist Software Bundle
Read whole postComments (4)  Permalink

Taming firefox temp files on osx

It's very annoying on OS X Firefox saves temporary files on your desktop per default. So you'll get a bunch of PDFs on your screen after a hard work day ;)

Here is how to fix it:
  • Change the Download Folder in Safari, Firefox uses it as tempDir.
  • Add the following key to your config to keep the tempDir clean (Firefox will delete temp files after closing): app.helperApps.deleteTempFileOnExit = true
Related Entries:
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
MacHeist Software Bundle
Leopard native apache with custom (64bit) PHP
Leopard PHP / Apache Package with pecl support
 Permalink

NetNewsWire Lite vs Vienna memory usage

Today I tried to optimize my memory usage a little since OS X is swapping a lot. I switched from Vienna to NetNewsWire about two months ago because Vienna used to crash a lot, what seems to be fixed now. I decided to test which one uses less memory and just use that.

Both clients are scanning the same ~100 feeds every 30mins. For the test I will mark every entry as read "one by one" (vie space key) and don't use the flag features etc. (not available in NetNewsWire Lite anyways). I started to monitore the memory usage like that:
echo "`date +%s`;`ps cux | egrep 'Vienna|NetNewsWire' |\
awk -v ORS=';' '{print $11 ";" $5 ";" $6}'`"

Soon I realized that output wouldn't be easy to plot, then I decided to write a little script and run it via launchd every 30s. Here is the code:

#!/bin/bash
echo -n "`date +%s`;"

for arg in "$@"; do
MEM=`ps cux | grep $arg | awk '{print $5 ";" $6 ";"}'`;
if [ -z $MEM ]; then
echo -n ";;";
else
echo -n $MEM
fi
done
Use it like that:
memory.sh NetNewsWire Vienna
After 24h of data collection I decided to stop the test and see the result. I like gnuplot to visualize my data so here is the setup:
set terminal png
set output rss_readers.png
set key top left box
set ytics 2.5
set grid y
set ylabel 'MB Memory'
unset xtics
set datafile separator ';'
plot "memorystats.txt" using ($3/1024) title 'NetNewsWire Lite' with lines,\
"memorystats.txt" using ($5/1024) title 'Vienna' with lines

And that's the Result:
Low High Average
NetNewsWire Lite 20.16 68.00 44.59
Vienna 22.96 68.35 41.28
Nearly the same memory usage.
As you can see the memory usage is nearly the same and both are slowly consuming more memory over the time (24h - some hours in hibernate).

Conclusion:
  • Missing data on the time axis (hibernate hours) sucks. I can probably do a little more tuning with gnuplot but didn't try to manipulate axes by now. [Give me a hint if you're good with gnuplot, I'd like to just skip those parts in the axis.]
  • Both RSS Readers are consuming nearly the same amount of memory, growing over time.
  • After having Vienna back for the first couple of hours I already decided to prefer it over NNW Lite. I regularly missed the search and flag functions.
Related Entries:
Nice screenrc and common keystokes
Living with Terminal.app
Fixing the delete key in Terminal.app
tail -f to growl
xchat on OSX / Command as alt
Comments (1)  Permalink

Start memcached with SystemStarter

I used to start Memcached via launchd for a while now. Today I realized that it will use a lot (128MB) of memory after running a couple of days. I searched after a better solution and found this script which will start memcached via StartupItems/SystemStarter.

What I do now is reload Memcached every hour via launchd to purge the memory.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.server.restartMemcached</string>
<key>ProgramArguments</key>
<array>
<string>SystemStarter</string>
<string>restart</string>
<string>Memcached</string>
</array>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>
Related Entries:
Start memcached with launchd [Updated]
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
MacHeist Software Bundle
Leopard native apache with custom (64bit) PHP
 Permalink

MacBook Pro Hibernatemodes

Tonight I got inspired by this article and started to play around a bit with the OS X hibernate modes. The first thing I did was to just try out both modes with all application I had opened at the moment. Then I wanted to know how the performance is when some applications were running. Those tests are very primitive since swap was still active and I didn't got a nice stopwatch, so here are the first results:

RAM Usage ~350MB
Hibernatemode 0: 35s
Hibernatemode 3: 40s

RAM Usage: ~1.4GB
Hibernatemode 0: 35s
Hibernatemode 3: 48s
I found it quite interesting that the safesleep mode didn't took more than a couple of seconds longer to go to sleep so I figured out a nicer test environment. I disabled the swap space and created a 1GB ramdisk. (In fact I tried to create more ramdisks but didn't manage to get more than ~1.3GB of memory active). The first test was just after booting up, the second with a full ramdisk. In both cases where very less programms running so the OS could go to sleep without interruption.

PhysMem:   124M wired,  134M active,  641M inactive,  900M used, 1.12G free
Hibernatemode 0: 35s
Hibernatemode 3: 38s

PhysMem: 132M wired, 1.23G active, 630M inactive, 1.98G used, 25.5M free
Hibernatemode 0: 35s
Hibernatemode 3: 40s

My final conclusion is to stick with the default safesleep hibernatemode 3 since the difference is very little and rarely I don't manage to get to a power-plug in time.
Related Entries:
xchat on OSX / Command as alt
Setting up relayhost for postfix on OSX (with ssl and authentication)
MacHeist Software Bundle
Leopard native apache with custom (64bit) PHP
Leopard PHP / Apache Package with pecl support
 Permalink

Living with Terminal.app

Ok. My Terminal.app escapade has a bit gone out of hand so I decided to make a new post with all settings I changed.

Open your Terminal.app preferences and set it to xterm (xterm-color doesn't work very well in most places).

Open the window settings and delete all Settings for page up / down, home, end and delete (with all modifier variations).
Now set it up like this:
Home:		   \033[~1
End: \033[~4

Shift + Home: scroll to start of buffer
Shift + End: scroll to end of buffer

Delete: \033[~3

Page Up: \033[~5
Page Down: \033[~6

Shift + Page Up: scroll to previous page in buffer
Shift + Page Down: scroll to next page in buffer

To get a nice behaviour on the shell now edit your ~/.inputrc like this:
# Be 8 bit clean.
set input-meta on
set output-meta on
set convert-meta off

# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# mappings for "page up" and "page down"
# to step to the beginning/end of the history
"\e[5~": beginning-of-history
"\e[6~": end-of-history

At last to get Shift+Page working with screen add the following lines to your ~/.screenrc:
termcapinfo xterm ti@:te@
defscrollback 1 #Will be handled localy

I learned a lot from this article but it was a bit imprecise concerning to the page up / down buttons and didn't provide the screenrc options. That's why I decided to make a new post.

Update:
To remove the scrollbar while not losing the buffer in your Terminal.app edit the following lines in your .term or .plist file:

<key>Scrollbar</key>
<string>NO</string>
Related Entries:
Fixing the delete key in Terminal.app
Nice screenrc and common keystokes
NetNewsWire Lite vs Vienna memory usage
tail -f to growl
xchat on OSX / Command as alt
Comments (5)  Permalink
Next1-10/13
Powered by Flux CMS