Bash function mac2unix

A new addition to my .bashrc, a bash function that will swap Macintosh newlines for UNIX ones: function mac2unix() { sed 's/\r/\n/gi' } To use it, pipe it as so: cat file.txt.bad-newlines | mac2unix > file.txt This will convert Macintosh newlines from files that Mac friends forgot to upload in ASCII mode. If this is not done, programs will ignore the Macintosh newlines and files will have no newlines, which goes without saying is very annoying.

A quick domain HTTP permanent redirect script for Apache/PHP

I mentioned earlier that to get my old domains, tamasrepus.hotnudiegirls.com and tamasrepus.rhombic.net delisted from search engines, I was going to write a redirection script that would send an HTTP status 301 (permanent redirect) to anything that tries to access those domains. It would send them to this current domain (samat.org).

And I did. So, behold the script (save as index.php):

Simple enough. More is needed, though: the web server needs to be told to use this script for all URLs. You can do this easily with Apache and the ErrorDocument directive:

ServerName tamasrepus.hotnudiegirls.com DocumentRoot "/path/to/directory/containing/script" ErrorDocument 404 /index.php

Topic: 

Giving up on my bookmarks system and joining del.icio.us

I wrote my bookmark system a few years ago because I had no good way for sharing bookmarks online, or amoung web browsers on different machines on different platforms. I’ve not ported it from the old site to this new one, and I’m not sure I care… While my bookmark system did what I wanted it to do, it was not flexible. I look at the PHP code I wrote and remark: I hate this.

So, I now use del.icio.us. Am I now a Web 2.0 (I hate that term) loser now?

Topic: 

Pages

Subscribe to Samat Says RSS