No more 19″ rack

Posted in this blog on March 7th, 2010 by blambi

B”H

Gave it away to a friend today since had gotten tired of it and did not want to haul that ones again when we move.

So now I got the two used computers and switch etc mounted in a IKEA solution (two lack tables screwed together) and it works and do not look like a fridge on the run.

Tags:

Dank Dungeons

Posted in this blog on March 7th, 2010 by blambi

B”H

Sorry for the low amount of updates during the last months, but studies and other things have eaten quite large amounts of time.

But one of the projects that I have worked some on is Dank Dungeons, (warning: this is about boardgames flee while you can) a dungeon crawler that tries to not be to serious.

I strive to keep to some principles when designing this game:

  1. No need for pencils during gameplay or in between dungeons/sessions.
  2. Fast gameplay
  3. Leaving options open for fun combinations and intresting gaming elements

So what components are planed?

Well we got to make tiles, or find some we can recommend that fits the stile (of course there are a lot of exelent tiles already, if you use GW minis why not check out the dungeon bawl tiles.)

Also monsters/characters, both minis and cards describing them.

And wonderus items, weapons and magical spells for our players to have, that means more cards.

So what is ready now then? Well we got some monsters done, a dice mechanism and basic rules.

For example if we have two giant spiders fighting lets call the attacker A and the defender B, then it will go something like this,

  • Since it is close combat A rolls weapon controll 4d6 and gets 6, 5, 1, 6 = 3 success, a hit!
  • B rolls Thougness (2d6): 6, 4 = Will soak 1 Damage.
  • A Rolls damage for it’s bite Strenght (2d6): 1, 5 that is 1 success. So A deals 2 damage to B and that is more then B can take victory to A.

As said this is really a work in progress and quite early for me to say how it will end, but still quite close for game testing to start.

Tags: ,

Without flash

Posted in this blog on January 3rd, 2010 by blambi

B”H

Living without flash, yea that is something that is quite simple most
of the time, but well then you get some links to some random video
site and well if it isn’t a nice one it will nag about you lacking a
flash player.

For youtube there is really a lot of different solutions already, but
what about The Onion, That Video Site and a pile of
other sites?

Most of the time I don’t bother looking at ways to look at the clip,
but if I really want to then?

Quite a lot of sites are written nice enough so I can easily read out
the url to the flv/mp4/whatever-file. And well this have lead to me
having a pile of scripts for just this purpose (and then a wrapper
around wget etc to really download them).

The wrapper part most people will have there own solutions for so lets
leave that out, but here is the python script I use for The Onion:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import urllib, sys

def get_rss_url( url ):
    """fetches the url and tries to find the videoid"""
    string = urllib.urlopen( url ).read()
    for x in string.split( '\n' ):
         xpos = x.find( 'var videoid = "' )
         if xpos != -1:
             return 'http://www.theonion.com/content/xml/' + x[ xpos + len( 'var videoid = "' ) : -2 ] + '/video'

def get_flv_url( rss_url ):
    string = urllib.urlopen( rss_url ).read()
    count = 0
    for x in string.split( '><' ):
        if x.find( "/onion_video/" ) != -1:
            xpos = x.find( ".flv" )
            if xpos != -1:
                return x[15:-21]

if __name__ == '__main__':
    print "get-theonion.py v0.1.3"
    print "© Patrik Lembke 2007 - 2009"
    print "released under the terms of the GPLv3 or later"
    print

    if not len( sys.argv ) == 2 or sys.argv[1].find( "http://" ) == -1:
        print "Usage: get-theonion.py [url]"
        print "get-theonion will just give you the url for the .flv so you can"
        print "for example download it with wget."
    else:
        print "fetching: %s" % sys.argv[1]
        rss_url = get_rss_url( sys.argv[1] )
        print "fetching: %s" % rss_url
        flv_url = get_flv_url( rss_url )
        print "Video was found at: %s" % flv_url

Probably not the most pretty but it works (got another version
integrated in a epiphany extension I’m hacking on).

For more stuff like this take a look at the kakwiki page utan flash.

Tags:

from devilspie to sawfish

Posted in this blog on December 24th, 2009 by blambi

B”H

On my laptop shaggai I like
have a desktop enviorment that is “single windowed”, that is every
application window is maximised and also have it’s border
removed. (There is some small exceptions like dialogues).

To do this I until resently used GNOME + devilspie
to do this.

.devilspie/allbig.ds

(begin
  (if (is "_NET_WM_WINDOW_TYPE_NORMAL" (window_property "_NET_WM_WINDOW_TYPE"))
      (begin
        (undecorate)
        (maximize)
        )))

This acutely does the job excellently, but it was somewhat sluggish
(yea at blasting speeds that are at a between 112Mhz and a maximum
650Mhz it might be quite noticeable). I also wanted to return to one
old friend of mine again, sawfish.

(A quick side note would be that on my other laptop I run window maker another excellent WM.)

My current setup was generated trough sawfish-ui so it is not that
pretty yet (yea will rewrite it, when i get time.. hah).

(custom-set-typed-variable (quote match-window-profile) (quote ((() (maximized . all) (frame-type . none)))) (quote match-window) (quote sawfish.wm.ext.match-window))

I don’t think the best way to uses this is to yank it into
.sawfish/custom but to use sawfish-ui and add it under
matched windows, just the actions: maximized=all,
frame-type=none

Will probably come with updates to this some time later.

Tags:

Sleep Enforcer

Posted in this blog on December 21st, 2009 by blambi

B”H

From time to time I have some sleeping problems, and well that is not
the most fun you can have. And when this happens I sometimes
accidentally makes matters worse by well surfing the web and miss that
tiny moment of tiredness.

Well since that is all my fault in the same way as it is my fault that
I sometimes stay up all to long (past 24) and makes it far more likely
that “Mr I Steal Your Dreams” come by.

So I added this to my system crontab:

1 0 * * * root iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset --dport 80
1 6 * * * root iptables -F OUTPUT

That is at 00:01 in the night bam no more HTTP access from the laptop. This could
probably be better written using -m state --state NEW or
similar.

And then again at 06:01 it trows away all the output rules. I really
don’t filter my output on my laptops so no harm in trowing it all
away.

Some flaws in this are, well I could just flush it my self as root,
but then this was not written to force other people or myself, more
lika a sever reminder that the time for being awake is up.

Not that long after I wrote the original post I stumbled upon the time
extension. And well now we got an even shorter and no need for cron.

iptables -A OUTPUT -m time --timestart 00:01 --timestop 06:01 -p tcp -j REJECT
Tags:

Kakwiki

Posted in this blog on December 16th, 2009 by blambi

B”H

Yesterday I hacked some on kakwiki mostly to
remove some markups that where from the old evil days of TigerWiki,
and look into how hard it would be to completely do clean rewrites any
code that currently is still based on that code.

Sadly I did not fix one of the bugs that still irks me, simply that
the code-blocks for some reason do like to clump together. A good
example currently where this is happening is this article (source).
Hopefully that is just because of some typo in the article.

To do before 2.2.5?
simp-interface should get support for:

  • File management: upload, download(maybe not since that is just silly)
  • Articles: Upload, and read historic versions

So what is the plans/ideas for 2.3.x?
Module/Plugin system for:

  • Authentication (we should move to session cookies instead of the hash thing)
  • Article and file access
  • Going GPLv3+ (currently GPLv2+)

Non version bound plans:

  • New html template
  • Paragraf based instead of newline based (ig: use <p>...</p> and not <br />, and still not certain that this will happen.)
  • Get free from all TigerWiki code

There have also been some discussion about having the new (when it
ever is written) wiki markup similar enough to muse, so one could
write some fun little hack (either elisp or fuse) to access them and
edit visibly inside emacs.

Tags: ,

Zeroinstall isn’t my friend.

Posted in this blog on December 13th, 2009 by blambi

B”H

Sadly this is one of those rants.. please tell me to remove it if its just annoying.

Bad ideas.. they are things that come late at night quite often, like
testing ROX Desktop. Not that ROX lacks its bright points, I guess
what annoy me was the hunt for stuff to remove after the test.

I did notice the use of zeroinstall, something I find well not that
useful, and where do the applications go? Well
~/.cache/0install.net of course… wasn’t really where I
would expect programs to go. Since well its my home folder, sure I
have some applications in a prefix in my home folder but that is
another story. Having software installed like this creates a real
waste of resources on a shared system, having each person installing
their own version of inkscape… well yea that is so.. special.

If you was as unawake as me and allowed it the “installer” to add a
session to GDM/KDM, it is quite easy to remove all its files:

  • /usr/share/xsessions/rox.desktop
  • /usr/local/sbin/rox-session

This negative experience could have been avoided with some kind of
guide or some list of installed files so I did not have to hunt them
down, I think i got most of them.

In short, sadly I was not impressed and that was something I had been
by the look before. Happely it was (probalby) really easy to remove.

Tags:

LD_PRELOAD

Posted in this blog on December 10th, 2009 by blambi

B”H

Just for some fun I tried to write a little shared library. The only
function of this would be to reverse text. I decided to just work with
printf, since well it is the most common and made my life quite
simple.

Well first i had to figure out how to write a function that behaved
like printf. We know that the definition of printf is int
printf( const char* fmt, ... )
, and by reading the info file
for GNU libc (or your man file, or K&R) we find out that we need to
return the number of outputted characters, no biggie.

Well then we have the issue of not knowing how many arguments we
get. But that is quite simple to fix. Since I several times before had
used va_list and the some parts of the va_ family, I used that (not
sure maybe there are other ones?).

So how would our function look?

int printf( const char* fmt, ... )
{
    char* buff;
    char temp;
    int ret, x;

    va_list ap;
    va_start( ap, fmt );

    ret = vasprintf( &buff, fmt, ap );

    va_end( ap );

    /* mirror string code goes here */

    fprintf( stdout, buff );

    free( buff );
    return ret;
}

And well mirroring then? Not hard at all (if we as selected previously
writes an utterly stupid one).

    for( x = 0; x < ret / 2; x++ )
    {
        temp = buff[(ret - x) -1];
        buff[(ret - x) -1] = buff[x];
        buff[x] = temp;
    }

So now you know what the x and temp variables where for.

sadly this code isn’t that effective as I hoped and behaves rather
strange sometimes, not all printfs are mirrored etc, but as a simple
hack it works.

Example of the broken output:


8.0.0v tsobCopyright (C) 2006-2009  Patrik Lembke.
This is free software with ABSOLUTELY NO WARRANTY.

:mahkra
9.0.32.271 :0

So as a conclusion I have to say that it was a fun idea for showing
how dynamic libraries can do some quite interesting things to your
programs. A great example would be tsocks that makes non-SOCKS
aware programs use SOCKS a proxy by overloading certain network
related calls (in a much cleaner way then I did).

Here is the full source code and compile instructions:
ld_printf.c

Tags:

Oh so it got some speed

Posted in this blog on December 7th, 2009 by blambi

B”H

Some days ago I upgraded my phones firmware (Neo Freerunner) from some
android build (v14 something from that I downloaded 30/7) to week 44s
build of android-on-freerunner

I must say that I’m really impressed by the speed up. I guess it is at
a minimum two times faster. And now I got a working calendar, that
plus the OI applications (safe, notepad, countdown, alarm) I really
got all I want for a basic smart phone.

Or let me correct that almost all. Apparently someone did think it was
a smart idea to remove the camera application, something I happens to
understands since what good could that do one a phone without
one.. Well for some reason I cant understand it happens to do most of
the image processing also.. So now only one of my contacts shows an
image of the person calling the other looks as they didn’t have one
and shows one of the defaults. And I cant select a image as a
background that didn’t come with the firmware, well that I can get
over too.

Another point for the better is that GPS now works, now I just have to
find some free app that does more then show my position in long lat
format, speed and distance to another point in the same format. I
would even be happy with only a GPS based compass, the ones I tried
sadly lacks that and tries to talk to an electric compass.

Well now the phone feels like it is running at a really usable and
responsive speed (it sure beat my former phone in that regard now).

For android users that well like freedom I would recommend these
packages:

Tags: ,

Got a name for me?

Posted in this blog on December 7th, 2009 by blambi

B”H

So what should I name this language? basically it is a quite simple
one not really made to be of any greater use, mostly written for the
interest of learning more about tokenization and maybe later output
the token code as ASM for x86. But don’t let us get a head of our
self.

I wont say what the working name of the project is since I don’t want
that to influence you…

Hmm I will just give a code examples and let you think out a name..

print "loop test"
a = 10
label kaka
print "loops left %d", a
a = a - 1
if a > 0
jump kaka
print "done"
Tags: