Commands to create When you say nothing at all - Pragyan Patnaik:

ffmpeg -ab 128k -s 640x480 -f image2 -r .1 -b 180000 -i pragyan%d.jpg -i
pragyan.mp3 pragyan.mpg
Commands to create Diwali 2010 with Rinku and Madhusmita:
# Select the slices

# 0:14 - 0:54 (40) # 2:20 - 2:40 (20) ffmpeg -sameq -ss 00:00:14 -t 40 -i DSCN0087.AVI cut1.mpg ffmpeg -sameq -ss 00:02:20 -t 20 -i DSCN0087.AVI cut2.mpg

# 0:02 - 0:25 (23) ffmpeg -sameq -ss 00:00:02 -t 23 -i DSCN0092.AVI cut3.mpg

# 0:01 - 0:46 (45) ffmpeg -sameq -ss 00:00:01 -t 46 -i DSCN0095.AVI cut4.mpg

# 0:10 - 0:34 (24) ffmpeg -sameq -ss 00:00:10 -t 24 -i DSCN0097.AVI cut5.mpg

# 1:28 - 1:58 (30) ffmpeg -sameq -ss 00:01:28 -t 30 -i DSCN0098.AVI cut6.mpg

# 0:00 - 1:17 (67) ffmpeg -sameq -ss 00:00:00 -t 77 -i DSCN0101.AVI cut7.mpg

# Join the slices cat *.mpg | ffmpeg -f mpeg -i - -vcodec copy -acodec copy diwali-2010.mpg

C code:

#include <stdio.h>
#include <math.h>

/* Prints the n-th fraction in Cantor's enumeration. */ void print_fraction(int n) { int d = (-1 + sqrt(1 + 8 * n)) / 2; /* Diagonals to skip */ int e = n - d * (d + 1) / 2; /* Extra steps after the skip. */ int v1 = e <= 1 ? d + e : d + 2 - e; int v2 = e <= 1 ? 1 : e;

printf("%d / %d\n", d % 2 == 0 ? v1 : v2, d % 2 == 0 ? v2 : v1); }

int main() { size_t i; for (i = 1; i < 20; i++) { print_fraction(i); } }

Output:
1 / 1
1 / 2
2 / 1
3 / 1
2 / 2
1 / 3
1 / 4
2 / 3
3 / 2
4 / 1
5 / 1
4 / 2
3 / 3
2 / 4
1 / 5
1 / 6
2 / 5
3 / 4
4 / 3

Some notes from Chapter 1, Our Picture of the Universe of A Brief History of Time by Stephen Hawking.

As long ago as 340 B.C. the Greek philosopher Aristotle, in his book On the Heavens, was able to put forward two good arguments for believing that the earth was a round sphere rather than a flat plate.
First, he realized that eclipses of the moon were caused by the earth coming between the sun and the moon. The earth's shadow on the moon was always round, which would be true only if the earth was spherical.
Second, the Greeks knew from their travels that the North Star appeared lower in the sky when viewed in the south than it did in more northerly regions.

Solution to a problem asked by Rohan at RSA.

Prove that for every positive integer n there exists an n-digit number divisible by 5n all of whose digits are odd.
Before we proceed let us keep a note of a little thing we'll need.

1 ≡ -4 (mod 5) 3 ≡ -2 (mod 5) 5 ≡ 0 (mod 5) 7 ≡ -3 (mod 5) 9 ≡ -1 (mod 5)

So, the set {1, 3, 5, 7, 9} covers all possible values in mod 5 arithmetic. Now, let us begin the proof.

The statement is clearly true for n = 1 as there exists 5 which is a 1-digit number divisibile by 51 and all its digits are odd.

Let us assume that the statement is true for n = N where N is a positive integer. So, there exists an integer m which is N-digit, divisible by 5N and all its digits are odd.

Now, we will show that for n = N + 1, there exists an integer k10N + m divisible by 5N+1 where k ∈ {1, 3, 5, 7, 9};

k10N + m ≡ 0 (mod 5N+1)

⇔ 5N(k2N + m5N) ≡ 0 (mod 5N+1)

⇔ k2N + m5N ≡ 0 (mod 5)

⇔ k6N + m5N ⋅ 3N ≡ 0 (mod 5)

⇔ k ≡ -m5N ⋅ 3N (mod 5)

⇔ k ∈ {1, 3, 5, 7, 9} … (from the note in the beginning)

So, we have shown that for some odd digit k, we have a number k10N + m divisible by 5N+1. Also, note that this number is an N+1 digit number because m was an N digit number.

Hence, from the principle of mathematical induction, the proof is complete for all positive integers n.

We can use this proof to generate the n-digit numbers for all values of n.

1-digit number: 5 2-digit number: 75 since k = -551 ⋅ 31 mod 5 = -3 mod 5 = 7. 3-digit number: 375 since k = -7552 ⋅ 32 mod 5 = -2 mod 5 = 3. 4-digit number: 9375 since k = -37553 ⋅ 33 mod 5 = -1 mod 5 = 9. and so on …

OEIS entry for this sequence: A151752

I wanted big-endian emulation on my little-endian Intel machine to test a program for byte order related issues. QEMU PowerPC emulator seemed like a good solution. I have documented the steps to set it up in this note.

  1. Installed QEMU.
    nifty:~# aptitude update &&
    aptitude install qemu
    
  2. Downloaded Mac-on-Linux from http://sourceforge.net/projects/mac-on-linux/files/ and copied the 'video.x' file in the download to '/usr/share/qemu'. This was necessary to prevent qemu-system-ppc from complaining about it.
    nifty:~# tar -xjf
    mol-0.9.72.1.tar.bz2
    nifty:~# cp mol-0.9.72.1/mollib/drivers/video.x
    /usr/share/qemu
  3. Downloaded Debian for PowerPC and installed it on a QEMU hard disk image.
    susam@nifty:~/qemu\$ wget
    --no-verbose
    http://cdimage.debian.org/debian-cd/5.0.4/powerpc/iso-cd/debian-504-powerpc-CD-1.iso
    2010-06-19 02:55:06
    URL:http://caesar.acc.umu.se/debian-cd/5.0.4/powerpc/iso-cd/debian-504-powerpc-CD-1.iso[675569664/675569664]
    -> "debian-504-powerpc-CD-1.iso" [1]
    susam@nifty:~/qemu\$ qemu-img create powerpc.img
    2G
    Formatting 'powerpc.img', fmt=raw size=2147483648
    susam@nifty:~/qemu\$ qemu-system-ppc -hda
    powerpc.img -cdrom debian-504-powerpc-CD-1.iso -boot d -m 512
    
  4. Booted the QEMU PowerPC emulator with the hard disk image.
    susam@nifty:~/qemu\$ qemu-system-ppc -hda powerpc.img -m 512
    
  5. Verified that I was really on a big endian system by writing a simple C program.
    susam@lilliput:~\$ cat
    endian.c
    #include <stdio.h>
    

    int main() { int n = 0x1; printf(*((char *) &n) ? "little-endian\n" : "big-endian\n"); return 0; } susam@lilliput:~\$ gcc endian.c && ./a.out big-endian susam@lilliput:~\$

In case you missed the pun, Lilliputians were originally big-endians.

RSS