Posts

Showing posts from November, 2009

Sorted and aggregated disk usage script

I've been asked for this script many times lately, so I'll publish it. It lists the disk usage of subdirectories in a given directory in descending order, right justified and suffixed with kilobytes or megabytes appropriately. #!/bin/sh display() {  local DIR=$1  du -sk $DIR/..?* $DIR/.[!.]* $DIR/* 2>/dev/null |   sort -n |   awk '    {     size = $1;     sum += size;     name = $2;     if ($1 < 1024){      printf("%9ik %s\n",size,name);     } else {      printf("%9.3fM %s\n",size/1024,name);     }    }    END{     print sum " kiB"    }   ' } main() {  local DIR=$1  if [ "$DIR" = "" ]  then   display $HOME   quota  else   display $DIR  fi } main "$@"

Rapid serial visualisation for portable book reading

I've received the following link recently that I believe I have already stumbled upon earlier. Rapid Serial Visual Presentation (Wikipedia) I didn't see much perspective for it before, but I've given second thought now. Just imagine a tiny note taking device which combines the above speed reading technique with a chorded keyboard (like the DataEgg )!

Haskell IDE

Gtk+: Leksah - Haskell IDE in Haskell built on Gtk+ and gtk2hs ( HaskellWiki: Leksah ) Eclipse : EclipseFP - functional programming support for Eclipse (Installation experience and comments: 1 , 2 ) Emacs : Haskell Mode for Emacs from Svein Ove Aas (previous maintainer was Stefan Monnier: 1 , 2 ) (TODO: is (setq haskell-font-lock-symbols 'unicode) the default?) , MMM (Multiple Major Modes) Mode for Emacs , scion-lib Haskell IDE library , HaRe -- The Haskell Refactorer Vim : Haskell mode for Vim , Superior Haskell Interaction Mode (SHIM): GHCi integration for VIM , Vim as a Haskell IDE, first steps illustrated tutorial, scion-lib Haskell IDE library , HaRe -- The Haskell Refactorer And of course we all know what xkcd: Real Programmers use. I'm eagerly awaiting your feedback!

Converting between Bird-literate and plain Haskell

Literate programming is a good idea, and there exist many creative ways in which you could take advantage of it, like one described in Literate Haskell with Markdown and Syntax Highlighting . However, if you're using the text editor Geany version 0.18, you will be faced with a bug that makes it unable to interpret Bird-style literate source. As a simple fix, I provide two programs to convert between simple Bird-literate and non-literate source code. You could also convert your Bird-literate to TeX-style . # bird_lhs2hs sed '   s/^>//   t   s/^ *$//   t   s/^/-- /  ' in.lhs > out.hs # hs2bird_lhs sed '   s/^-- //   t   s/^ *$//   t   s/^/> /  ' in.hs > out.lhs

DataRow.Delete with SqlDataAdapter

A note to myself. I've figured this out few years ago, but it looks like I forgot it... :-D Always use the Delete() method on the DataRow object instead of Remove(DataRow) on the DataRowCollection, or else the corresponding SqlDataAdapter.DeleteCommand won't trigger for an Update. So deleting from the table won't work, no execution will be done.

LALR-1 parseable C++

In The Design and Evolution of C++, Stroustrup observes that "within C++ there is a much smaller and cleaner language struggling to get out" [Stroustrup, B., The Design and Evolution of C++, Section 9.4.4., Addison-Wesley, 1994.] and foresees the development of "other interfaces" to C++. A Modest Proposal: C++ Resyntaxed by Ben Werther & Damian Conway (Department of Computer Science, Monash University) Significantly Prettier and Easier C++ Syntax (Wikipedia)

Eee Keyboard PC - C=64 rebirth?

Well, what do you know, it looks like history does repeat itself: Eee Keyboard splayed, detailed by FCC (Engadget) Trends Are Cyclical: the Asus Eee Keyboard (OSNews) ASUS Eee Keyboard (Wikipedia)