Archive

Archive for November, 2012

How to download an entire website for off-line reading?

November 30, 2012 Leave a comment

Problem

You want to download an entire website (e.g. a blog) for offline reading.

Solution

wget --mirror -p --convert-links -P ./LOCAL-DIR WEBSITE-URL

Tip from here.

Categories: bash Tags: , , ,

Free Online Clocks for Your Website or Blog

November 28, 2012 Leave a comment

http://24timezones.com/online_clock.php

Customize the clock, copy the generated code and paste it in your website or blog.

Categories: Uncategorized Tags: ,

Binary representation of an int in C

November 27, 2012 Leave a comment

Problem

You want to visualize the binary representation of an int in C.

Solution

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

char * int2bin(int i)
{
    size_t bits = sizeof(int) * CHAR_BIT;

    char * str = malloc(bits + 1);
    if(!str) return NULL;
    str[bits] = 0;

    // type punning because signed shift is implementation-defined
    unsigned u = *(unsigned *)&i;
    for(; bits--; u >>= 1)
        str[bits] = u & 1 ? '1' : '0';

    return str;
}

int main()
{
    printf("%s\n", int2bin(0x3d));
    printf("%s\n", int2bin(-0x3d));

    return 0;
}

Output:

00000000000000000000000000111101
11111111111111111111111111000011

In the case of the negative number you can nicely see the two’s complement of the positive number.

I found the C source here.

Play Youtube videos with VLC

November 27, 2012 1 comment

Did you know that VLC media player can play Youtube videos? Neither did I. Try this:

vlc http://www.youtube.com/watch?v=Dmn4gtZWVzw

Does Flash break all the time? Use VLC :)

Tip from here.

Categories: Uncategorized Tags: , ,

Update your Nvidia driver to 310.19

November 20, 2012 Leave a comment

Here is how to do that.

In short:

sudo add-apt-repository ppa:xorg-edgers/ppa 
sudo apt-get update 
sudo apt-get install nvidia-current nvidia-settings

Then restart.

Categories: ubuntu Tags: , , ,

Youtube audio player

November 20, 2012 Leave a comment

At http://www.labnol.org/internet/youtube-audio-player/26740/ I found a nice trick to embed just a part of the Youtube Flash player, thus the player looks like an audio player. All you need is a little CSS trick:

Categories: firefox, google, html Tags: , , ,

Locate big emails in Gmail

November 16, 2012 2 comments

Gmail supports an undocumented ‘size’ search operator that will let you quickly find all the big emails in the mailbox whose size exceeds a particular threshold. The search syntax is:

size:[size in bytes]

To give a real example, a Gmail search query like ‘size:5242880′ will list all big emails whose size is 5 MB or greater while ‘size:10485760′ list messages that are bigger than 10 MB.

From here.

Categories: google Tags: , ,

RIP — a Firefox add-on to remove some parts of an HTML page

November 14, 2012 Leave a comment

Problem
On a webpage, that you frequently visit, there is an HTML element that bugs you all the time. How to get rid of that shit?

Solution
Here is the cure: Remove It Permanently.

Usage: right click on the HTML element you want to kill and choose “Remove this permanently” from the context menu. There is also a “RIP Advanced” menu point for fine tuning.

Categories: firefox Tags: ,

My blog was suspended for 7 hours

November 11, 2012 Leave a comment

Yesterday I made a new post in which I put a link on a forum. After pressing the “Publish” button, my blog got suspended immediately. I sent a mail to wordpress and they kindly replied to me and re-activated my blog. It turned out that the site hosting the forum is on a blacklist at wordpress. So I removed the problematic post. I was afraid that I lose my blog but fortunately I got it back.

Categories: wordpress Tags: ,

Listen to Pandora Radio — the painless way

November 10, 2012 Leave a comment

Problem
You want to listen to Pandora Radio outside of the USA.

Solution
There is a Firefox add-on that uses a US proxy for Pandora. The proxy is only used with Pandora, Hulu, and Netflix.

Links

Categories: firefox Tags: , , ,
Follow

Get every new post delivered to your Inbox.

Join 61 other followers