Jun 5 2010

aero snap functionality with compiz

After having tried different tiling window managers to improve my productivity and simplify management of all the windows my desktop usually consists of, I found a nice blog article and customized its approach a little further (Get Aero Snap in Ubuntu)

This will enable you to align windows left, right and maximized by either moving windows to the edges or pressing certain shortcuts (Meta+Left, -Right, -Up).

Despite following the instructions on the aforementioned website I made the following customizations:

Firstly, I didn’t set the Edge Triggers, because I couldn’t get used to them ;) Also, I added a command for removing the maximized state of a window. With my desktop settings, it appeared that a window on the left and a window on the right will overlap for a few pixels, so I also readjusted the command for right.

These are my final results for the commands:

Left
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 \
-d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r  :ACTIVE: -b add,maximized_vert && \
 wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
Right
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 \
 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && \
wmctrl -r :ACTIVE: -e 0,$(($HALF+2)),0,$(($HALF-2)),-1
Up
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
Down
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz

May 11 2010

glipper pastie – a nopaste addon for glipper

I really like the gnome panel applet glipper. But sadly, its nopaste-plugin refuses to work. The formerly used nopaste service at rafb.net has been discontinued since May 2009 already, so I decided to work out my own solution a few weeks ago.

Since I got to know Pastie, when I once started learning Ruby (on Rails) in 2007, I really favored this nopaste service.

So why not write my own glipper-plugin to work with Pastie? :)

The results are mostly based upon the old glipper nopaste plugin and some snippets from this pastie site. Also I must say that the glipper plugin development documentation is really well done.

Thus, my code is not really my code. I reused a lot ;) Since the original source code is LGPL’d, I won’t think this will lead to any problems. Feel free to contact me otherwise.

http://github.com/freddyb/glipper-pastie

Please also note, that this plugin — although it runs rock solid & stable on my machine — may not work on your machine. So any bug reports are highly appreciated!


Aug 11 2009

shorten boot-time in ubuntu

Being an impatient person means, I really, really hate waiting for something to finish. Also, on Quakenet/#wardriving, people were talking about bootchart, a program that analyzes your boot process and performs some time- and hardware load-measures and in the end renders a nice chart displaying the results. But my serious interest only arose, when I got my new PC (Intel Quadcore Q9550,  2GB DDR2, …) in spring this year and realized that booting happens rather quickly :)

After reading some forums and googling about this topic, I only implemented two of all the suggestions, but still my boot process went down to 19 secs:

bootchart

bootchart

The first advise came from hexa: I could enable concurrency in init.d scripts – this one saved me from something above 30 seconds (sorry, I deleted the old bootcharts a while ago).

So, here’s how to:

  1. open /etc/init.d/rc
  2. search for CONCURRENCY
  3. change the value to “shell”
  4. save and close the file

Your init-scripts will now run simultaneously (i.e. faster ;))

Just a few days ago, I got to know about readahead and profiling the harddisk read-processes

Doing this is rather easy, if you’ve ever meddled with boot-parameters in GRUB – but don’t hesitate if you never did, it’s still not that hard:

  1. reboot
  2. Instead of waiting or pressing Enter when “Ubuntu ..” appears in the bootscreen, press E
  3. you can now select a line you’d like to edit. Select the line that begins with “kernel
  4. press E again
  5. append the word “profile

The kernel will now perform an analyzation of your boot-process (i.e. this boot will take longer; was about 3-4 minutes for me). After this Ubuntu knows which files are needed when booting up and preloads them into RAM (saved me five to six seconds).

So, all in all, it went down to a width of 520 pixel and 19 seconds :)

P.S.: Sorry – disclaimer: I can and will not be held responsible for the actions you perform on your computer. Inform yourself on possible countermeasures and restore-functions, in case one of the stated procedures cause any harm to your system


Aug 1 2009

let the caps lock-key act as a normal shift-key

I suppose you all know accidentally hitting the Caps-Lock-Key and writing all uppercase.

So I decided to degrade this malevolent key to a usual shift-key:

Write this into ~/.Xmodmap:

keycode 66 = Caps_Lock
remove Lock = Caps_Lock
add Shift = Caps_Lock

That’s all for today, enjoy the good weather :)


Mar 30 2009

means to overcome censorship content filters

Today at the university (not during classes, just a little chit-chat with fellow students) we discussed “blocking” access to certain internet pages. The most common method would be not-resolving the blacklisted hostnames via dns. Of course it made us think about means to overcome this. Firstly you could change your desired dns-server (e.g. OpenDNS). Another suggestion was tunneling dns-traffic through other protocols. Then, on my way home I tried to construct a convenient method to tunnel dns-traffic. Maybe programm a custom driver that passes dns-requests through a tunnel? A grain of anonymity maybe? Some encryption involved?

Well, I suppose I overthought it a little, because just when I left the bus home it occured to me:

Why not use TOR?

chosenone@terra:~$ tor-resolve www.example.org
208.77.188.166

Of course this isn’t gonna solve problems system-wide, nor is it THE convenient solution, but I think tor-resolve is definately the way to go.


Mar 11 2009

ssh + wlan = irc

IRCing with my iPod. just great :-)

irssi + ipod touch

irssi + ipod touch


Feb 24 2009

music from the pc speaker

someone on IRC pasted to me:

beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659\
 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f\
 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110\
 -n -f 1047 -l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659\
 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n\
 -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l\
 230 -n -f 659 -l 700

I had quite a laugh – it’s the Beverly Hills Cop Theme :D


Feb 23 2009

transfering changes in files

Well I’ve recently stumbled on the fact, that rsync will transfer files when changed completely. So what if that file is really large (compared to the bandwidth) and there’s been only some few changes?
Wouldn’t we like to find out what was modified and just transmit the changes? This is the scheme I thought of, dunno maybe it’s a good idea:

Split the two files in a half and calculate the hash (as in cryptographic hash function) of those 4 parts. Skip the parts with a common hash and go on with the differing ones. Here comes the great (is it?) step: REPEAT (yeah, recursion AND modeling it as a tree. that’s good, right)

Of course we’d have to make some calculations how many splitting and hashing is going to happen, depending on available bandwidth and file size.

Maybe I will write a POC code in Ruby later, or maybe YOU will have an idea regarding this problem? Also, I’m wondering whether there’s already a better solution for this problem – I didn’t really take the time to do some research on this, so every comment is appreciated ;)

EDIT:

Wow…I just read the wikipedia-article on rsync and feel kinda weird. There’s already some algorithm which does exactly what I just wrote. This can’t be a coincident, I might have already read something, forgot it and hold it for my own idea.


Feb 21 2009

imagecopyresample vs. imagecopyresize

Well, recently I was improving a php gallery when I came across the task to improve the quality of thumbnail images. As a matter of fact, I’m not into graphic editing at all, so I was glad that replacing imagecopyresize() with imagecopyresample() solved the problem quite nicely.

See for yourself:

thumbnail created with imagecopyresized()

thumbnail created with imagecopyresized()

thumbnail created with imagecopyresaple()

thumbnail created with imagecopyresaple()

all thumbnails generated from photographs by LOKOMOTIV Fotografie


Jan 17 2009

alert(‘xss’)

…err Hello World!

Welcome to my new and shiny blooooog ;)
As you might have guessed, it will be all geeky and require major skills in maths, the english language and most probably TCP/IP, Javascript and Linux.

So have fun and see you later