This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Read an html file from a file like object, parse(possibly selective) it and give back the data to the callback for processing. | |
''' | |
import urllib2 | |
import re | |
import sys | |
from BeautifulSoup import BeautifulSoup | |
from BeautifulSoup import SoupStrainer | |
# Inline configs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
int equi(int a[], int n ) { | |
int i, j; | |
long int sum = 0; | |
int **sum_list = calloc(sizeof *sum_list, n); | |
assert(sum_list != NULL); | |
for (i = 0; i < n; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
double fib(int num) | |
{ | |
if (num <= 1) | |
return 1; | |
else | |
return fib(num-1) + fib(num-2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FibNum { | |
public static void main(String args[]) { | |
System.out.printf("%.0f\n", fib(Integer.parseInt(args[0]))); | |
} | |
public static double fib(int n) { | |
if (n <= 1) | |
return 1; | |
else | |
return fib(n-1) + fib(n-2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> gcc -o fib -O3 fib.c | |
$> time ./fib_num | |
165580141 | |
real 0m1.452s | |
user 0m1.448s | |
sys 0m0.000s | |
$> javac FibNum.java | |
$> time java -server FibNum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> gcc -o fib fib_num.c | |
$> time ./fib | |
165580141 | |
real 0m3.606s | |
user 0m3.604s | |
sys 0m0.000s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
# Lookup the calling object's properties. If not found, lookup for the key in | |
# base class. | |
sub dispatch { | |
my $props = shift; | |
my $key = shift; | |
return $props->{$key} || ($props->{'base'} && $props->{'base'}($key)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.*; | |
class Foo | |
{ | |
private int i = 10; | |
public int getI() { return i; } | |
} | |
class PrivateTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hello.java */ | |
public class Hello | |
{ | |
public static void main(String[] args) | |
{ | |
System.out.println("Hello World"); | |
} | |
} | |
/* Hello2.java */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct node | |
{ | |
int info; | |
struct node *next; | |
}; | |
int cycle(struct node *head) | |
{ | |
struct node *slow, *fast; |
OlderNewer