0 notes

Emacs - change style of word wrapping


use word wrap

M-x visual-line-mode
Emacs displays long lines by truncation

M-x toggle-truncate-lines
1 note

R and colors from another dimension

I like to have a "x vs. y"- plot in which the symbol colors represent a additional (or another :-) dimension z.

I’m sure that there are several ways to do that, however here is the way I understand.

Assume that x, y and z have the same length n :

    n <- length(y)

At first I generate a vector from z (z will give the color) in the interval [0,1]

     zp   <- z - min(z)    ## zp starts from 0
     zpp <- zp/max(zp)  ## zpp ends at 1

If I now multiply zpp by n I get a nice index vector which can be used together with the result produced by colorRampPalette():

     cf <- colorRampPalette(c("blue","yellow","red"))

cf is a function. It’s argument is the length of the color vector which should be returned. Now put everything together:


Here is a complete example:

This is how it looks like:


2 notes

Find MAC address of computers on a Network using nmap


Find all mac address of machines on a LAN network using nmap by running the following command in a Linux terminal as root:

$ sudo nmap -sP 192.168.1.*
1 note

how to put your logo in a QR code
11 notes

couchapp git and yuidoc

Up to now the generation of documentation out of javaScript sources don’t seem to have a standard tool.

I’ve tried yuidoc and have to say that I’m not complete convinced. The pros and cons of yuidoc are a story for itself.

However I’ve worked out a (conceptual) way which combines my daily tools couchdb couchapp and git for having the latest documentation (generated by yuidoc) online and moreover offline.

Install yuidoc

There are official repos on opensuse.com providing the python stuff. With this the installation goes like described in the INSTALL file after extracting the zip:

 1. Check to see if setuptools is installed.
     Execute this command:
         which easy_install

     If it returns something, it's installed skip to step #3.

 2. Install Setup Tools:
     Extract the archive in ext and install the package
     sudo python setup.py install (no sudo needed for cygwin or windows)

         cd ext
         tar xfvz setuptools-0.6c9.tar.gz
         cd setuptools-0.6c9
         sudo python setup.py install

 3. Install the dependencies

     easy_install pygments
     easy_install Cheetah
     easy_install simplejson

 4. Make a copy of yuidoc/bin/example.sh and modify the paths to suit your

If you speak a lang with strange letters (öäü) you should replace line 57 in yuidoc_highlight.py with:



The example.sh from point 4 is the script you have to modify and execute. This is nice, since you can simply use the script as post commit hook

cp  yuidoc/bin/example.sh  ~/..project../.git/post-commit

You can set some variables in that script e.g.:

version=`git log --pretty=format:"%ad-%an-%H" --date=short -n 1`

to display some version information on the page.

Use a couchapp!

I have to document a couchapp I wrote. Here, my first attempt was: make a folder below _attachments and let the html arise in there failed. Rewriting the


to adapt the server pathes is simply to much work. Therefore this idea:

  • Generate a couchapp project-doc and strip it down to the bones:

    /dir> ls project-doc/
  • set the variables in the shell/hook-script to



  • couchapp push
  • visit http://localhost:5984/db_name/_design/project-doc/index.html

Also the deployment can be activated via the shell/hook-script. Add

cd path/to/project-doc && couchapp push

at the last line. If everything works fine you got a fresh source code documentation on every commit.

gitweb apache config

After hs in config hell this:

    Alias /git /srv/www/htdocs/git
 <Directory /srv/www/htdocs/git>
     Options ExecCGI  Indexes  +FollowSymLinks
     AddHandler cgi-script cgi
     DirectoryIndex gitweb.cgi
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^.* /git/gitweb.cgi/$0 [L,PT]

works for me placed in a gitweb.conf below


Do so if you want to provide git (bare) repos over apache …

Don’t forget to

 touch git-daemon-export-ok

otherwise you will get a 404 No- projects found. Also execute

git update-server-info

and enable the sample post-update hook

13 notes

the markdown format (e.g. used at github.com) can be converted to html using:

 perl Markdown.pl --html4tags ../map/README.md > ../map/index.html

the src for the perl script can be downloaded at http://daringfireball.net/projects/markdown/

3 notes

(defun foo () ;;insert whatever)

in ~/.emacs say

(defun foo () 
" bar <- function(ccc){

(previous-line 8)


M-x eval-buffer

one can always

 M-x foo

resulting in

bar <- function(ccc){

25 notes

Copy streamed video from cache [linux]


cp $(file /proc/*/fd/* 2>/dev/null | grep -i flash | cut -f1 -d: | head -n 1) video.flv

43 notes

Delete Backwards To BOL in Emacs | Irreal


Oh, I have gots to remember this.

BOL means beginning of line (such as BOWLING means beginning of white line in general)

1 note

build a json file and POST to couchdb

tip by Jan Lenardt @ couchdb mailing list

echo '{"docs":[' >> file.json
cat productSimple.json >> file.json
echo ']}' >> file.json
curl -d @file.json -X POST http://localhost:5984/bbyopen/_bulk_docs -H
                                                               "Content-Type:    application/json"
28 notes


generates regExp from nobrainer * expressions

> glob2rx("foo*.bar.*baz")
[1] "^foo.*\\.bar\\..*baz$"
37 notes

ProTip: tar over ssh to a remote host


Handy when there isn’t room to make a tarball locally.

tar cjf - foo | ssh tumblr.com 'cat >foo.tar.bz2'
9 notes