Monday, 12 November 2007

Vector Video Codec

Today lots of comics are streamed over the Internet. But they are saved and compressed with a pixel based algorithm. Why? If I look at comics I see Vectors. So why are these videos not compressed as vector images. As far as a Google search goes there is nothing like this available. Further the backgrounds seam to be quite static in comics so these wouldn't have to be redrawn, only the foreground normally moves.

bash-3.00$ ls -lah /tmp/Spectre.svg
-rw------- 1 xxx 110K Nov 12 14:09 /tmp/Spectre.svg
bash-3.00$ zip /tmp/lol.zip /tmp/Spectre.svg
adding: tmp/Spectre.svg (deflated 69%)
bash-3.00$ ls -lah /tmp/lol.zip
-rw-r--r-- 1 xxx 35K Nov 12 14:10 /tmp/lol.zip
bash-3.00$

According to this compression is quite easy too. Comments welcome

Friday, 26 October 2007

DicHash

Hashing is a superb way of validating and in some way to find out if someone has tempered with your files. But the chances are that if he can tamper with your files that he could change the table of hashes. So how to find out if someone has really done something bad to your computer. My idea is that you can create a hash with a password. So to hash a file you have to enter a password this is incorporated into the hash. So only if the file has not changed and the password was right the hash will be the same. But now this will return (c2471b27e6a1410c1e51814a5a7011a3ee8692af) a normal human being can not remember this. So why not map this hash to a dictionary. So i have a file (listofimportantfiles) I hash this with my password then I map this to a dictionary and the program returns 'tree'. I can easily remember tree as the correct hash but not c247.... Of course to be 100% correct you would need a dictionary as big ass all hash combinations. I notice that this is impossible (+- 24^65) With a sufficient big dictionary the chances are quite small.

Tuesday, 23 October 2007

A python object graph

In python every variable is a 'pointer' to an object. But sometimes you need to know what variable points to what obj. A nice graph over time would be nice.

more to come

Monday, 15 October 2007

File viewer

Many files are associated with a special viewer. For example I use less to view text files, eog for images, mplayer for vids and music. Why do I always have to type the appropriate program. Why can't I just call a script that will use the 'file' command and open the appropriate viewer? Basically just a few if cases
if [`file $fileToTest | cut -d' ' -f2` eq "JPEG"] then; eog $fielToTest; fi
and so on.
This must have been done. Does someone know somethinglike this?

You can apply the same idea to editing files too.
So two programs 'e' and 'v' schould be nice.

Thanks to my friend David Garcia Quintas
http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html

Interactive shell

I work entirely in the shell. I don't really need more :) But I spend most of mine time typing ls, emacs [somefile], mv this rm that and lots of less. Further I repeat a lot of commands, especially when I am programming. Some stats out of my .bash_history. (1000 lines)
63 x make
159 x ls
22 x rm
101 x cp
42 x emacs
25 x less
$cat .bash_history | sort | uniq | wc
359
from 1000. So 641 commands are repeated.

You get the idea. So I am a computer programmer, I am lazy, what I can I do against this?
Create an interactive shell.
The shell sits there and waits. As soon as you hit any key (not Enter or Space) it goes into a special configured mode. And then does appropriate. So if I want to ls a dir, I just type 'l' and then this resolves to ls. If I want to edit a file I type 'e' and then the file name.
This is in somewhat different to alias. As you don't have to hit space. A little example:
I want to edit a file:
bash : em [TAB] [SPACE] file [ENTER]
alias : e [SPACE] file [ENTER] (assumeing alias e=emacs)
dash : e file [ENTER]

Further you can suggest auto completion based on what you normally type. If you have completed a command and you hit enter again it will just repeat the command. This should get rid of about 80 % percent of the stuff I type into the shell.

In 1000 shell commands I had to type a space after 756 commands. (Remember 159 are only ls)
$cat .bash_history | grep -E "[a-zA-Z] ." | wc -l
756


If you hit space you will drop down to normal bash. So you can start creating the wonderful piped commands.