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: , ,
Follow

Get every new post delivered to your Inbox.

Join 73 other followers