Archive for category TextMate

Shell and Automator

I’ve been doing far too much “punditry” the past few weeks here. So I wanted to give a few tips.

To start let me give a great way to keep infrequently used shell scripts. If you are like me you have some shell commands you run only occasionally. For instance when I am trying to debug a network I often use nmap (installed via MacPorts). However because I do it so infrequently I have to remember the arguments to the command and then how I mapped the NAT. (Some networks use 10.0.0.x while others use 192.168.1.x and others 192.168.0.x) So I put the following as a service in Automator.

nmap -F 192.168.1.0-255 | mate

This makes it easy to find the machine I need to ssh into. (I make several automator actions for each network) I can also see, from a security point of view, what services are up (and what services shouldn’t be up).

Read the rest of this entry »

2 Comments

TextMate, Regex and Replace

OK, just a tip to those beating their heads against the wall. TextMate’s sed like functionality uses $# for referring to groups and not /# like sed. Yeah, dumb. I know. I should have searched in the manual.

It does illustrate some useful things to do with TextMate though. (This would work with BBEdit as well) My bank keeps old statements but only as PDFs. I need it in a spreadsheet. Now for various reasons selecting tables in Safari’s PDF viewer doesn’t work well. (I use the default PDF viewer rather than Adobe’s as it is a little lighter weight and doesn’t have a big toolbar) So I open the document up in Acrobat, copy the text into TextMate and do the following search and replace (with the regex toggle selected).

Read the rest of this entry »

2 Comments

Man Pages in Preview and Textmate

Someone put up a nice Bash script to view man pages in Preview. The one downside is it’s a tad slow and only really gives you bold text.

I tend to use the following more:

Read the rest of this entry »

5 Comments

TextMate, Python and Whitespace

OK, while I love Python I have exactly the same grumble you probably do about programming in it: whitespace. It’s bad enough when you get someone else’s code in C or C++ and they have these funky tab stops and indentation style. (As an aside, I had the hell of taking over someone’s rather extensive code which had few comments, 3 space tab stops and an odd indentation style. All it had going for it was the lack of polish styled naming convention. Thank heavens.) The problem in Python is that indentation determines your code block. So if you screw it up the interpreter gets mad. However Python lets you use either spaces or tabs so long as you are consistent. Needless to say being inconsistent is far too easy – especially if you are cutting and pasting from someone else’s code.

The solution?

Read the rest of this entry »

No Comments