Hi, this is my blog, and also a guestbook. I publish stuff I do from time to time. Be welcome and feel at home, have a coffee and don't hesitate to drop me a line or two. All languages are highly welcome, especially the most exotic ones (nederlands, bij voorbeeld...).

You are currently viewing only posts tagged as linux in this guestblog.

Click here to go back the blog home page, or browse by tag: sketches, saopaulo, freecad, opensource, bede, talks, trilhas, linux, works, architecture, projects, 3d, blender, detail, inthepress, animations, opensurce, firefoxos, idsampa, photo, gaming, wordpress, webdesign, Architecture, orange, cooking, or search the 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, .

in categories  opensource  linux  permalink:  369   posted on 16.06.2017 2:30
From Yorik

Writing a task list powerline segment

This is one of these notes to self, in case I want to redo/extend/modify this in the future... Not sure it is of any interest to anybody less nerd, but here it goes for your enjoyment anyway I use powerline since quite some time, it prints fancy prompts in your terminal, where you can plug all kinds of nice nerdy info to be printed, like time, cpu throttle, weather, etc.. If you have a shell that has two prompts (left and right), powerline uses it too. It's easy to install on any linux distro, it's in all packages repositories, and very configurable.

Basically I only used the left segment that shows the current path, and a short right one that shows the current branch if you are in a VCS-controlled folder (git, hg, etc..) and if it's dirty or clean. This is basically how powerlines comes out of the box.

Recently I also discovered taskwarrior, and I quite liked it too. It's a very simple command-line based task list system (I like doing lists) and it has a powerline plugin that shows you the most urgent task to do. I liked that a lot too, having the task under your eyes there kinds of makes you want to get rid of it, so you end up doing it so you can mark it as done, and this has marvelous effects on the processing of your whole list...

I also wanted to sync these tasks somewhere online too, so when you are in the street and you remember something you need to do, you can add it to the list directly from your phone, and forget about it.

Taskwarrior has a server system, but it seemed a bit too much to me, plus I don't have a full-featured server to install the taskwarrior server to (only a standard webhosting service),so this didn't work either.

I use a lot the notes system of nextcloud, pretty easy to use from your cellphone, it has beautiful markdown support, etc. I use that for about everything. So I thought about a very simple task list system, that you could manage from nextcloud's notes app. It's basically a simple text file, where tasks are lines that begin with a *. Lines that don't begin with a * are not tasks, you can write or organize the way you want:

It is synced to your computer, so locally it's a simple text file that you can edit the way you want (I put an alias in my .zshrc like this so I can just run "taskedit" from the teminal

alias taskedit='nano /home/yorik/Documents/Notes/Tasks.txt'

Then finally I wanted the most urgent task to appear in a powerline segment. It's actually pretty simple. All you need is to write a python script like this:

from powerline.segments import Segment, with_docstring
from powerline.theme import requires_segment_info

class ActiveTaskSegment:

    def __call__(self, pl, segment_info=None, create_watcher=None):
        #pl.debug('Running powerline_tasks'
        taskfile = "/home/yorik/Documents/Notes/Tasks.txt"
        f = open(taskfile,"rb")
        lines = [l for l in f]
        for l in lines:
            if l[0] == "*":
                l = l[1:].strip()
                l = l.replace("**","")
                if "T:" in l:
                    t = l.split("T:")
                    l = t[0].strip()
                    t = t[1].strip()
                    t = None
                segs = [{'contents':l.decode("utf8"),'highlight_groups':['critical:success']}]
                if t:
                return segs
        return []

active_task = with_docstring(
    '''Returns the next active task
    Highlight groups used: ``critical:success``
Then you need to save that file in some place where python can find and import it (for ex. one of the folders indicated by sys.path in python). Then in your .config/powerline/themes/shell/default.json, together with the other segments:

            "function": "powerline_tasks.active_task",
            "priority": 40
And that's it. powerline_tasks is the name of your .py file. The first task found in the file will be printed, and if there is "T:" in that task, what comes after is printed differently so you can use it to set a deadline or something:

Finally I also wrote a short "taskdone" script to delete the first task when it is done:


taskfile = "/home/yorik/Documents/Notes/Tasks.txt"
f = open(taskfile,"rb")
lines = [l for l in f]
f = open(taskfile,"wb")
done = False
for l in lines:
    if l.startswith("*") and not done:
        done = True
        print "Marking task",l.strip(),"as done"

in categories  opensource  linux  permalink:  155   posted on 27.10.2015 4:14
From Yorik

Dynamic menu for fluxbox

A little note to self inspired by this article. A quick way to add dynamic menus in fluxbox, for example to emulate that openbox pipe menus thingy that shows all your directories tree inside a menu...

First you have a script like this, that creates/updates a text file containing a fluxbox submenu:

echo "[submenu] (Works) {} " > 
find / -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | awk '{ printf "[exec] ("$0") {pcmanfm 
    \"/home/yorik/"$0"\"} \n"}' >> /home/yorik/.fluxbox/works
echo "[end]" >> /home/yorik/.fluxbox/works

Then in your fluxbox menu:

[include] (/home/yorik/.fluxbox/works)

Then you need to run the first script from time to time, for example adding it to your crontab. The apps are filled by the excellent xdgmenumaker...

in categories  linux  opensource  permalink:  179   posted on 26.11.2014 22:30
From Yorik
A very simple email checker (works with imap accounts). Run it by setting it in your crontab to run hourly or something.

passwords are bz2-encrypted (not very good security, but better than nothing. Anyway debian machines are highly secured ). Place the string generated by bz2.compress("password") instead of "encryptedpassword" below.


import imaplib, pynotify, bz2
check1 = False
s1 = i1.status("INBOX","(UNSEEN)")
n1 = s1[1][0].split()[-1].split(")")[0]

s2 = i2.status("INBOX","(UNSEEN)")
n2 = s2[1][0].split()[-1].split(")")[0]

if (n1 != "0") or (n2 != "0"):
    t = "Unread mail"
    m = ""
    if n1 != "0":
        m += n1 + " messages on myserver/n" # change with a backslash
    if n2 != "0":
m += n2 + " messages on gmail/n" # change with a backslash n=pynotify.Notification(t,m) n.show()

in categories  linux  opensource  permalink:  79   posted on 20.07.2014 5:56
From Yorik

HDR thumbnailer

This is a note to myself in case I need it again in the future...

pcmanfm, my favorite file manager, uses the gnome3 thumbnailing system, which makes it very easy to write thumbnailers for new filetypes. Thumbnailers are small programs that take a file of a certain type, and create a small png image of it. So in this example, I'm using imagemagick, the famous image conversion tool that you'll find on almost any linux distro, to make a thumbnailer for HDR images. The thumbnailer is composed of two files:

hdr.thumbnailer (place it in /usr/share/thumbnailers or ~/.local/share/thumbnailers):
[Thumbnailer Entry]
Exec=imagemagick-thumbnailer %i %o %s

imagemagick-thumbnailer (place it in /usr/bin or any other folder that is in your binary search path):
/usr/bin/convert "$1" -thumbnail 64x64 -gravity center -background white -extent 48x48  png:"$2"

One last thing, I suggest you delete /usr/share/mime/packages/kde.xml (installed by kdelibs5-data) because it horribly messes with several file formats (such as HDR) and the mime system doesn't recognize them anymore.

in categories  linux  opensource  permalink:  65   posted on 10.07.2014 2:21
From Yorik

Invert the colors of qcad3 icons

QCad is an open-source 2D CAD program I've already been kind of fond of. It runs on Windows, Mac and Linux, its version 2 has been the base of LibreCAD, and version 3, which is a couple of months old already, is a huge evolution after version 2. Their developers have always struggled between the open-source and closed source worlds, trying to turn QCad into a business, and at the same time keeping the code open. This is a very hard and subtle fight, and their commitment to open-source is really impressive. They basically make the code available on github, and also sell a Pro version (which costs around 30 euro and has dwg support).

There are only very small annoyances that make me still stick to draftsight, basically the not very customizable dimension styles, and thing of the same level, but most tools in this new version 3 being written in javascript, they are quite easy to tweak, I'll certainly have a look at it at some point.

One small issue that I already found an easy way to solve is this: All icons are drawn in black, which, on my white-on-black desktop theme, made them almost invisible and qcad therefore almost unusable. I then wrote this little script, that crawls through the qcad source code, opens all the svg files it finds, and changes black color with white:


import os

def processdir(path):
    print "entering " + path
    for entry in os.listdir(path):
        if os.path.isdir(path + os.sep + entry):
            processdir(path + os.sep + entry)
        elif entry[-4:] == ".svg":
            print "    processing " + path + os.sep + entry
            f = open(path + os.sep + entry)
            b = f.read()
            b = b.replace( 'stroke="#000"','stroke="#fff"' )
            b = b.replace( '#000000;','#ffffff;' )
            f = open( path + os.sep + entry,'wb' )


To use it, simply paste the above code in a file, save it inside the qcad source folder, make it executable, and run it from there. Not sure if this will work out-of-the-box on Windows, but I believe it should.

in categories  linux  opensource  permalink:  53   posted on 05.06.2014 6:43
From Yorik

Coop fluxbox theme

A new dark & flat theme I've been doing for my desktop, *slightly* inspired by all the new gnome3 stuff... The package includes matching themes for fluxbox, gtk2, gtk3, gimp and blender,and instructions to use them.


in categories  linux  blender  opensource  permalink:  331   posted on 18.09.2013 20:05
From Yorik

Update on building Luxrender

This is more a note for myself. This is an update of my original post about building Luxrender on debian:

The original instructions are still valid, with the following changes:

- instead of "make luxrays", we can now do only "make" (needed because smallluxgpu will also be built then)
- no need to add the deprecated opencl directive anymore
- install package ocl-icl-opencl-dev (will remove nvidia opencl libs)
- set path to libluxrays.a and libsmallluxgpu.a with cmake-gui when building lux

in categories  linux  opensource  permalink:  249   posted on 07.04.2013 20:06
From Yorik

Retrieve a file via ftps + mysql backup

This is a note to myself, so I remember later, since the syntax is a bit complex and you need several variable settings (they can also be set in ~/.lftp):
lftp -e "set net:timeout 10; set ssl:verify-certificate no; set ftp:ssl-protect-data true;
get mydir/myfile.sql.gz; bye" -u myusername,mypassword ftp.myserver.com

You can use that to make automatic backups of a mysql database, by adding a line like this to your webhosts cron list:
/usr/bin/mysqldump -u myuser --password=mypassword databasename | /usr/bin/gzip >

in categories  linux  opensource  permalink:  228   posted on 17.03.2013 5:50
From Yorik

You spend too much time in front of the computer

and you want to know how much, or maybe you simply want to know how long you have been working on something today. For either cases, I made this little script for linux, that you must launch at startup (put it in your startup apps list, or launch it manually). It will then record the time passed since you turned on your computer, and subtract the time your desktop was in screensaver mode, resulting in the time you were actually sitting doing something with the computer.

Of course it wont help you to know how long you have been working and how long you spent staring at facebook. But there are much better time-logging apps available on the net to solve that problem...

The script will store the current activity time in a ".activitytime" file inside your home folder, so you can just do "cat ~/.activitytime" from a terminal or from any other script (launcher, panel widget, etc...) to display your current activity time.

import sys,os,time

r = os.system("xprintidle")
if r != 0:
    print "Error: xprintidle was not found, and must be installed for this program to run"

total_idle = 0

def uptime():
    "returns uptime in minutes"
    with open("/proc/uptime", "r") as f:
        uptime_seconds = float(f.readline().split()[0])
        return int(uptime_seconds)/60
    return 0

def idletime():
    "returns idle time in minutes"
    global total_idle
    r = os.popen("xprintidle")
    idle_minutes = int(r.read())/60000
    if idle_minutes > 1:
        total_idle += 1
    return total_idle
def formattime(minutes):
    "formats atime in minutes to HH:MM"
    hours = minutes/60
    restminutes = minutes%60
    return str(hours).zfill(2)+":"+str(restminutes).zfill(2)
def writetime():
    "writes current activity time to a file"
    strtime = formattime(uptime() - idletime())
    print ("active time: "+strtime)
    fil = open(os.path.expanduser("~") + os.sep + ".activitytime","wb")
def readtime():
    "reads a temp file and adjusts elapsed idle"
    global total_idle
    fpath = os.path.expanduser("~") + os.sep + ".activitytime"
    if os.path.exists(fpath):
        fil = open(fpath,"r")
        r = fil.read()
        t = r.split(":")
        minutes = int(t[0])*60 + int(t[1])
        print "logged activity time: ",formattime(minutes)
        print "current uptime: ",formattime(uptime())
        total_idle = uptime() - minutes
        print "logged idle time: ",formattime(total_idle)

if __name__ == "__main__":
    if len(sys.argv) == 1:
        # if no argument is given, start from zero
        # with an argument, for ex --append, restart from currently saved time

    while True:

in categories  linux  opensource  permalink:  225   posted on 06.03.2013 2:03
From Yorik

Recompile a Ubuntu PPA package on Debian

One of the annoying things with Ubuntu PPAs is that they almost never install out-of-the-box on Debian, because usually they need a too new version of a package or a too old one, depending on which Ubuntu version you choose.

Fortunately, since both Debian and Ubuntu share the same package system, so recompiling and repackaging a PPA package is often very easy, since the source code already comes ready for packaging. Here are the steps to follow :

1. Install build-essentials and dpkg-dev packages

2. On the PPA page on Launchpad, click the "view package details" link and expand the most recent version.

3. Download 1) the .orig.tar.gz file (the original source code), 2) the .dsc file (the debian package specification) and 3), if existing, the .debian.tar.xz (the patches applied by the debian team, usually needed to make the source code comply with debian rules).

4. Place both in a same folder, then extract everything:
dpkg-source -x name-of-dsc-file.dsc

5. Go to the extracted folder:
cd name-of-folder

6. Compile the code:

7. If some needed package dependencies are not installed, the above command will abort now and tell you what is missing. Correct the situation and run dpkg-buildpackage again. Compiling might take some time.

8. Is all went well, you will find one (or more, since the dsc file might have instructed to split into several packages) .deb files in the folder that contains your dsc file. Install it by double-clicking it in your file manager or with:
sudo dpkg -i name-of-package.deb

Retrieved and adapted from http://www.cyberciti.biz/faq/rebuilding-ubuntu-debian-linux-binary-package/

in categories  linux  permalink:  216   posted on 21.02.2013 24:15
From Yorik

Dropbox check script

If you are using dropbox on linux, be aware that there are several reports of dropbox "loosing" some of your files (the file still exists, but it has 0Kb size). The causes of this problem seem not very clear...

Anyway, I made this little script that checks your dropbox folder if everything is okay:

if [ -z "$1" ]
    find /home/yorik/Dropbox/* -size 0 -type f
    if [ -n "$(find /home/yorik/Dropbox/* -size 0 -type f)" ]
        notify-send -i important "Dropbox Warning" "0-byte files found"
        play /home/yorik/.sound/nuclear-alarm.wav

To use it, just put the above text in a new file, adjust the paths /home/yorik/ to yours, save it and make it executable. If you run it without options, it will prin a list of 0-byte files found in your dropbox folder. If you run it with any kind of argument (for example checkdropbox -n), it will show an alert on your desktop if any 0-byte file is found. I use it that way in a cron job that runs every hour, that I set by adding the following line in crontab (do crontab -e in a terminal):

0 *  * * * env DISPLAY=:0 /home/yorik/bin/checkdropbox -n

the "env DISPLAY=:0" is needed when you want to lauch graphical applications from crontab...

in categories  linux  opensource  blender  permalink:  201   posted on 18.01.2013 17:41
From Yorik

About Clevo, Avell, Debian and Cycles

I got myself this new toy: An Avell G1511 notebook. It is a very good machine, with a recent generation I7 CPU, an Nvidia GTX660m GPU with a 1920x1080 display, and an hybrid HDD+SSD hard drive, which boots debian in less than 7 seconds from grub to fully loaded desktop.

This notebook is what is called a "barebook", or "whitebook", or "barebone notebook". It is actually a Clevo W350, which sells with only the shell, the motherboard and the GPU. The guys at Avell add the other components (Avell only sells in Brazil, but there are similar brands in the USA and in Europe, like Sager or Schenker, more here ). As a result, it is very configurable, and you can choose between many types of CPUs and hard disks. You can even choose the color of the shell... And a very remarkable detail, all Avell notebooks have a 3-year warranty.

There is quite some time I wanted to put my hands on such a barebook, and it is really a very good machine. First advantage is the very low price, a notebook with the same setup costs about the double if it comes from Dell/Alienware or Asus, and triple if it is a Mac... Basically you can get yourself a pretty powerful machine at the cost of a very mid-range one. The I7 + GTX660 allows you to run any recent game, and the 2 games I installed until now (Oil Rush and Serious Sam 3) both run with all settings at maximum in 1920x1080...

I also discovered that between all notebook vendors, only Asus makes its own shells. All others (Dell, HP, Sony, etc...) also buy their shells from a third-party manufacturer. So not only there is no difference with Avell/Clevo, but also Clevo is a very well-known one, and really the W350 shell is excellent: It is solid and the thermal design is very good. The ventilator can spin quite hard when doing CPU-intensive jobs, but doesn't even need to run when gaming in high-resolution... And the design is actually far from ugly, differently from what I expected...

Since this notebook comes without operating system, I started by installing my favourite operating system, debian (testing release). I made a coupe of technical questions to Avell before buying and the guys were very professional, they dug all the answers I needed, etc. Even so, I wasn't sure some smaller parts would work out-of-the-box. Good news, 100% of the hardware is supported. Not totally out-of-the-box, though, but everything was very easy to solve. Basically I had to do this:
  • The Ivy-bridge architecture this I7 CPU is based on is only well supported from kernel 3.6. Debian testing ships with 3.2, which makes the system freeze from time to time, but 3.7 is available form the repos, so it is very easy to fix
  • The Nvidia GPU is an Optimus-based one (a system to switch automatically between the I7 integrated GPU and the Nvidia one, to save power), and optimus is still not officially supported on linux (Fuck you Nvidia! said Linus Torvalds about that problem). Fortunately, the opensource community came with a solution that is now extremely stable, and I would say almost better than the official driver, called bumblebee, and its new indispensable add-on called primusrun. On Ubuntu all this is easily installable via PPA, on debian you need to compile them yourself, but if you use debian, you surely like to compile stuff yourself... With bumblebee and primusrun, you simply force any application to use the Nvidia GPU, while the rest runs on the I7. The performance is smooth and perfect.
  • All the peripheral hardware is from Realtek. The network adapter works out-of-the-box, the wireless adapter not, but already has a linux driver available from realtek, which you can compile yourself now, but will be included in the kernel 3.8, and the card reader needs an additional package called rts-bbp.

After that, everything runs perfectly. I like to use debian testing because you can install it bit by bit, starting from a very bare minimal installation, and add pieces as you need them. Definitely debian is not a distribution for you if you don't like to configure your own stuff. Only to make a bootable USB stick you need to read several instructions pages... But on the other hand, you end up with a blind-fast system, where you know every piece and every process.

After the system was up, one of the most important things I wanted to test is Blender's GPU-enabled renderer, cycles. I compile blender myself (I can't wait to get the new features), and fortunately, at this date, all the dependencies you need are in the debian repositories (except opencolorio and opencollada, but they are both optional). You must just be very careful to get all the Nvidia stuff (nvidia driver, cuda libs and cuda toolkit) with the same, matching version numbers (in my case they come all from the debian experimental repo, driver 313.18 and cuda 5.0), otherwise Blender won't detect your card. And you don't even need bumblebee to run cycles!

Much has been said (specially by our friend Ivan ) about Nvidia 600-based GPUs and their poor performance in cycles (namingly, even being more recent, they behave much worse than 500 series). This proves out to be quite true unfortunately, the Mike Pan's BMW benchmark renders in 3'06" (against 3'20" when rendering with the CPU), and on the benchmark page you see older GPUs rendering the same scene in about 1 minute.

But there are several other considerations to take into account: The Nvidia 600 series (also called Kepler) is pretty new, so cycles might still not use them with full potential (cycles is still in heavy development), and benchmarking sites usually place the 600 series quite above the 500 series, so they perform better in other areas (gaming especially). This is also because they use a much faster memory than the 500 ones. And my notebook is not meant to become a cycles rendering node, we always use render farms for heavy work. And, as Saint Mango teaches us, life is meant to do hard work and play good videogames in equal parts...

in categories  linux  opensource  permalink:  189   posted on 09.12.2012 21:24
From Yorik
One-liner script to fetch current temperature (BRXX0232 is the yahoo weather code for São Paulo):

curl --silent "http://xml.weather.yahoo.com/forecastrss?p=BRXX0232&u=c" | 
grep -E 'temp=' | cut -d "=" -f3 | head -c 3 | tail -c 2

in categories  linux  blender  opensource  permalink:  183   posted on 04.12.2012 15:46
From Yorik

Checkframes utility

A little python utility to check that frames series you download from a render farm are okay (no frame missing, no frame with 0 byte size). Made on Linux, but should work on any platform. On Linux, place this script in your /home/$USER/bin folder (or any other that is in your $PATH), make it executable, then just run this script from a folder containing frames, or a folder containing subfolders. Enjoy!


#*                                                                         *
#*   Copyright (c) 2012                                                    *  
#*   Yorik van Havre                                  *  
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   GNU Library General Public License for more details.                  *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *

"""This utility checks the current folder and any of its subfolders for jpg, png
or exr image sequences, numbered 0001.jpg, 0002.jpg, etc... and checks that no
frame number is missing, and that no image is corrupted (sero-size)."""

import os,sys
from PIL import Image

# keeping count of errors
errors = 0

# getting working paths
homepath = os.path.abspath('.')
subpaths = []
for p in os.listdir(homepath):
    ap = homepath + os.sep + p
    if os.path.isdir(ap):


# add current path too

# checking frames
for p in subpaths:
    print(" ")
    print("checking folder "+p)
    frames = []
    for i in os.listdir(p):
        if i[-4:].upper() in ['.JPG','.PNG','.EXR']:

    if not frames:
        print("    This folder doesn't contain frames")

        # counting frames and checking numbers
            last = int(frames[-1].split('.')[0])
            print("    Error: couldn't parse frame numbers in this folder")
        if len(frames) != last:
            print("    Error: frame numbers differ from frames count in this folder: 
	last frame is "+str(last)+" but contains "+str(len(frames)))
            ext = frames[-1].split('.')[1]
            for i in range(1,last+1):
                fn = str(i).zfill(4)+'.'+ext
                if not fn in frames:
                    errors +=1
                    print("    Missing frame: "+fn)
        # displaying info of first image
            imf = Image.open(p+os.sep+frames[0])
            print("    Error: cannot open image "+p+os.sep+frames[0])
            print("    "+str(last)+" frames - format: "+imf.format+" - "+str(imf.size[0])+"x"+str(imf.size[1]))
        # checking size
        for f in frames:
            fp = p+os.sep+f
            s = os.path.getsize(fp)
            if s < 1024:
                print("    Error: zero-sized file: "+fp)
        # subdir succeeded
        print "    Everything ok"

# all tests are done
print(" ")
if errors:
    print(str(errors)+" errors found")
    print("Success: All frames are ok")

in categories  linux  opensource  permalink:  175   posted on 17.11.2012 1:46
From Yorik

Note to self: How to set a file manager as default in X

Sometimes, when you arenot using gnome or kde, you press the dropbox icon, and firefox opens to display the contents of your Dropbox directory, instead of your default file manager. This is easily fixed by adding or changing the following lines in $HOME/.local/share/applications/mimeapps.list (in this case, I'm using pcmanfm)

[Added Associations]

[Default Applications]

in categories  freecad  opensource  linux  permalink:  157   posted on 02.09.2012 24:06
From Yorik

Handling IFC files on Linux

Working with IFC files on a linux system is still not something easy, but there are already a couple of things you can do:

1. Add a MIME type

To have .ifc files recognized, add a file named "application-x-extension-ifc.xml" to ~/.local/share/mime/packages (or /usr/share/mime/packages for system-wide) with this content:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
	<mime-type type="application/x-extension-ifc">
		<sub-class-of type="text/plain"/>
		<comment>Industry Foundation Classes</comment>
		<glob pattern="*.ifc"/>

Then run "update-mime-database ~/.local/share/mime" to update your mimetypes database.

2. Add an icon

Grab an icon from here, and save it as ~/.icons/x-extension-ifc.png (or /usr/share/icons/x-extension-ifc.png for system-wide). Now your file manager should display IFC files a bit more nicely:

3. Open IFC files

There are currently no applications that can save ifc files (might change sooner than you think, however), but there are already a couple of solutions to open them. The following example is taken from the buildingSmart examples page ((Duplex model):

FreeCAD: Can open IFC file with its internal parser (not all entiites are supported and, starting from version 0.13 (to be released soon), is able to use IfcOpenShell if it is installed on your system, and with it, can import the whole contents of an IFC file:

OpenIfcTools: Has a javawebstart viewer, simple but very good for quickly inspecting IFC files:

Blender: Can also open ifc files when IfcOpenShell and its blender importer addon are installed. Although it uses the same IFC import engine, the file import operation is much faster than FreeCAD, because the mesh data that blender uses is much quicker to construct than FreeCAD's more complex parametric objects:

BimServer: The BimServer is a multiplatform server application, made to share, review and maintain IFC-based projects. It has several interesting functionalities such as conversion to/from several other formats, cobie support, revision control, etc... It has also a WebGL viewer program for it (called BimSurfer), which can render a the project in WebGL (3D inside your web browser):

5. Save IFC files

This is not yet possible, but Thomas Krijnen, the guy behind IfcOpenShell is working on it, so very likely Blender and FreeCAD will be able to output IFC files in some near future.

in categories  opensource  freecad  linux  blender  permalink:  96   posted on 04.06.2012 24:06
From Yorik

Python for architects - Part 1: Introduction

This is a serie of 3 tutorials for architects who wish to use opensource 3D tools (mainly Blender and FreeCAD more effectively, or simply who are curious about programming, and would like a gentle introduction. This is the first tutorial, presenting python in a general way. Read also the second part: about Blender. The third part (about FreeCAD) is yet to be written.

Why would I need to program? You might ask. There are a couple of reaons:

  • We architects are too dependents on big firms (Autodesk, Graphisoft, etc). They decide which tools, formats and standards we will use, and their decisions are in most cases dictated by commercial interests. We should be able to reflect and decide ourselves about how we want our work to be done, and have the power to craft our own tools if theirs are not good for us. Well, fear no more, yes we can!
  • Python is already included in many tools you know (or not): Blender, FreeCAD, Maya, Rhino, OpenOffice, and the crazy python fans everywhere even went much further, and you can now also use python in AutoCAD, 3ds Max or Revit, or Softimage. It also powers a very big part of Linux software. Python is everywhere. If you know one or another of those applications already, most of the work is already done. You'll just need a bit of python "sauce" to pilot them the same way as you already do with the mouse...
  • It is much easier than you would think. I'll try to demonstrate this below.

Why python?

Python is a programming language. It is free, open-source, multiplatform (Windows, Mac, Linux and many others), and it has several features that make it very different than other common programming languages, and very accessible to new users like yourself:

  • Python is a language described by its conceptors as "made for human beings", and is very easy to learn and understand. And even so (or, maybe, because of it), python is one of the most powerful languages available, principally because it can be (and is) extended almost infinitely, and is very, very widely used by people who are no computer scientists and never studied programming, like me.
  • It is interpreted, that is, unlike most other programming languages, it can be executed on-the-fly, as you write it. This has tremendous advantages for newcomers, for example it notifies you almost immediately when you make an error. You can start with very little knowledge, trying stuff, and in many cases it will teach you how to correct things and what to do next.
  • It can be embedded in other programs to be used as scripting language. Blender and FreeCAD have an embedded Python interpreter, so you can write Python code in them, that will manipulate parts of those programs, for example to create geometry. This is extremely powerful, because instead of just clicking a button labeled "create sphere", that a programmer has placed there for you, you have the freedom to create easily your own tool to create exactly the geometry you want.
  • It is extensible, you can easily plug new modules in your Python installation and extend its functionality. For example, you have modules that allow Python to read and write jpg images, to communicate with twitter, to schedule tasks to be performed by your operating system, etc. The list is endless. All this is easy to combine together, and use the power of one inside the other. For example, you can send tweets from blender, or create an openoffice sheet inside FreeCAD. You can even do incredible things such as running FreeCAD inside Blender (since FreeCAD is itself a python module too) and maybe the contrary too in the future...

So, hands on! Be aware that what will come next is a very simple introduction, by no means a complete python course. But my hope is that after that you'll get enough basics to explore deeper into the Blender and FreeCAD mechanisms, which will be in parts II and III of this tutorials serie.


Installing python present no difficulty at all, if you are on Linux there are 99% of chances that it is installed already, since it powers many parts of your system (try running "python" from a terminal to check), otherwise just install it from your system's package manager. On Windows and Mac, just download and install the latest version from the official python website. If you have Blender or FreeCAD installed, they already include an embedded python version, and you don't need to install anything.

When installing python, you might be able to choose between several versions. At the time of writing, the globally considered "stable" version is 2.7, but the latest version available is 3.2. I advise you to install the 3.2, or any higher version available. This tutorial is based on 3.2, but normally everything will work just the same with any other version.

The interpreter

Usually, when writing computer programs, you simply open a text editor (such as notepad on Windows) or a special programming environment which is in most case a text editor with several tools around it, write your program, then compile it (that means basically convert it into an executable application) and run it. Most of the time you made errors while writing, so your program won't work, and you will get an error message telling you what went wrong. Then you go back to your text editor, correct the mistakes, run again, and so on until your program works fine.

That whole process, in Python, can be done transparently inside the Python interpreter. The interpreter is a Python window with a command prompt, where you can simply type Python code, that will be executed on-the-fly, without the need to do anything else.

When Python is installed on your computer you will have a Python interpreter in your start menu (usually labelled "Python" or "Python console"). On linux and mac, you can also simply run "python" from a terminal window. Or, simply fire up Blender or FreeCAD, which both have an included python interpreter (also called "python console"). Below are images showing a standalone python console, and the python consoles embedded in FreeCAD and Blender:

The interpreter shows the Python version, then a >>> symbol, which is the command prompt, that is, where you enter Python code. Writing code in the interpreter is simple: one line is one instruction. When you press Enter, your line of code will be executed (after being instantly and invisibly compiled). For example, try writing this:


print is a special Python keyword that means, obviously, to print something on the screen. It is called a function, which means basically "it does something". Like in most programming languages, functions such as this one use parenthesis () that signify "do it with the contents of the parenthesis". So here the whole line means means "print the contents of the parenthesis". When you press Enter, the operation is executed, and the message "hello" is printed. If you make an error, for example let's write:


Python will tell us that it doesn't know what hello is: "NameError: name 'hello' is not defined".

The " characters specify that the content is a string, which is simply, in programming jargon, a piece of text. Without the ", the print command believed hello was not a piece of text but another special Python keyword. I'll explain better below. The important thing is, you immediately get notified that you made an error. By pressing the up arrow, you can go back to the last command you wrote and correct it.

The Python interpreter also has a built-in help system. Try typing:


It will tell us that help is a function, and needs to be used with parenthesis. For example, let's say we don't understand what went wrong with our print hello command above, we want specific information about the print command:


You'll get a long and complete description of everything the print command can do. Press "Q" to exit the help message.

Now we dominate totally our interpreter (yes, there is no more to know than that), we can begin with serious stuff.


Of course, printing "hello" is not very interesting. More interesting is printing stuff you don't know before, or let Python find for you. That's where the concept of variable comes in. A variable is simply a value that you store under a name. For example, type this:

a = "hello"

I guess you understood what happened, we "saved" the string "hello" under the name a. Now, a is not an unknown name anymore! We can use it anywhere, for example in the print command. We can use any name we want, just respecting simple rules, like not using spaces or punctuation. For example, we could very well write:

hello = "my own version of hello"

See? now hello is not an undefined word anymore. What if, by terrible bad luck, we choosed a name that already exists in Python? Let's say we want to store our string under the name "print":

print = "hello"

Python is very intelligent and will tell us that this is not possible. It has some "reserved" keywords that cannot be modified. But our own variables can be modified anytime, that's exactly why they are called variables, the contents can vary. For example:

myVariable = "hello"
myVariable = "good bye"

We changed the value of myVariable. We can also copy variables:

var1 = "hello"
var2 = var1

Note that it is interesting to give good names to your variables, because when you'll write long programs, after a while you won't remember what your variable named "a" is for. But if you named it for example myWelcomeMessage, you'll remember easily what it is used for when you'll see it.


Of course you must know that programming is useful to treat all kind of data, and especially numbers, not only text strings. One thing is important, Python must know what kind of data it is dealing with. We saw in our print hello example, that the print command recognized our "hello" string. That is because by using the "", we told specifically the print command that what it would come next is a text string.

We can always check what data type is the contents of a variable with the special Python keyword type:

myVar = "hello"

It will tell us the contents of myVar is 'str', or string in Python jargon. We have also other basic types of data, such as integer and float numbers:

firstNumber = 10
secondNumber = 20
print(firstNumber + secondNumber)

This is already much more interesting, isn't it? Now we already have a powerful calculator! Look well at how it worked, Python knows that 10 and 20 are integer numbers. So they are stored as "int", and Python can do with them everything it can do with integers. Look at the results of this:

firstNumber = "10"
secondNumber = "20"
print(firstNumber + secondNumber)

See? We forced Python to consider that our two variables are not numbers but mere pieces of text. Python can add two pieces of text together, but it won't try to find out any sum. But we were talking about integer numbers. There are also float numbers. The difference is that integer numbers don't have decimal part, while foat numbers can have a decimal part:

var1 = 13
var2 = 15.65
print("var1 is of type ", type(var1))
print("var2 is of type ", type(var2))

Int and Floats can be mixed together without problem:

total = var1 + var2

Of course the total has decimals, right? Then Python automatically decided that the result is a float. In several cases such as this one, Python automatically decides what type to give to something. In other cases it doesn't. For example:

varA = "hello 123"
varB = 456
print(varA + varB)

This will give us an error, varA is a string and varB is an int, and Python doesn't know what to do. But we can force Python to convert between types:

varA = "hello"
varB = 123
print(varA + str(varB))

Now both are strings, the operation works! Note that we "stringified" varB at the time of printing, but we didn't change varB itself. If we wanted to turn varB permanently into a string, we would need to do this:

varB = str(varB)

We can also use int() and float() to convert to int and float if we want:

varA = "123"

Note on Python commands

You must have noticed that in this section we used the print command in several ways. We printed variables, sums, several things separated by commas, and even the result of other Python command such as type(). Maybe you also saw that doing those two commands:


have exactly the same result. That is because we are in the interpreter, and everything is automatically printed on screen. When we'll write more complex programs that run outside the interpreter, they won't print automatically everything on screen, (in fact, maybe they won't even have a screen to print to, if they run inside another application) so we'll need to use the print command. But from now on, let's stop using it here, it'll go faster. So we can simply write:

myVar = "hello friends"

Another cosmetic detail, you can insert blank spaces where you want, just to make your code easier to read. It's a matter of taste, python doesn't consider whitespaces (unless they are inside a string, of course, otherwise how would you print whole sentences?). For example, these two lines of code are totally identical to python:

print ( type ( varA + varB ) )


Another interesting data type is lists. A list is simply a list of other data. The same way as we define a text string by using " ", we define lists by using [ ]:

myList = [1,2,3]
myOtherList = ["Bart", "Frank", "Bob"]
myMixedList = ["hello", 345, 34.567]

You see that it can contain any type of data. Lists are very useful because you can group variables together. You can then do all kind of things within that groups, for example counting them:


or retrieving one item of a list:

myName = myOtherList[0]
myFriendsName = myOtherList[1]

You see that while the len() command returns the total number of items in a list, their "position" in the list begins with 0. The first item in a list is always at position 0, so in our myOtherList, "Bob" will be at position 2. We can do much more stuff with lists such as you can read here, such as sorting contents, removing or adding elements.

A funny and interesting thing for you: a text string is actually, internally, a list of characters! Try doing this:

myvar = "hello"

Usually all you can do with lists can also be done with strings. In fact both lists and strings are sequences of elements, and you can do much more with sequences, as we'll see further on.

Outside strings, ints, floats and lists, there are more built-in data types, such as dictionnaries, or you can even create your own data types with classes. Like everything in Python, the basics are small, but it is often extensible as far as your imagination allows.

Indentation & blocks

One big cool use of lists is also browsing through them and do something with each item. For example look at this:

alldaltons = ["Joe", "William", "Jack", "Averell"]
for dalton in alldaltons:
   print (dalton + " Dalton")

We iterated (programming jargon again!) through our list with the "for ... in ..." command and did something with each of the items. Note the special syntax: the for command terminates with : which indicates that what will comes after will be a block of one of more commands. Immediately after you enter the command line ending with :, the command prompt will change to ... which means Python knows that a :-ended line has happened and that what will come next will be part of it.

How will Python know how many of the next lines will be to be executed inside the for...in operation? For that, Python uses indentation. That is, your next lines won't begin immediately. You will begin them with a blank space, or several blank spaces, or a tab, or several tabs. Other programming languages use other methods, like putting everythin inside parenthesis, etc. As long as you write your next lines with the same indentation, they will be considered part of the same for-in block. If you begin one line with 2 spaces and the next one with 4, there will be an error. When you finished, just write another line without indentation, or simply press Enter to come back from the for-in block

Indentation is cool because if you make big ones (for example use tabs instead of spaces because it's larger), when you write a big program you'll have a clear view of what is executed inside what. We'll see that many other commands than for-in can have indented blocks of code too.

For-in commands can be used for many things that must be done more than once. It can for example be combined with the range() command:

serie = range(1,11)
total = 0
print ("sum")
for number in serie:
   print (number)
   total = total + number
print ("----")
print (total)

Or more complex things like this:

alldaltons = ["Joe", "William", "Jack", "Averell"]
for n in range(4):
   print (alldaltons[n], " is Dalton number ", n)

You see that the range() command also has that strange particularity that it begins with 0 (if you don't specify the starting number) and that its last number will be one less than the ending number you specify. That is, of course, so it works well with other Python commands. For example:

alldaltons = ["Joe", "William", "Jack", "Averell"]
total = len(alldaltons)
for n in range(total):
   print (alldaltons[n])

Another interesting use of indented blocks is with the if command. If executes a code block only if a certain condition is met, for example:

alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Joe" in alldaltons:
   print ("We found that Dalton!!!")

Of course this will always print the sentence, because the stuff after "if" is always true ("Joe" is indeed foundin the allDaltons list), but try replacing the second line by:

if "Lucky Luke" in alldaltons:

Then the result of that line is false, and nothing is printed. We can also specify an else: statement:

alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Lucky Luke" in alldaltons:
   print ("We found that Dalton!!!")
   print ( "Such Dalton doesn't exist!" )


The standard Python commands are not many. In current version of Python there are about 30, and we already know several of them (print(), len(), type(), etc...). But imagine if we could invent our own commands? Well, we can, and it's extremely easy. In fact, most the additional modules that you can plug into your Python installation do just that, they add commands that you can use. A custom command in Python is called a function and is made like this:

def square(myValue):
    print ( str(myValue)+" square meters" )

print ( square(45) )

Extremely simple: the def() command defines a new function. You give it a name, and inside the parenthesis you define arguments that we'll use in our function. Arguments are data that will be passed to the function. For example, look at the len() command. If you just write len() alone, Python will tell you it needs an argument. That is, you want len() of something, right? Then, for example, you'll write len(myList) and you'll get the length of myList. Well, myList is an argument that you pass to the len() function. The len() function is defined in such a way that it knows what to do with what is passed to it. Same as we did here.

The "myValue" name can be anything, and it will be used only inside the function. It is just a name you give to the argument so you can do something with it, but it also serves so the function knows how many arguments to expect. For example, if you do this:

print ( square(45,34) )

There will be an error. Our function was programmed to receive just one argument, but it received two, 45 and 34. We could instead do something like this:

def sum(val1,val2):
   total = val1 + val2
   return ( total )

myTotal = sum(45,34)

We made a function that receives two arguments, sums them, and returns that value. Returning something is very useful, because we can do something with the result, such as store it in the myTotal variable. Of course, since we are in the interpreter and everything is printed, doing:


will print the result on the screen, but outside the interpreter, since there is no more print command inside the function, nothing would appear on the screen. You would need to do:

print (sum(45,34))

to have something printed.


Now that we have a good idea of how Python works, we'll need one last thing: How to work with files and modules.

Until now, we wrote Python instructions line by line in the interpreter, right? What if we could write several lines together, and have them executed all at once? It would certainly be handier for doing more complex things. And we could save our work too. Well, that too, is extremely easy. Simply open a text editor (such as the windows notepad, or gedit on ubuntu), and write all your Python lines, the same way as you write them in the interpreter, with indentations, etc. Then, save that file somewhere, with a .py extension instead of the usual .txt. That's it, you have a complete Python program. Of course, there are much better and much more comfortable editors than notepad (try notepad++ for example), but it is just to show you that a Python program is nothing else than a text file. Also note that on windows, python already comes with an editor named "IDLE", which is also a very comfortable way to write python code.

To make Python execute that program, there are hundreds of ways. In windows, simply right-click your file, open it with Python, and execute it. But you can also execute it from the Python interpreter itself. For this, the interpreter must find your .py file. The easiest way is to place your .py file in a place where python will search by default, such as the folder from where you started the python interpreter. On linux, by default it is your user home directory, on windows it is the folder where you installed python. If you use FreeCAD, you can simply place your .py file in the macros folder.

Here is a simple trick to find, from inside the python console, what is the current directory, which will be a good place to save our script (I'll explain later):

import os

Then, let's fire our text editor, and write the following text:

def sum(a,b):
    return (a + b)

print( "test.py succesfully loaded" )

and we save it as test.py in the directory found above. Now, let's start our python console, and, write:

import test

without the .py extension. This will simply execute the contents of the file, line by line, just as if we had written it in the interpreter. The sum function will be created, and the message will be printed. There is one big difference: the import command is made not only to execute programs written in files, like ours, but also to load the functions inside, so they become available in the interpreter. In python, that kind of files, made to be imported into other files instead of being simply executed, are called modules.

Normally when we write a sum() function directly in the interpreter, we execute it simply like that:


Like we did earlier. When we import a module containing our sum() function, the syntax is a bit different. We do:


That is, the module is imported as a "container", and all its functions are inside. This is extremely useful, because we can import a lot of modules, and keep everything well organized. So, basically, everywhere you see something.somethingElse, with a dot in between, that means somethingElse is inside something. Now you should understand better what we did with our "os" module above. The os module is a standard module of python, and contains operating system-related functions, and a submodule (simply a module inside a module) named "path" which contains tools to work with files and folders.

We can also throw out the test part, and import our sum() function directly into the main interpreter space, like this:

from test import *

Basically all modules behave like that. You import a module, then you can use its functions like that: module.function(argument). Almost all modules do that: they define functions, new data types and classes that you can use in the interpreter or in your own Python modules, because nothing prevents you to import modules inside your module!

One last extremely useful thing. How do we know what modules we have, what functions are inside and how to use them (that is, what kind of arguments they need)? We saw already that Python has a help() function. Doing:


Will give us a list of all available modules. We can now type q to get out of the interactive help, and import any of them. We can even browse their content with the dir() command:

import math

We'll see all the functions contained in the math module, as well as strange stuff named __doc__, __file__, __name__. The __doc__ is extremely useful, it is a documentation text. Every function of (well-made) modules has a __doc__ that explains how to use it. For example, we see that there is a sin function inside the math module. Want to know how to use it?

print ( math.sin.__doc__ )

which is a simpler version than:


And finally one last little goodie: When we work on programming a new module, we often want to test it. So once we wrote a little piece of module, in a python interpreter, we do something like this, to test our new code:

import myModule

But what if we see that myTestFunction() doesn't work correctly? We go back to our editor and modifiy it. Then, instead of closing and reopening the python interpreter, we can simply update the module like this:



By now, you should have a broad idea of how things are programmed in python. As you see, it's basically a matter of writing text files containing your python instructions, and have these files (modules) imported in your favorite application, and executed for example when the user pushes a button. How to achieve that depends from the application, that's what we'll explore in the next parts of this tutorials serie...

In the meantime, if you would like to know more about the basics of python, there are many, many tutorials on the internet. I selected a couple of good, simple and easy ones here. For more advanced ones, just google for "python tutorial", and you'll find plenty, including one from the official python website.

There are also many very complete PDF ebooks:

I hope you liked, if anything is unclear, please tell me by posting a comment below, so I can make it evolve into something better!

To be continued! Read the second part: about Blender.

in categories  linux  opensource  permalink:  77   posted on 16.05.2012 24:06
From Yorik

Ubuntu-style toolbar close buttons for fluxbox

It's pretty simple, really... Fluxbox has a "fluxbox-remote" tool that can be used to send commands to fluxbox, such as "Close" or "Fullscreen". So the trick is simply to add launchers to your taskbar (in this case fbpanel) and set "fluxbox-remote Close" or any other as their command line:

in categories  opensource  linux  permalink:  73   posted on 10.05.2012 4:26
From Yorik

Whiteaway fluxbox theme

This is a new fluxbox theme I made, with matching gtk3 and qtcurve themes. Download from http://yorik.uncreated.net/scripts/themes/whiteaway.zip

in categories  freecad  linux  opensource  permalink:  44   posted on 21.03.2012 5:20
From Yorik

FreeCAD thumbnailer for KDE

After the tumbler plugin, here is now a KDE plugin (for the dolphin file manager) that will show thumbnails for FreeCAD .Fcstd files. Enjoy!


in categories  linux  freecad  opensource  permalink:  37   posted on 15.03.2012 22:38
From Yorik

FreeCAD plugin for tumbler

Tumbler is a rather new thumbnailing system developed by the people at xfce. It is used by thunar and marlinn file managers. I just made a plugin for tumbler that allows it to display thumbnails for FreeCAD files (provided you enabled thumbnails in the FreeCAD preferences).

Get the code here: https://github.com/yorikvanhavre/tumbler-fcstd-thumbnailer.

I plan to include this in the FreeCAD sources or the tumbler sources, depending if the xfce devs find it useful

in categories  linux  opensource  permalink:  23   posted on 13.02.2012 18:50
From Yorik

Mint without Mint

I always like Linux Mint's desktop design, but am too lazy to abandon my debian testing system... So here is a "linuxmint-like" theme on debian testing. All you need to do is to get Mint's icon theme and wallpapers packages (they are multi-arch and don't depend on any other package):


I also made matching fluxbox, qtcurve, gtk2 and gtk3 themes here (all is explained in the archive's readme file):


in categories  linux  opensource  blender  permalink:  177   posted on 03.12.2011 18:41
From Yorik

Compiling YafaRay

I had to dig through several places to find the right info and tweak things a bit, so here goes the resume. This is on debian testing but should work on any updated linux distribution. I didn't have to install any extra libs, I suppose that if you can compile cycles you'll already have all you need...
cd ~/Sources
git clone git://github.com/YafaRay/Core.git YafaRay
cd YafaRay
git clone git://github.com/YafaRay/Blender-2.5-Exporter.git Exporter
cp CMakeConfig/UserConfig.template UserConfig.txt
Change the following values in UserConfig.txt
set(USER_INSTALL_PREFIX "/home/yorik/Apps/YafaRay")
Then go on (I prefer to build outside of the source folder):
cd ~/Apps
mkdir YafaRay
cd YafaRay
cmake ../Sources/YafaRay
make install
Then link evrything in blender scripts folder:
cd bin
ln -s ../src/bindings/yafrayinterface.py
ln -s ../src/bindings/_yafrayinterface.so
ln -s ../src/bindings/_yafqt.so
ln -s ../lib/libyafaraycore.so
ln -s ../lib/libyafarayplugin.so
ln -s ../lib/libyafarayqt.so
ln -s ../lib/yafaray plugins
cd ~/.blender/scripts/addons
ln -s ~/Sources/YafaRay/Exporter yafaray
cd yafaray
ln -s ~/Apps/YafaRay/bin

in categories  linux  opensource  permalink:  172   posted on 29.11.2011 20:45
From Yorik

Bazaar for webdesign

I just began to use bazaar to manage this website and www.uncreated.net. Right now this is only to keep track of changes and have a convenient way to upload all the changes I do at once, but in the future I have several more advanced ideas to play with.

There are a lot of Version control systems out there, but bazaar has the advantage to be of the recent (decentralized) generation, meaning you can have several concurrent easy to merge branches (every local copy is more or less a branch) and also to be able to upload to a dumb server, where no special software must be installed. This is what I use here.

Basically the procedure is very simple if you already used other VCS systems such as Git or Subversion:
cd myWebSite # go to your website root
bzr init # this creates a repository
bzr ignore *.xcf # before adding files, ignore everything you won't need to keep track of
bzr add . # add everything
bzr commit -m "First commit" # commit your changes
bzr upload --auto --remember sftp://login@server.com
The last line will upload everything on the server. The upload command is a plugin for bazaar, which you might need to install separately. After that, everytime you commit, the changes will be uploaded (thanks to the --auto switch). but yo ucan also do it manually with:
bzr upload
The server location will be remembered from last time. In case you have a very large website, and it is online already, you might not want to re-upload everything on first commit. To solve that, there is an easy trick:
bzr upload /home/user/tmp # this will upload everything in a local folder
cd /home/user/tmp
sftp login@server.com
put .bzr-upload.revid
exit # exit sftp
cd myWebSite # go back to your site root
bzr upload --remember sftp://login@server.com
Now bazaar will find a bazaar revision id on your remote site, and only upload the changes.

Finally, if you don't like the command line, bazaar has several GUI interfaces, such as qbzr which allow you to do all the above the elegant (but not as powerful) way:

Note: My installation of bazaar has a bug that prevents using sftp correctly... I made a little patch available here.

in categories  linux  freecad  blender  architecture  opensource  permalink:  97   posted on 22.09.2011 19:52
From Yorik

Linux for architects

This is a little introduction to Linux for you architects who have never tried it, but would like to know what's all the fuss about it and if it is really usable for working with architecture. If you know Linux already, I'm sure you'll find a lot of missing info in this text and find it maybe a bit too enthusiastic, but we are whowe are, aren't we...

This article is a sequel of another short article I wrote back in 2009 to present some tools available to architects on the Linux platform.

Just a small note, What it is exactly?

Actually it's wrong to call Linux Linux. Linux systems are not all-in-one, monolithic things like Windows, but rather a complex assemblage of software pieces, Linux being only the base block.

Linux is based on Unix, its predecessor, and follows a basic Unix philosophy: Rather than having one huge all-in-one application that does 1001 tricks, have 1001 small applications that do each one one simple task, but do it well.

Most of the other pieces come from a project called GNU, that's why those systems are usually called GNU/Linux and not just Linux. But let's make it simple and continue to call it Linux.

Of course make those thousands of small applications all work seamlessly is not a small work, but fortunately it has been done a lot of times already. This is where comes what we call a Linux distribution, which is a complete operating system, based on GNU/Linux, made of hundreds of little pieces, all working in a big symphony. Ubuntu is one of the most famous Linux distributions.

First things first, Why Linux Is For You

  • Linux is free. This means not only that you don't pay anything, but also that you are free to do what you want with it: download it, distribute it, share it on bitTorrent, (you caneven sell it), without having to do anything or report to anyone. Like GNU people use to say, it's free like freedom, not free like free beer
  • Much more important than being free, it will stay free forever. Like most free software, its code carries a license that prevents it from being bought by a firm and stop being free.
  • Your distribution doesn't only provide you with the Linuxoperating system, but with almost any piece of software that runs on Linux. As a consequence, all your applications can be installed easily from your distribution's servers, and your whole computer, not only the operating system but ALL yourinstalled applications, are updated automatically.
  • Linux inherits another very important thing from Unix: The rock-solid built-in protection of networking, files, processes and users. As a consequence, Linux is almost invulnerable to viruses (there is no Linux virus known today) and easily protected against network intrusions.
  • Linux and most free applications that runs on it are programmed and maintained by people who have no commercial reasons to do it. They do what they think is best, not what they think will sell better. Your software will never force you to buy a new computer (Linux and most free software run fine on very old hardware) or a new plugin, and software evolves extremely fast (new features land on your system almost every single day).
  • People who make free software are extremely social. You find them easily, talk to them, discuss, share ideas, and easily get involved in directions your favorite application is taking. All happens through forums, email discussions, chat rooms or facebook pages. If you miss some feature and you can convince people of the importance of your claim, chances are high that someone will implement it.
  • Linux can safely be installed side-to-side with another operating system such as Windows. A menu will then appear, at boot time, to allow you to choose which system to boot to.

The Bad

Of course nothing comes without disvantages. Here are a few issues you might expect:
  • Bleeding-edge new hardware might not be totally supported yet. Nobody has commercial urge to make Linux work for your particular hardware, so you usually have to wait until some Linux programmer will get one for him, be annoyed be the fact it isn't supported, and remedy the situation. It's always a good idea to test before installing or investigate before buying.
  • Windows software doesn't run on Linux systems. You will need to get used to other applications. But most of the usual ones have one or many excellent or even much better alternatives in Linux, and nowadays more and more applications such as Google Chrome, Firefox or Open Office can run on both Windows and Linux. Some more specialized commercial-grade applications such as engineering applications still don't have a Linux alternative, though. You will sometimes need to do some homework and find workarounds to palliate to that situation.
  • There is no firm behind Linux. Nobody to call, nobody to complain to. Although some firms may offer you tech support, you are on your own in most cases. But fortunately most answers are very easy to find on the internet, a simple search like "How to resize a picture in Ubuntu" will usually give you an easy and immediate answer.

So what does it look like?

If you managed to read until now, you must be a bit curious to see what it looks like, right? I gathered here a couple of screenshots from the most common distributions:

Below is the latest version of Ubuntu, probably the most famous of all Linux distributions, and one of the most friendly to new users. In this version, Ubuntu introduced a new way to navigate through your files and applications, called Unity, which is the vertical bar containing icons on the left:

Another very good distribution is LinuxMint. Linux Mint is based on Ubuntu, so it inherits all the qualities of its father. But its developers put a special effort into style and design, so Linux Mint is often the favorite distribution used by artists:

This is another of the most famous ones among new users, called Fedora. Fedora is derived from a famous commercial Linux system called Red Hat, and it inherits from it a great deal of novelty and power. Fedora is usually liked because it brings bleeding-edge features faster than the others:

But most Linux systems are deeply customizable, and you can usually make your desktop look like your wildest dreams. Here is, for example, a screenshot of my own desktop:

How to get it

Most Linux distributions have a great feature: The installation CD is also a Live CD, that allows you to run your Linux system entirely from the CD, without installing anything. This is a great way to test, to see if it runs well, and if you like it at all, without risking to do any harm to your current system. The proceeding is very simple:
  • Download an .iso CD image from one of the distribution sites indicated above. Sometimes they have several flavours, such as 32bits or 64bits. Choose one that suits your computer. Since a full CD image is a big file (700Mb), Most of them allow you to download it via bitTorrent if you prefer. Some even provide DVD versions, which include more pre-installed applications.
  • Burn that image on a blank CD. Be careful, burning an image is not the same thing as copying a file on a CD. Simply copying the .iso file on the CD won't work, you must either right-click on the .iso file and select a "burn this image to disc" option, or open your disk burning software and find the "burn disc image" option. When your disk is burned, it will contain several files, not the .iso file.
  • Now place your fresh CD in your CD drive, and reboot your computer. On some systems, you must allow your computer to boot the CD before booting the Hard drive, this is usually done by pressing a key (F2, F12) during the first seconds after powering up and selecting your CD drive in a list.
  • Your new operating system will now boot. Remember that nothing is copied to your computer, so you can play safely with everything, there is no risk to harm anything. Just remove the CD and reboot, and you'll be back to your original operating system. But remember too that nothing you do while you are running from the CD will be saved, so you will loose any work you do during that time.
  • Most Linux distributions, when running from the CD, will have an "Install to Hard Drive", icon, which you can use when you are ready to install. You will then be taken to a step-by-step install procedure.
Now where are the file explorer, the internet explorer, the windows messenger, the acrobat reader, photoshop, skype, notepad, word, excel? Well, almost none of those are there, but all have at least one equivalent. Explore the menus and you will find everything in no time. And if something is missing, it can easily be installed by the system itself.

This is, for example, the Ubuntu software center, from where you install just about anything:

Okay, after all this bla-bla, what about doing architecture work?

The problem you'll encounter with Linux is that none of your usual architecture software will work. No Autocad, no Revit, no Archicad, no Vectorworks, no 3DS Max, no V-Ray. Those are all windows-only (some run on Mac too), and it's very unlikely that their developers will want to spend time in doing a Linux version in the near future.

So, how bad exactly is the situation?

Actually it is not bad at all, but you will need to learn to use new software, there is no way to avoid that part. Apart from that, it is actually possible to work without any problem.
In the 2D CAD field, we have a couple of options now. Some are totally free, like QCad,Cademia or the new and promising LibreCAD. Those, since they are maintained and developed by a community, might lack some commercial features like DWG format compatibility. This is LibreCAD:

We also have several commercial applications, which are not free, but run natively on Linux, and have all the features that you would expect from a commercial application, such as DWG compatibility and technical support, like Ares Commander and BricsCAD. Here is BricsCAD:

And, since a couple of months, we now have a free AND commercial application called DraftSight. DraftSight, although owned by a company, is distributed for free, and supports DWG format natively:

Here unfortunately things are less easy. There is at the moment no ready solution, but there are several efforts going in that direction, so the future is promising. One of these efforts is an application called FreeCAD to which I have the honor to contribute with coding in my spare time. FreeCAD is a full modern parametric modeler, and although very young, it already has a lot of interesting functionality for doing architecture, such as a 2D drawing module, usual 3D tools such as extrusion and booleans, and a 3D-to-2D module. A real BIM module is also in development.

I write a lot about FreeCAD on this blog...
In the area of 3D rendering, things are not only better but state-of-the-art, thanks to an amazing piece of software called Blender. Blender runs on windows too, so chances are high that you heard about it already. Blender is for me the best general-use 3D application available today. Better than 3DS Max, better than Maya. It is faster, smaller, and made by 3D users instead of made by Autodesk. Blender can do everything that those 2 applications can do, and has several external renderers available.

The only drawback of blender is that it can be hard to learn if you are much used to another 3D application. But I warned you about that already...

In fact, I use Blender so much that it is now not only what I use to do rendering, but also to compose architecture:

I also write a lot about Blender, there are also many tutorials on the homepage of this site.

But there is something I didn't tell you yet. Remember I told Windows applications don't run on Linux, right? Well it's not totally true. There is a little gem of a software, called Wine, which allows to run Windows applications on a Linux system. It won't work with all applications, and many will run with problems. But one of the applications that runs almost perfectly is Sketchup! Installing Windows applications with Wine is nowadays almost as easy as installing them on Windows, and they integrate seamlessly on your desktop (But of course it is never as comfortable and fast as running a native Linux application). The Wine website has a list of windows software that runs with it, with ratings, comments and notes.
What would be of us architects without photoshop, right? The most famous Linux photoshop-like application is called Gimp, and, although many purists will argue that it lacks some or another indispensable photoshop option, is an excellent and very mature application, totally able to perform all the tasks architects usually require from photoshop, and, thanks to the typical friendliness to extension and customization found in most Linux applications, you can extend it into a very powerful digital painting platform.

To give you an idea, this is the kind of drawing that you can achieve with gimp only:

But a lot of digital artists use Linux nowadays, so there are many more interesting tools available, like MyPaint or Krita. Another must-have Linux application is inkscape, which is a vectorial drawing application, similar to Corel Draw or Illustrator. It is commonly used for drawing diagrams, icons and vector artwork, but is perfect for mounting more complex presentation sheets.

Also worth noting, many of those applications also run on windows, so it's a good place to try.

Are there architects out there who use Linux?

Because of all the little problems but mostly because it is not very well known, very few architects use Linux at this time. But things are changing fast... Here is a list of interesting people who share tips, techniques and resources about the subject: Enjoy!

in categories  linux  opensource  permalink:  111   posted on 07.07.2011 18:24
From Yorik

Wine color theme

It's pretty easy to save a color theme for wine. Just locate the corresponding part in your .wine/user.reg, then paste it in a new .reg file, and add "HKEY_CURRENT_USER" to the first line. The final file reads like this:

[HKEY_CURRENT_USER\\Control Panel\\Colors] 1309724542
"ActiveBorder"="212 208 200"
"ActiveTitle"="10 36 106"
"AppWorkSpace"="128 128 128"
"Background"="58 110 165"
"ButtonAlternateFace"="181 181 181"
"ButtonDkShadow"="0 0 0"
"ButtonFace"="2 2 2"
"ButtonHilight"="40 40 40"
"ButtonLight"="12 11 10"
"ButtonShadow"="0 0 0"
"ButtonText"="128 128 128"
"GradientActiveTitle"="166 202 240"
"GradientInactiveTitle"="192 192 192"
"GrayText"="128 128 128"
"Hilight"="255 128 0"
"HilightText"="0 0 0"
"HotTrackingColor"="0 0 128"
"InactiveBorder"="212 208 200"
"InactiveTitle"="128 128 128"
"InactiveTitleText"="212 208 200"
"InfoText"="0 0 0"
"InfoWindow"="255 255 225"
"Menu"="2 2 2"
"MenuBar"="212 208 200"
"MenuHilight"="255 128 0"
"MenuText"="192 192 192"
"Scrollbar"="212 208 200"
"TitleText"="255 255 255"
"Window"="28 28 28"
"WindowFrame"="0 0 0"
"WindowText"="255 255 255"

Then you can apply it with: regedit myfile.reg"

in categories  linux  permalink:  110   posted on 07.07.2011 18:16
From Yorik

Linux steam launcher

You can then launch steam alone with "steam", or directly launch a game with "steam 2770" (being the game number you find in the desktop link that steam creates when installing a game).
cd /home/yorik/.wine/drive_c/Program Files/Steam
if [ "$#" -gt 0 ]; then
    wine Steam -applaunch "$@"
    wine Steam

in categories  linux  opensource  permalink:  104   posted on 26.06.2011 1:27
From Yorik

Conky setups

These are 3 conky setups I use frequently. All of them make use of two little apps I wrote called fluxtwitter and fluxweather, to get weather and twitter timeline, and gcalcli to access google calendar. The on-desktop terminal is tilda.

conky-yell - based on another one I found on the net, I can't remember where... I liked the big design date, and added a couple of more info...

conky-orange - this one s based on the famous ubuntu conky orange theme, which you will need for this one to run (at least the lua file, responsible for drawing the gauges).

conky-oneliner - a one-line conky setup, also adapted from another one I found on the net.

in categories  linux  permalink:  94   posted on 01.06.2011 19:54
From Yorik

Refreshing the Sketchup window on Linux

Sketchup has the annoying particularity to not refresh its window correctly when you run it on linux + wine. This little trick uses the xrefresh utility to refresh a pixel at the center of your screen, forcing the sketchup window to redraw. Put the following code in an executable script:
urxvt -e watch -n 0.3 xrefresh -geometry 1x1+500+500 &
cd /home/yorik/.wine/drive_c/Program Files/Google/Google SketchUp 8
wine ./SketchUp
kill $watchPID
Retrieved from http://credentiality2.blogspot.com/2010/04/ubuntu-linux-sketchup-using-wine.html

in categories  linux  opensource  permalink:  87   posted on 14.05.2011 24:24
From Yorik

Haiku2011 desktop theme

Download it from http://yorikvanhavre.deviantart.com/#/d3gc0l2

in categories  linux  blender  opensource  permalink:  67   posted on 07.04.2011 24:59
From Yorik

Gimp Multilayer EXR import plugin

This plugin imports multilayer EXR images into GIMP. Please note that layers contained in the EXR image will be converted to tga format and therefore reduced to 8bit/channel. So, don't use this plugin if you want to import high-range (HDR) images into the gimp, but simply for importing multi-layer images such as exported by blender.

For this plugin to work, you also need the djv tools (djv-info and djv-convert) installed and correctly running on your system. See http://djv.sourceforge.net for info & download. To install the plugin, simply copy the file-exr.py file into your gimp plugins folder. It is tested on linux but should work on any platform.

The workflow you can achieve with this plugin is the following: When rendering an image in blender, you can divide the render into several render layers, specifying for example to render each blender layer in a different render layer. You then specify "multilayer" as the image format.

Then, after saving the image as an .exr file, just open it in gimp (gimp will now recognize the format) and all the layers will be imported as separated layers, for your painting convenience... Enjoy!

Example of the results here...

in categories  linux  permalink:  66   posted on 07.04.2011 18:25
From Yorik

DraftSight launcher for linux 64bits systems

I modified a bit the DraftSight launcher so it behaves correctly on a 64bit system and adopts your current gtk theme. You must of course take care of having the correct gtk engines in /usr/lib32 (usually by simply installing ia32-libs-gtk).
export GTK_PATH=/usr/lib32/gtk-2.0/
export QT_PLUGIN_PATH="$BINDIR:$BINDIR/../plugins"
if [ -d /usr/lib32/gconv ]; then
  export GCONV_PATH=/usr/lib32/gconv
cd "$BINDIR"
if [ "$#" -gt 0 ]; then
    "$BINARY" -style gtk "$@"
    "$BINARY" -style gtk

in categories  blender  opensource  linux  permalink:  57   posted on 26.03.2011 4:04
From Yorik

Generating vector 2D views of 3D models

The other day I found this interesting little trick with my friend Omar to get a precise vector 2D elevation view of a 3D model in blender. It implies a bit of swap work between applications but the result is just perfect.

1. Export your blender model as .3ds

2. Import that 3ds model in sketchup. Be sure to mark "merge coplanar faces" in the import options.

3. Set yourself in front view, set the camera to "parallel projection" and print your view as a pdf file (on linux you must have the cups-pdf package installed for wine applications to see the pdf printer). Be sure to mark "Use high accuracy HLR" otherwise your pdf will contain bitmaps instead of vectors

4. Open the resulted pdf file in inkscape (on linux you need the uniconvertor package for inkscape to be able to open pdf files), explode if needed (and remove filled areas if you wish, will make it load faster in blender afterwards) and save it as a svg file

5. Open the svg file in blender, now you just need to scale it to the exact size of your model...

in categories  opensource  linux  permalink:  38   posted on 22.02.2011 16:15
From Yorik

Small utility to join alpha and diffuse images

The other day we bought a "people" texture pack from pro-viz. Great resource, I liked much their cool, contemporary, world-citizen people. Fits in almost any project in the world. The only small problem, the texture come in 2 separate image sets, one for diffuse and one for alpha. This is pretty common among alpha texture packs you can find on the net.

So I built up this little utility which scans a folder for alpha and diffuse subfolders, and joins both corresponding images into one .png image. It works on linux, probably out of the box on mac too (imagemagick must be installed), and supposedly on windows too if imagemagick's "convert" utility is in the search path.

import sys, os

args = sys.argv[1:]
if len(args) == 2:
    diffusedir = args[0]
    alphadir = args[1]
elif len(args) == 0:
    diffusedir = 'Diffuse'
    alphadir = 'Alpha'
    diffusedir = alphadir = None
    print '''                                                                              
        joinalpha [Diffuse Folder] [Alpha Folder] - joins alpha and diffuse images         
        If no folder is specified, defaults are "Alpha" and "Diffuse"                      

if diffusedir and alphadir:
    diffusedir = os.getcwd() + os.sep + diffusedir
    alphadir = os.getcwd() + os.sep + alphadir
    if os.path.exists(diffusedir) and os.path.exists(alphadir):
        alphanames = os.listdir(alphadir)
        diffusenames = os.listdir(diffusedir)
        if len(alphanames) == len(diffusenames):
             print 'joining ' + str(len(alphanames)) + ' files...'
             for i in range(len(alphanames)):
                f1 = diffusedir + os.sep + diffusenames[i]
                f2 = alphadir + os.sep + alphanames[i]
                fn = str(i+1).zfill(4) + '.png'
                options = '-colorspace RGB -alpha Off -compose copy_opacity -composite'
                execute = 'convert "' + f1 + '" "' + f2 + '" ' + options + ' "' + fn + '"'
                print 'creating ' + fn
            print "Alpha and Diffuse folder have a different number of files"
            print alphanames, len(alphanames), diffusenames, len(diffusenames)
        print "Couldn't find Alpha or Diffuse folders:",alphadir,diffusedir
    print "No Alpha and Diffuse directories specified, or no 'Alpha' and 'Diffuse' direcories in current folder"

in categories  linux  opensource  permalink:  13   posted on 16.01.2011 18:12
From Yorik

pdf to jpg to jpg manipulations

Just a reminder for myself actually. This is a couple of handy commands that use imagemagick for converting to/from a batch of jpg images into a pdf file. This is also a good way to change the resolution of a pdf file containing only images.

convert -scale 1200x1600 myFile.pdf image%d.jpg
convert image*.jpg newFile.pdf

in categories  linux  permalink:  256   posted on 01.12.2010 24:47
From Yorik

A simple backup script

I use this script at home to create a mirror effect between 2 machines, every hour the contents of a given folder on machine A get synced to a same folder on machine B. For our little 2-machine workplace, this is a pretty handy backup system. You must first setup your fstab so that you can mount a remote folder as normal user, adding something like this (changing "credential-file" by the path to your credentials file):
// /media/backup \
cifs credentials=credentials-file,uid=1000,gid=1002,rw,user,noauto 0 0
Then, save this in your exec path and make it executable:
umount /media/backup
if mount /media/backup; then
    echo "network drive mounted, performing backup... "
    rsync -rtvx --delete /path/to/my/Worksfolder /media/backup
    umount /media/backup
    logger works backup done
    echo "unmounting... done"
    echo "backup failed"
    logger works backup failed
The logger line inserts the text that follows into the syslog, which is useful so you can check later if something went wrong and when. Then, add this to your crontab (using "crontab -e"):
00 * * * * /home/yorik/bin/backup
Which means "run each minute 00" which means run every hour.

in categories  opensource  linux  permalink:  298   posted on 28.11.2010 3:46
From Yorik
Multiple sourcing in debian

This is more a note for myself in case I need to do it again some time. You can use one specific version of debian, and add occasionally packages from another one. This might be very handy in case you are using the testing repository, because sometimes a package dependency breaks and the best way to solve it is to install the missing package from unstable.

Keep in mind before trying this that debian versions are really made for what their name suggests, and if you want a system without problems, just stick to the stable version and don't try anything funny. On the other hand, if you are comfortable with linux and the debian packaging system, I find the testing version an excellent choice. Occasionally a package dependency breaks (usually bugs in the unstable version prevents a package to enter testing), and the package and its dependents get kept back by apt, so you must be very careful using apt-get dist-upgrade.

If you can't wait for the bugs to be fixed and the package to land in testing, it is quite easy to add exceptionally some packages from other version. First, add the desired repository to your /etc/apt/sources.list file:
deb http://ftp.br.debian.org/debian unstable main contrib non-free
deb-src http://ftp.br.debian.org/debian unstable main contrib non-free
Then, either add this to your /etc/apt/apt.conf.d/00defaultrelease file (create if necessary):
APT::Default-Release "testing";
But this will simply mark the testing repository with higher prioritary, which means if a package is temporarily unavailable in testing, the unstalbe package will be installed, either add this to your /etc/apt/preferences.d/00Default (create if necessary):
Package: *
Pin: release a=testing
Pin-Priority: 500

Package: *
Pin: release o=Debian
Pin-Priority: -10
This will give to the testing release a priority of 500 (the normal priority for your main repo), and any other official debian repository a priority of -10, which means: NEVER install from there.

Then, to force-install a package from unstable, do:
apt-get install packagename/unstable
But be careful when that package pushes a lot of dependencies, because you'll begin to mix much different versions and it can give you headaches later. Better to keep this for emergencies, and with safe packages (that you know well, and that have few or no dependencies).

in categories  linux  permalink:  21   posted on 28.11.2010 3:42
From Yorik


download it here
This is a very simple and small pygtk app that I wrote because I wanted a very simple twitter reader, with no fancy feature or button or post function, since I post to identi.ca with pidgin. The great fun of twitter being clicking on the links that your friends give, that function at least is supported...
Since version 0.2, fluxbox pseudo-transparency is now supported. This will currently only work in fluxbox (the app looks for a fluxbox background image). You can set the desired level of shading too.

in categories  linux  permalink:  20   posted on 28.11.2010 3:42
From Yorik

Niroki fluxbox theme

Download it here
There is also a matching gtk theme.

in categories  linux  permalink:  19   posted on 28.11.2010 3:40
From Yorik

Kenshiku fluxbox theme

download it here
This is a theme for fluxbox. To give best results, enable transparency and set toolbar alpha to 0 and menu and window alpha to 128.

in categories  linux  permalink:  18   posted on 28.11.2010 3:39
From Yorik


Download it here
This is a small application made primarily for fluxbox but can also be used on any system with a system tray supporting gnome. Just download the script somewhere, and configure a couple of settings, read the script file for info.

in categories  linux  permalink:  17   posted on 28.11.2010 3:38
From Yorik

Tango colors for urxvt

Just put the following lines in your .Xdefaults file:
urxvt*foreground: #f2f2f2
urxvt*background: #101010
urxvt*color0: #101010
urxvt*color1: #f13a21
urxvt*color2: #93f91d
urxvt*color3: #ffd00a
urxvt*color4: #004f9e
urxvt*color5: #ec0048
urxvt*color6: #2aa7e7
urxvt*color7: #f2f2f2
urxvt*color8: #1d202f
urxvt*color9: #ff361e
urxvt*color10: #ffc005
urxvt*color11: #93ff00
urxvt*color12: #0071ff
urxvt*color13: #ef0051
urxvt*color14: #4bb8fd
urxvt*color15: #a020f0
urxvt*transparent: true
urxvt*shading: 50
urxvt*fading: 50
urxvt*font: xft:Bitstream\ Vera\ Sans\ Mono:style=roman:pixelsize=13
urxvt*scrollBar: false

in categories  linux  permalink:  16   posted on 28.11.2010 3:37
From Yorik

Simple firewall

This is a very simple firewall I was once taught by my friend Fabio. Just copy these lines in a blank file, make it executable, and have it executed some time during your init process. My favorite way is to add this in /etc/network/interfaces:
auto eth1
iface eth1 inet static
post-up /etc/network/if-up.d/firewall.sh
This is the firewall script:
# Cleans the iptables
iptables -F
# Enables internet connection sharing
modprobe iptable_nat
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
# Opens some ports (22=SSH, 1080=Socks)
iptables -A INPUT -p tcp --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp --destination-port 1080 -j ACCEPT
# Allows localhost everywhere                                                              
iptables -A INPUT -s -j ACCEPT
iptables -A OUTPUT -s -j ACCEPT
# Opens local network
iptables -A INPUT -p tcp --syn -s -j ACCEPT
# Closes everything else
iptables -A INPUT -p tcp --syn -j DROP

in categories  linux  permalink:  15   posted on 28.11.2010 3:36
From Yorik

DXF Converter

Download it here
This python application converts a dwg file to a dxf 2007 file with same name. To use it, you must have wine installed, and set the correct path to the EveryDWG utility by editing this script. The EveryDWG utility can be downloaded free of charge from the opendwg website but you must agree to their license terms before downloading.
Usage: dxfconvert.py path/to/file.dwg
Options: -h, --help: prints this help message

in categories  linux  permalink:  14   posted on 28.11.2010 3:35
From Yorik

DXF thumbnailer

Download it here
This application generates a 128x128px PNG image showing the contents of a DXF file. In order to speed up the image generation process, only a few types of entities are read, so complex files might not get rendered accurately or even fail to render. In order to use this program, you must configure your file manager to use it as a thumbnailer for dxf file type (mime type: image/x-dxf).

For thunar: Download this dxf-thumbnailer.Desktop file and place it in /usr/share/thumbnailers. That's it!

For nautilus: Open the gconf editor and add an entry to desktop->gnome->thumbnailers called

Other file managers: Honestly I don't know, I don't use any other, but most of them have a way of including thumbnailers. If you find a way to make it work, please tell me how and I'll include the instructions here.

in categories  linux  permalink:  13   posted on 28.11.2010 3:34
From Yorik

My apt sources.list file

This is just for me to remember, actually, but here it goes neverthless. These are my software repositories for Debian Testing. I have the Unstable index in there too, so be sure to set the appropriate priorities as explained here, or comment out the unstable line.

          # official debian repositories. Beware, there are unstable and experimental there.
	  deb http://ftp.br.debian.org/debian testing main contrib non-free
	  deb-src http://ftp.br.debian.org/debian testing main contrib non-free
	  deb http://security.debian.org/ testing/updates main contrib non-free
	  deb http://ftp.debian.org/debian experimental main
	  deb http://ftp.br.debian.org/debian unstable main contrib non-free
	  deb-src http://ftp.br.debian.org/debian testing main contrib non-free
	  # wine, to get the most recent version, much more updated than offcial debian
	  deb http://www.lamaresh.net/apt squeeze main
	  # google, mainly to get chrome updated
	  deb http://dl.google.com/linux/deb/ testing non-free
	  # debian multimedia, for ffmpeg with all non-free codecs
	  deb ftp://ftp.debian-multimedia.org testing main
	  # spring, a RTS game
	  deb http://ppa.launchpad.net/spring/ubuntu jaunty main
	  # wxwidgets, temporary hack to get a better version
	  deb http://apt.wxwidgets.org/ lenny-wx main
	  # unknown horizons, a CIV-style game
	  deb http://packages.unknown-horizons.org/squeeze weekly main
	  # opera
	  deb http://deb.opera.com/opera/ squeeze non-free
	  # playdeb, almost everything works on debian too
	  deb http://archive.getdeb.net/ubuntu karmic-getdeb games
	  # EKD video editor
	  deb http://download.tuxfamily.org/ekdforum/ekd squeeze contrib

in categories  opensource  linux  permalink:  227   posted on 25.11.2010 18:09
From Yorik

A simple online backup app

This little python app makes a zip file from a given directory, then either sends it with a given gmail account, or uploads it to a given ftp location. You must configure a couple of options in the script, though.

in categories  opensource  linux  permalink:  215   posted on 28.11.2009 4:27
From Yorik
Simple twitter reader

This is a simple pygtk-based application that puts an icon in your system tray, that shows a simple window containing your friends tweets when you click on it. Web links inside tweets as well as @someone or #subject tags are clickable, and there is a settings dialog to set your twitter username and preferred browser. The icon turns green when there are new unread tweets.It has no other fancy function like posting tweets, since I usually post everything to identi.ca with pidgin...
It works on debian squeeze, still untested on other platforms. You need the python-twitter and python-sexy packages installed.

Get the application here.

in categories  opensource  architecture  freecad  blender  linux  permalink:  40   posted on 28.11.2009 4:25
From Yorik
Actually I really should write a kind of FAQ or article about doing architecture on a Linux platform... Many people are indeed interested by the subject. So, here we go:

My architecture workflow on linux

Actually there is no obvious or productive workflow possible at the moment, due to the lack of good (productive) CAD software on linux. You can do architecture on linux, but you won't have the same level of productivity as if you just draw with your favorite CAD program under windows (I indeed have a dual boot system .

just for the fun, my linux desktop!

That said, if you are willing to move away from the "all-in-one" solutions that big CAD vendors sell, you already can do a very big part of the work with linux software. I myself use blender for about 80% of the conception work, the rest being simple hand sketching. You already have several good scripts to generate plans and sections from your models in blender, and export them to convenient CAD formats like DXF. Search the blender wiki scripts section.

In blender you can do all kinds of useful things like importing your hand-drawn sketches, pieces of 2D CAD plans, model on top of it, etc, for example:

blend file here

The biggest problem is then, when you want to do 2D CAD. There are indeed several solutions, like qcad, autocad under wine, bricascad/intellicad, or long-time linux CAD challengers, like cycas, graphite one or varicad. There are also a number of interesting newcomers, like realCADD or medusa. But none of those solutions are really productive and free at the same time.

What I do most of the time, when I don't need much detailing, is to use several programs, each for doing pieces of the work. This is a typical unix-like approach (use several simple, reusable programs to do separate tasks, instead of having one all-in-one program) that in my opinion could benefit much architecture workflows on linux.

I myself contribute with coding and documentation to a very interesting program (currently) named FreeCAD that could hopefully fit very well in the middle of the workflow, to rework data coming from 3D into precise construction drawings. It is in usable state already, but not for real production.

Note that FreeCAD is not at all aimed at becoming another autocad clone, and 2D drafting is only a temporary use I make of it. The plans for the future of FreeCAD include much more powerful things such as parametric modeling, automatic sectionning, or structural analysis.
Today I still use a mix of other programs, such as autocad, qcad or sketchup. I also use different utilities and convertors to manipulate different file formats, like RealCadd converter or Varicad viewer.

The same way as the data you export from a 3D program to a 2D app, the way the data is formatted is the most important point, not the program you used to make it. If you modeled your building correctly, you will have good 2D data, easy to rework in 2D. The same should apply to 2D data. If you build your technical drawings correctly, they will be easy to export to other programs for presentation work.

The presentation work in itself is also easy to do under linux, there are several programs able to import technical drawings and rework them, my favorite being inkscape:

I also use gimp a lot.

All this works quite well for short or limited architecture projects, like competitions or draft projects, but of course, not so well for more detailed work such as execution drawings. For that, we would need better tools for technical drawing. At the moment I don't know any that is strong enough to allow fast, efficient and beautiful work. But the way we draw architecture is slowly changing too, so maybe new solutions will begin to appear on the linux platform too.

And if you are interested in helping the situation to evolve quicker, there are many great open-source projects out there that could use your efforts, even if you are not a programmer. This is the case of most of the software I showed in this article.
Note: I wrote a sequel to this article, explaining how to get started with Linux...

in categories  opensource  linux  permalink:  53   posted on 28.11.2009 3:57
From Yorik
A new fluxbox theme specially made to match cleanlooks gtk theme...

in categories  opensource  linux  permalink:  194   posted on 28.11.2009 3:51
From Yorik

in categories  opensource  linux  permalink:  293   posted on 28.11.2009 3:47
From Yorik
Fluxbox and pseudo-transparency

Fluxbox is a window manager for linux and other unix-based systems, like KDE or Gnome (the default window manager in ubuntu). On a linux system, your desktop is made of a stack of different programs, basically the linux kernel, which drives your hardware, the X.org server, which is a graphical server and a window manager, which actually draws your desktop and its windows. More advanced window managers such as gnome are also called desktop managers because they do much more than just drawing windows. Like most pieces of a linux system, nothing prevents you from changing your window manager anytime.

Fluxbox is an extremely simple window manager, based on the old and famous blackbox (which even has a version for windows). Several other window managers have evolved from blackbox, such as openbox. They all behave more or less the same and have the same qualities: they are extremely simple and fast. The big difference between fluxbox and the others is that it looks much cooler, because of two things: it can use bitmap images to draw icons and window borders, so you can draw almost everything yourself, and it supports pseusdo-transparency.

Almost all recent linux distributions support openGL composition. That means that your desktop can do all kinds of cool effects such as having transparent windows or toolbars. This is done at a lower level by the X.org server, so basically anything can be made transparent (= composited) against the desktop background or other underlying windows. The problem is that this behaviour is pretty heavy on your graphic resources. Many people actually prefer to disable those desktop effects to have a faster desktop. And if you work with openGL-based 3D software such as blender or games, you will very probably encounter conflicts, bugs or slow performance and have to turn them off anyway.

Pseudo-transparency is not real transparency. It is a trick, basically a portion of the background image, which lies exactly under a window, is copied and then applied to the window. You can do other operations with that portion of image, such as mixing it with a color, etc. Then, the contents of the window are drawn. You will have a perfect illusion of transparency. Of course, if you have several overlapping window, you won't see them all through the upper one.

While this can be seen by many as a poor trick, to me it has fantastic advantages: It is all done by very basic software operations (copy an image, cut a portion of it, etc...), so basically any piece of software can do it, it doesn't use your 3D graphic board, and the fact that it is "false" transparency is actually very effective: How do you read the contents of a window if you can see the contents of the other windows beneath it? You need more effects, such as blurring the other windows, like windows vista does. More graphical resources used.

The main use I do of my system is producing 3D content. I want all the power of my system available for rendering or displaying complex 3D scenes. The biggest advantage of linux is that it is possible. A Windows Vista system uses about 500Mb of your memory. A typical Gnome desktop uses about 300Mb. They all have a lot of resident programs to monitor things like network, user input, mounting/unmounting, etc. A fluxbox desktop can occupy less than 100Mb, and almost zero load of the graphic board. Applications start in fractions of seconds (no resident programs have to check for this or that), and, best of all, pseudo-transparency allows for totally cool desktop look...

Another advantage of all blackbox-based window managers is the extreme simplicity of configuration. All the behavior of your desktop is stored in 2 or 3 text files, that you can either edit with a text editor or use specially-made configuration applications such as fbconf. The themes are also single text files, with an extremely easy syntax, like window.title.color = #FF3300. And on debian-based systems, the debian menu system takes care of updating your applications menu automatically. Fluxbox also has a couple of specific goodies, such as the ability to group windows different into one tabbed window.

How to try

It is very easy to have a look. Install the "fluxbox" package in your software repository, and next time you login, on your login screen, you will have a new fluxbox session available. You can have just a try, and come back to your default desktop by logging out/logging in again. Once you are in fluxbox, right-click anywhere on the desktop background to display the fluxbox menu, that contain about everything, your applications, styles (themes) and fluxbox configuration options.

You also have per-window settings, available by right-clicking any window title bar. Fluxbox can remember several things for each applications, such as window position, level, etc.

How to configure

In your home directory, a ".fluxbox" folder will be created. Inside that folder, there is an init file that contains fluxbox general parameters. The contents of that file basically reflect what you can configure from the fluxbox menu itself. The second important file is the menu file, which contains all the contents of your fluxbox menu. If you are on a debian-based system, make sure it contains a "[include] (/etc/X11/fluxbox/fluxbox-menu)" line (or "[include] (/home/yorik/.fluxbox/fluxbox-menu)" for user-space version), so your menu will automatically show installed applications.

You then have a keys that contains all keyboard shortcuts, and a couple of other files that usually don't need to be edited by hand (they are used for example to remember windows states). There is also a styles folder that contains all your user-installed custom styles (or themes).

The two file types you will usually edit to customize your fluxbox desktop are the menu file and the style files. Both have a very complete man page: just type man fluxbox and man fluxstyle in a terminal.


Fluxbox itself can apply pseudo-transparency to everything it draws: toolbar, window bars and menu. Simply right-click and browse the available options to set the transparency levels.

Then, you have several terminals that support pseudo-transparency as well, such as aterm or urxvt (my favorite). You have then several excellent terminal applications (such as emacs or midnight commander) that, if run inside a pseudo-transparent terminal, will behave the same way.

Finally, if you know a bit of coding, making your own pseudo-transparent application is quite easy too. Here is a pygtk code to produce a pseudo-transparent application such as in the first screenshot above (look at the twitter application):

import os, gtk

class pseudoTransparentWindow:
      def __init__(self):
          self.win = gtk.Window()
          self.win.set_size_request(250, 200)
          btn1 = gtk.Button("Test Button")
          fixed = gtk.Fixed()
          fixed.put(btn1, 20, 30)
          layout = gtk.ScrolledWindow()
          self.win.connect('configure-event', self.updateBackground)

     def updateBackground(self,args=None,stuff=None):

     def style(self,widget):
          x,y = self.win.get_position()
          w,h = self.win.get_size()
          wpfile = open(os.path.expanduser('~') + os.sep + '.fluxbox/lastwallpaper')
          crop = gtk.gdk.Pixbuf( gtk.gdk.COLORSPACE_RGB, False, 8, w, h )
          pb.copy_area(x, y+self.toolbarheight, w, h, crop, 0, 0)
          mask = crop.copy()
          mask.composite(crop, 0, 0, w, h, 0, 0, 1, 1, gtk.gdk.INTERP_BILINEAR, 127)
          pm,m = crop.render_pixmap_and_mask(255)
          style = widget.get_style().copy()
          style.bg_pixmap[gtk.STATE_NORMAL] = pm
if __name__ == '__main__':

in categories  opensource  3d  linux  permalink:  300   posted on 28.11.2009 3:45
From Yorik
Moonshake fluxbox theme

This is a new fluxbox theme I just made. In the archive, there is also the .blend file I made for the background. Download it from here: http://yorikvanhavre.deviantart.com/art/moonshake-fluxbox-theme-145162287