This post helped me out
Applescripting out that VIM error
I have a frequent problem where my VIM window is too large for my macbook screen but it fits on my external monitor, so when I unplug the external the VIM file bar gets stuck behind the Mac OS menu bar. It's a huge pain to fix this normally, but I wrote/stole an applescript to fix the problem:
try tell application "Vim" activate end tell tell application "System Events" tell process "Vim" set size of the first window to {1000, 200} set position of the first window to {50, 50} end tell end tellend try
Awk sexagesimal to decimal conversion
In VIM I often need to convert columns of RA/Dec from Sexagesimal into Decimal format. %!awk '{ra = ($2+$3/60+$4/3600)*15; dec = $6+$7/60+$8/3600; print $1,"ra=",ra,", dec= ",$5,dec}' The far more irritating inverse operation: `` %!awk '{h=($2/15); h=h-(h%1); m=($2-h*15)/15*60; m=m-(m%1); s=($2-h*15-m*15/60)/15*3600; d=-($3-$3%1); am=(-$3-d)*60; am=am-(am%1); as=(-$3-d-am/60)*3600; printf "%s %02i:%02i:%02.2f, -%02i:%02i:%02.2f %s %s %sn" , $1,h,m,s,d,am,as,$4,$5,$6}' ``
Back to site editing
I'm editing class web pages, php, cgi, etc. again. I don't think I ever really understood how to do this, but I'd like to know how to use PHP to fold text. That would be sweet. I found it by googling this time. This is really the right way to do things: http://help.blogger.com/bin/answer.py?hl=en&answer=42214 Of course, it's pretty disappointing that it doesn't work with the non-classic template for blogger.
BASH discoveries, readline questions
1. `` shopt -p `` Maybe my hostname completion worked and then stopped working because the bash option hostcomplete was not set. Duh! Why? I don't know. Anyway, `` shopt -s hostcomplete`` solves the problem. `` nocaseglob `` is also pretty cool (case insensitive tab completion) 2. it's really hard to search for readline stuff on google. Can anyone explain to me how BASH readline works? I would REALLY like to make bash readline work like ipython, in which you can start typing a command and hit the 'up' key to search through the history for anything beginning with the stuff you've typed up to that point. But I can't even find documentation for the ipython readline! Any hints, anyone? 3. my desktop at work blocks ssh connections. I can ssh into some computers and then into it, but not directly into it. ...as usual, I made a list where not-a-list would have sufficed, and I had to add the last thing because a 2-item list is dumb.
CGI errors on Origins
First step:
tail -f /usr/local/apache/logs/casa/casa_error_log
Then, make sure .htaccess has the right lines.
AddType text/html .htmAddHandler application/x-httpd-php .php .htmAddHandler server-parsed .htm .htmlAddHandler cgi-script .cgi .pl
command line & escape key
Problem: in both the bash command line and ipython, if I hit escape twice, I can never again do history-search-backwards (i.e. when you type part of a command and type "up" and reverse-search through your command history). Any idea how to fix this?
Command of the Day
`` ls | wc `` and for when `` ls * `` fails `` find . -name "*" | xargs -I {} mv {} away/ ``
cython vs f2py
I had a go at optimizing some code this past week, and ended up learning to use both cython and f2py. f2py is much easier to use. If you want to write a function in fortran and use it in python, all you do is write the code and add specifications using comments in the fortran code. cython is more natural to code. The code style is C/fortran-like: think in terms of loops instead of arrays. The syntax is python-like, which makes coding somewhat clearer and simpler. For my code, I found that cython was ~10% slower than fortran. Check out the plfits in: http://code.google.com/p/agpy/source/browse/#svn/trunk/
Do not install 10.5.5
Well, I didn't obey that excellent advice from Charles. I installed the 10.5.5 update. Now DS9 - in my opinion, one of the heartiest and most reliable programs I've dealt with in the astronomy world - won't work because TCL is broken. I doubt TUI or most of the other things I use will work either. That's a tragedy of significant proportions - I NEED ds9 to make my observing files! I can only pray that an update of TCL using port will work... if not I'm basically screwed.
Page 1 / 6 »