Go to the navigation

elblogg

Posts Tagged ‘blogging’

Blogging code

As a programmer and linux geek I often need, or at least want to write about code, scripts and commands on my blog, but as many of you know, displaying raw code in HTML is setting yourself up for failure. The simplest part of the problem is the fact that line breaks and whitespace might be significant, this is simply solved by putting the code inside a <pre> block. The more tricky part is that code often is full of characters like &, > and <. Characters that have a specific meaning in HTML and can’t be echoed directly. & needs to be typed as an HTML entity (&amp;), just as > (&gt;) and < (&lt;). Talking about HTML and XML code on your blog can be a really tedious task (as the above).

I have usually solved this by writing the code in a file first, and then running the file through this sed command

cat file.html|sed -e 's/&/&amp;/' -e 's/</&lt;/' -e 's/>/&gt;/'

But as I work on a Macintosh these days, I’ve been using TextMate a bit.. Not as much as i use OpenKomodo though. TextMate has some nice blogging capabilities. You can use it to post directly onto your blog, and it has shortcuts for converting sections of your post into HTML entities. Just select the text, and hit ⌘+&, 1

Edit: it seems like there is some compatibility problems with WordPress 2.7 and TextMate. The post was published two hours off, and as a private post.

meme – top commands

Okay… I give up.. now that pretty much every tech blogger in my google reader have done this, I’ve decided to do it too…

My new laptop:

$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
85 cd
67 ssh
56 ls
50 sudo
32 scp
23 mplayer
18 gpg
14 python
13 find
11 vim

My server in Texas

~$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
76 sudo
72 screen
51 vim
48 cd
26 ls
25 mysql
18 convert
18 cat
14 apg
12 wget

# history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
92 cd
82 vim
78 tail
76 ls
19 /etc/init.d/apache2
16 ln
15 bash
14 rm
14 cp
13 less

And my home-theatre PC, home server etc…

~$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
142 ls
100 cd
58 rm
29 unrar
28 df
20 du
14 sudo
14 mv
12 find
11 vim

Things I want to do

Before I turn 30? … yeah, yeah…. the timespan isn’t that important (the order is random)

  • Go to a UK D’n'B rave (Guess this can be checked soon :) )
  • Go to a Dutch Gabba rave
  • Go to an italian italo-party
  • Participate in the Bergen-Voss bicycle race 2008 and/or 2009
  • Participate in the Trondheim-Oslo bicycle race (den store styrkeprøven)
  • Loose one third of my bodyweight
  • Buy a house
  • Have kids
  • Finish my education
  • Write an article for Python Magazine
Bloggurat Twingly BlogRank Blogglisten