Skip to content

Instantly share code, notes, and snippets.

View maximveksler's full-sized avatar
Wow

Maxim Veksler maximveksler

Wow
  • Tel Aviv, Israel
  • 16:24 (UTC +03:00)
  • X @mvxlr
View GitHub Profile
public AbstractStringBuilder append(boolean b) {
if (b) {
ensureCapacityInternal(count + 4);
value[count++] = 't';
value[count++] = 'r';
value[count++] = 'u';
value[count++] = 'e';
} else {
ensureCapacityInternal(count + 5);
value[count++] = 'f';
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
#!/usr/bin/python
import sys
import mmap
import os
if (len(sys.argv) > 1):
STAT_FILE=sys.argv[1]
print STAT_FILE
else:
"""
Empirical proof for Khan Academy birthday problem http://www.khanacademy.org/video/birthday-probability-problem
I still don't understand why the calculation is using permutations so I decided to verify it is correct.
I too was having trouble convincing myself that this is the correct answer, so I wrote a python program that would randomly build a class of 30 students and check if some have colliding birth days.
What the code does is building this 30 people class again and again and then calculating in how many of the classes 2 or more students has the same birth day.
The final probability calculation is: <People with colliding birth days> / <Total number of sampled classes>
@maximveksler
maximveksler / .classpath
Created February 16, 2011 08:57
Trying to debug the problems with my code and ThreadSafeClientConnManager
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>