Wednesday, November 30, 2011

Recursively chmod directories or files only

Find finds stuff and can be made to do, horrible, stuff to the things it finds.
Like this:
find . -type d -exec chmod 755 {} \;
or like this:
find . -type f -exec chmod 664 {} \;
. is the path, the current directory in this example.
-type d - find directories only.
Similarly -type f would find files only.
{} gets replaced with the current found dir/file.
\; simply marks the end of the -exec part.

Source

Thursday, November 17, 2011

Get document height with javascript

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
alert(getDocHeight());
Yay!

Wednesday, November 16, 2011

Firefox - My userChrome.css

Just wanted to get it up here for preservations sake.

This is for (very) personal use and I have made no attempts to get it working with any other setup (addons, toolbar-layout and such) than my own.

Will probably get a screenshot, some day, until then... tada!

Update: Yup.


Saturday, November 12, 2011

Fix the new google reader layout - take 2

As google continues on their quest to completely make google reader unusable they've changed som css around so my previous Stylish-style doesn't work anymore.

I've made a new one though. :)

Thursday, November 03, 2011

Fix the new google reader layout

The new layout on google reader is really, reeeally boring. I don't like it.
Below is my fix in the form of a bit of css for use with the Stylish addon. It gets rid of the strange 3x-border-crap and replaces it with a red 5px redish border on the left side of the current story. It also changes the link color to a blueish one to make them stand out a bit more. There is a bit of whitespace left in the layout but a lot less than before.

I like it but ymmv with taste being subjective and all. :)

Wednesday, November 02, 2011

Repackage (backup) installed debian packages

These commands let you backup one or all of your installed packages.

To backup one installed package
dpkg-repack xbmc
or all of them at once
dpkg-repack `dpkg --get-selections | grep install | cut -f1`
Both these commands will create .deb-packages in the directory you're currently in.

If you want to install one of the packages
dpkg -i package_name.deb
or all of them at once
dpkg -i *.deb

Very handy.

Tuesday, November 01, 2011

Photo - Suspicious animal is suspicious


Suspicious animal is suspicious.

Creating a table with dates, weeks and days

Call me crazy but I prefer having all dates, days and weeks in one table to use in queries. This little loop gives me exactly that. It'll insert date, year, week, day-of-week, day-of-year, yyyy-ww and yymm, into the table ALM.