lamehacks

Stuff is fun

Backing up thepiratebay

April 15th, 2013

This is nothing new really, a perl script has been around for quite a while, but it’s too minimalist. I wrote a scala script to archive the contents of thepiratebay.se. Torrent info and categories included.

Download TPBCrawler.scala

Sites like thepiratebay or kickasstorrents index a huge amount of content. The debate about copyright issues misses the important point, which is preserving cultural material. Many torrents contain rare material that is virtually impossible to find anywhere else. The debate should focus first and foremost in ways of preserve such files, not on how to make them profitable when they loose their commercial value.

While this is, in the first place, a thing I wrote for fun, it does effectively prove that take down actions on torrents are absurd.

Disclaimer: I am not responsible for anything  you may eventually do with this. It is not my fault that  insanely stupid copyright laws exist in many countries.

View on flickriver userscript

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.

More processing.js fun

February 2nd, 2012

This time I wanted to try processing.js as a javascript library (object, to be strict) instead of writing a processing sketch. To be honest, this felt easier than referring to a new language. Also, there’s the advantage of all the available javascript debugging tools such as firebug.

This lame colorscheme generator was the result.

See it in action here
http://plainas.github.com/cubecolors

Building my own computer from scratch… kind of

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

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.
Read the rest of this entry »

How to fix Canon Powershot A590 IS battery issue

December 9th, 2011

I have mixed feelings about this camera, while it packed a great set of features for its price, the image quality was notoriously inferior to older A-series cameras such as the A60, A80,A80, etc.
But the big deal breaker was the battery issue. Most cameras would run out of battery (well, not quite, read bellow) after very few shots. This defect affected nearly every unit of this and similar models. So badly that canon pulled these cameras out of the market as quickly as possible. Read the rest of this entry »

Fun with processing – basic isometric selector

October 28th, 2011

Below is a simple (x,y,z) isometric selection I made with the sole purpose of trying out processing.
Read the rest of this entry »

Linear algebra in javascript

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.
Read the rest of this entry »

galleria for wordpress

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

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.

. .

Entries (RSS) and Comments (RSS).