Sunday, October 26, 2014

Pope Joan by Emm. Roidis

Started reading this book a couple of days ago. It is satirical and sarcastic, written in a now abandoned, it is not as easy as the current spoken and written version of Greek, but it has its own elegance and power of expression. More about the writer and his work here

Saturday, October 25, 2014

Compiling a multiple file project in ocaml

When we compile a multiple file project in ocaml, we can use the following command:

ocamlopt -o progprog

If we are using the class or module in the first file in the second, then we need to open the module in the second file. After that inheritance works fine.

More about the ocaml tools here

Using fixtures in Django to import and export data

./ dumpdata --indent 2 > all.json
and load it in again on the dev server (I use git to transfer it but there’s probably a cleaner approach):
./ loaddata all.json

keep in mind that this will dump all the data from the database. if you want to limit the dump to a specific app you can do that. when loading if the data already exist in the database. you will get an error. so it is possible that you want to delete the tables before importing

Thursday, October 23, 2014

Handy ocaml code samples

A handy web site with code samples here. Especially for freshers like me :)

In order to compile my class i need to use:

corebuild eaBase.byte

it simplifies things a lot

and then ./eaBase.byte which calls the main and prints the result.

The official reference page is here

Wednesday, October 22, 2014

Globbing and zsh.

Globbing is a way of expanding wildcard characters in a non-specific file name into a set of specific file names. Shells use globbing all the time. For instance:
$ ls foo*
foo1 foo2
When you enter the above, you're using a glob: foo*. What the shell is doing, however, is interpreting that wildcard character (*) and then passing the actual files to list to the lscommand; so in this instance, the command that is actually being used is ls foo1 foo2.
Some standard wildcards that are often used include:
  • the asterisk (*) character for zero or more characters
  • the question mark (?) character for any single character
  • the [123] specifier, which indicates any of the characters 1, 2, or 3
  • the [0-9] specifier, which indicates any number between 0 and 9 (or [a-z] for any letters between a and z).
You can also use named ranges, such as:
  • [::alpha::] for any letter
  • [::alnum::] for any letter or number
  • [::lower::] for any lowercase character
When it comes to globbing, zsh is one of the most powerful shells with some very interesting wildcard characters that can be used. For instance, you can use glob qualifiers, which are characters with a special meaning. If you wanted to list all the symbolic link files in the current directory you would use:
$ ls *(@)
Some other zsh glob qualifiers include a forward slash (/) for directories and a period (.) for plain files; the zshexpn man page has a full list. If there are no matches, zsh will return an error; if there is nothing to pass to the ls program (or any other program), the program will not even be called by zsh.
There are other useful patterns, such as the (**/) pattern. What this does is tell zsh to match any number of directories to any depth, including the current directory. To find all the (*.sh) and (*.py) files in the current directory and sub-directories in a list suitable for parsing (i.e., perhaps in a script), you would use:
$ ls -1 **/*.(sh|py)
Finally, to enable extended globbing at all times, add this to ~/.zshrc:
setopt extended_glob
If you do decide to use extended globbing, be aware of special characters in file names and the need to quote them. For instance, if you want to copy files from a remote site using scp, you don't want zsh to expand any wildcards locally; you want that wildcard passed to scp for files on the remote end to match, so instead of:
$ scp hades:~/tmp/* .
zsh: no matches found: hades:~/tmp/*
You would need to use:
$ scp "hades:~/tmp/*" 
stollen from here

Monday, October 20, 2014

Ο ρωμηός του Σουρή

Ὁ Ῥωμηός

Στὸν καφενὲ ἀπ᾿ ἔξω σὰν μπέης ξαπλωμένος,
τοῦ ἥλιου τὶς ἀκτῖνες ἀχόρταγα ρουφῶ,
καὶ στῶν ἐφημερίδων τὰ νέα βυθισμένος,
κανέναν δὲν κοιτάζω, κανέναν δὲν ψηφῶ.
Σὲ μία καρέκλα τὅνα ποδάρι μου τεντώνω,
τὸ ἄλλο σὲ μίαν ἄλλη, κι ὀλίγο παρεκεῖ
ἀφήνω τὸ καπέλο, καὶ ἀρχινῶ μὲ τόνο
τοὺς ὑπουργοὺς νὰ βρίζω καὶ τὴν πολιτική.
Ψυχή μου! τί λιακάδα! τί οὐρανὸς ! τί φύσις !
ἀχνίζει ἐμπροστά μου ὁ καϊμακλῆς καφές,
κι ἐγὼ κατεμπνευσμένος γιὰ ὅλα φέρνω κρίσεις,
καὶ μόνος μου τὶς βρίσκω μεγάλες καὶ σοφές.
Βρίζω Ἐγγλέζους, Ρώσους, καὶ ὅποιους ἄλλους θέλω,
καὶ στρίβω τὸ μουστάκι μ᾿ ἀγέρωχο πολύ,
καὶ μέσα στὸ θυμό μου κατὰ διαόλου στέλλω
τὸν ἴδιον ἑαυτό μου, καὶ γίνομαι σκυλί.
Φέρνω τὸν νοῦν στὸν Διάκο καὶ εἰς τὸν Καραΐσκο,
κατενθουσιασμένος τὰ γένια μου μαδῶ,
τὸν Ἕλληνα εἰς ὅλα ἀνώτερο τὸν βρίσκω,
κι ἀπάνω στὴν καρέκλα χαρούμενος πηδῶ.
Τὴν φίλη μας Εὐρώπη μὲ πέντε φασκελώνω,
ἀπάνω στὸ τραπέζι τὸν γρόθο μου κτυπῶ...
Ἐχύθη ὁ καφές μου, τὰ ροῦχα μου λερώνω,
κι ὅσες βλαστήμιες ξέρω ἀρχίζω νὰ τὶς πῶ.
Στὸν καφετζῆ ξεσπάω... φωτιὰ κι ἐκεῖνος παίρνει.
Ἀμέσως ἄνω κάτω τοῦ κάνω τὸν μπουφέ,
τὸν βρίζω καὶ μὲ βρίζει, τὸν δέρνω καὶ μὲ δέρνει,
καὶ τέλος... δὲν πληρώνω δεκάρα τὸν καφέ.

κλεμένο απο εδώ

Sunday, October 19, 2014

Setting up a dynamic dns service in 5 minutes.

Found this excellent blog post.

Copying and pasting the instructions for archival purposes:

You might have recently setup your Raspberry Pi or your Linux box as a 24 x 7 torrent downloader, or a small Web server to host your own website. And just then you realize that your ADSL or Cable Internet connection has a dynamic IP address which changes frequently and every time you reconnect. Thus, it becomes hard to access your box with a fixed Domain name or IP address.

To solve this problem you can setup a Dynamic DNS which will update your IP to a DNS name everytime it changes and you can access you hosted website, or ssh into it to monitor torrent downloads with ease.

While there are many paid dynamic dns service providers available, but here you will see one way to do it for **FREE** [Thanks to]

Step 1
Register for a Free domain at
[We will take in this guide]

Step 2
Logon to FreeDNS (where you just registered) and goto
Or, simply click on "Dynamic DNS" link from the left navigation menu

Right click on "Direct URL" and copy the URL and paste it somewhere.

You should notice a large and unique alpha-numeric key in the URL, make a note of it as shown below:[alpha-numeric-key]

Step 3
Install inadyn using the following command:
sudo apt-get install inadyn

Configure inadyn using the below steps:
sudo nano /etc/inadyn.conf

And add the following contains in it replacing the actual values:
--username techhome
--password mypassword
--update_period 3600
--forced_update_period 14400
--alias,alphanumeric key

Step 4 
Now, we need to ensure that the DNS updater (Inadyn) runs automatically after every re-boot

export EDITOR=gedit && sudo crontab -e

Add the following line:
@reboot /usr/sbin/inadyn

Step 5
Reboot system and then run the following command to ensure inadyn is running:

ps -A | grep inadyn

Now your host is ready and up for accessing from internet...

You can trying ssh-ing from another computer over the internet

Or, if any web server is running, then simply browse to

Or, you can just ping it to test ping

To check the logs you can use this:
more /var/log/messages |grep INADYN

This has been re-tested to be working perfectly with inadyn 1.96.2-1 on Raspbian 3.12.22+

Saturday, October 18, 2014

Kivy: Python based platform independent projects with touch support

Kivy, seems a really interesting project. It can be used to provide write once run everywhere functionality in python, including desktop and mobile platforms and with touch support.
I will give it a go and see what happens.

Tuesday, October 14, 2014

Real world Ocaml

Still studying this book. It is mind-boggling how advanced it is especially compared with other mainstream languages. It will probably end up becoming one of my go-to languages especially for use cases that well suited for the functional paradigm.

Sunday, October 12, 2014

Old blog posts in xml format

It seems that blogger import does not work very well, so i decided to upload my old blogs as an xml file with some minimal xsl formatting here. At the very least it will allow me to search for old things. Of course html has been stripped so there are a lot of cases in which the post is really missing

Older blog post imports

Been trying for a couple of days to import my old blog posts to blogger.
The Blogger API is a mess, so i decided to use an XML import.
I am almost there, and would have everything working if there were more test imports allowed by blogger in order to debug my xml.

Anyway, I will do it eventually. I think that I need to do some more text replacements in the xml and for that, I am going to use vim grouping regular expressions i think.

The regexp that worked is: %s/\(....-..-..\) \(..:..:..\)/\1T\2:00.000-00:00/gc

Friday, October 3, 2014

First blogger post

A first post in blogger. Lets see if I will make it migrating my nucleus posts to blogger. Added all my categories on this post as labels, as it seems that for a label to exist the must be at least one post with it...