lamehacks

Stuff is fun

Archive for the ‘computer stuff’ Category

View on flickriver userscript

Monday, February 6th, 2012

Flickr’s navigation and layout have been a source of increasing frustration for me. I find myself copy-pasting search phrases, usernames and tags on flickriver all the time.
To put an end to this endless copy-pasting, I put together a small userscript that adds links to flickriver on flickr pages.

It’s just a few lines of ghetto flavored javascript, but it does what it is supposed to. It works on Chrome/Chromium, Firefox and Opera. I don’t know (don’t care) if it will work on other browsers.
Download it here.

In case you want to further improve it, feel free to fork it on github:
https://gist.github.com/1748810.

Building my own computer from scratch… kind of

Tuesday, January 3rd, 2012

The elements of computing systemsI am reading The Elements of Computing Systems. I’ve been wanting to read a few computer science classics but I thought I would start by reading this instead (it’s not a classic… yet) as I feel like there are holes in my knowledge. Just as an example, I have never implemented a virtual machine nor have written an emulator. Those are the kind of basic challenges that every computer hacker should beat at least once.

This is a rather uncommon kind of textbook. First of all, it openly presents itself as a light accessible book that can easily be picked up by anybody with little knowledge of computing systems, but at the same time it sets a very ambitious goal to the reader: to build a computing system completely ‘from NAND to Tetris’. Secondly, there are no exercises for the reader to practice, there are project specifications that should be implemented by the reader. The projects are self contained, I could implement them in whichever order I wanted. That said, they communicative with each other through well defined interfaces so that in the end, the group of all the projects form a complete computing system.

I’ve red the first three chapters and it has been a joy to read and to implement the projects.

For more information about the book check out its official website.

Implementing a state machine in javascript

Sunday, December 11th, 2011

For reasons beyond my understanding, and despite their relative ubuiquity, state machines are still largely disregarded by a huge slice of programmers.
Many problems can be modeled using a state machine, the most common one is the maintenance of a database table column which holds some kind of state. Many programmers don’t realize that they are in presence of a state machine and end up throwing bits of code accross the codebase to flip state whenever necessary. They are basically resourcing to a messy ad-hoc implementation of a state machine without realizing it. Personally I’ve been tearing my hair off because of this countless times.
Simply put, if you’re going to use ad-hoc code to flip states among three or more possible values, you are going to make mistakes and ultimately render you codebase unmanageable.
(more…)

Linear algebra in javascript

Monday, September 12th, 2011

Every other week I find myself solving some kind of problem that involves matrix operations or other linear algebra concepts. I still have my old TI-89 from when I was a student. It’s a handy calculator, no doubt about that, older people will even call it a luxury. But quite frankly, I don’t know why we should use calculators considering the speed of an average personal computer. Or even a cellphone in case you’re thinking about throwing the portability argument.
Anyway, rants aside, I was bored so I put together a tiny javascript library with basic linear algebra functions.
(more…)

galleria for wordpress

Tuesday, September 6th, 2011

Galleria is an awesome slideshow gallery built on top of jquery.
After trying out about 10 different picture slideshow plugins for wordpress I couldn’t find one that would do what exactly what I want. For some reason, none of the plugins I tried was able to display more than one gallery in the same page. I wonder what use scenarios fall into that stupid restriction. Personally I don’t see any point on installing a picture slideshow plugin and use it once, but that’s just me.

So I ended up rolling my own. I googled around and picked galleria out of many javascript slideshow scripts, and wrapped it in a wordpress plugin.

Grab it from github
.

Demo slideshow:

Azulejo update – new keybinds and .deb package

Wednesday, March 16th, 2011

So… After a  great deal of procrastination, I’m releasing a deb package of azulejo with some new window tilling actions.
This is still very unstable/experimental. To take advantage of the new features, you must delete your ~/.azulejorc.js in case you’re already using azulejo.

Here goes the current list of keyboard shortcuts:

Super+2		Place two windows side by side
Super+3		Place a window on the left half of the screen and two on the right half
Super+4		Arrange four windows two by two
Super+R		Rotate windows' positions i.e. cycle windows
Super+H		Resize and move current window to the left
Super+K		Resize and move current window to the right
Super+Y		Resize and move current window to left upper corner
Super+U		Resize and move current window to right upper corner
Super+B		Resize and move current window to left lower corner
Super+N		Resize and move current window to right lower corner

Download deb package.

Simple PHP url dispatcher

Thursday, February 17th, 2011

PHP maps filenames into urls, this is a very handy feature and many applications simply use that for all their request handling needs. Practical as it can be, it’s quite limited.

Mapping url patterns into functions or Object methods is simple and easy. I’ll comment as I go…
(more…)

Azulejo Window Rotation

Sunday, February 6th, 2011

I implemented window rotation on azulejo. This is something that doesn’t come with Winsplit Revoltion, but anyone who used a tilling window manager will be familiar with it.
Azulejo does not maintain a layout (sometimes called algorithm or tilling mode mode) so I had to resource to a bit of improvisation.
(more…)

Introducing Azulejo – User friendly window tiling

Sunday, December 19th, 2010

Since my first contact with WNCK library, I’ve been willing to put together a proper solution for all my window tiling needs. After a bit of research I put together bunch of cool pieces of software and glue them together with python.
The result: a tinny application – less than 200 LoC so far – that runs on the background and listens to some defined keyboard shortcuts. Once such a keybind is pressed, it performs some user defined tilling operations.

This is still extremely experimental, yet usable. I tested it on gnome and fluxbox, appears to be working on both without any major problem. The project is hosted at bitbucket, you can   download the latest usable release here.

Usage

Run azulejo.py, it will bind the following keyboard shortcuts globally:

Super+2 – Tile last two windows side by side
Super+3 – Tile last three windows
Super+4 - two by two window tile
Super+h – move current window to the left half of the screen
Super+k - move current window to the right half of the screen

Please note, due to a bug, you might need to run azulejo.py twice the first time you use it.

Tiling windows on Gnome with wnck

Thursday, September 30th, 2010

After trying out a zillion linux  tilling tools, I came to the conclusion that none of them is quite what I want.  What I want is something like Winsplit Revolution. It offers powerful window management using the keyboard but does not stay on the way of those who still want to do stuff with their windows using a mouse like they always did.

I’ve been  playing around with wnck’s python bindings and it’s great fun. I managed to tile two windows side by side by running a small script. This is the most basic tiling operation and, in my opinion, it’s deadly useful.

(more…)

. .

Entries (RSS) and Comments (RSS).