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
package main | |
import "fmt" | |
var visited = map[string]bool { | |
} | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
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> | |
inline int fibonacci(n, x1, x2) { | |
if (n == 0) { | |
return x1; | |
} | |
return fibonacci(n - 1, x2, x1 + x2); | |
} | |
int main() { |
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
package main | |
import "fmt" | |
import "code.google.com/p/go-tour/tree" | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { | |
_walk(t, ch) | |
close(ch) |
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
package main | |
import "fmt" | |
type ErrNegativeSqrt float64 | |
func (e ErrNegativeSqrt) Error() string { | |
return fmt.Sprintf("cannot Sqrt negative number: %v", float64(e)) | |
} |
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
package main | |
import "fmt" | |
import "math/cmplx" | |
func Cbrt(x complex128) complex128 { | |
z := x / 4 | |
for i := 0; i < 10; i++ { | |
z = z - (cmplx.Pow(z, 3) - x) / (3 * z * z) | |
} |
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
# -*- coding: utf-8 -*- | |
import os | |
import time | |
from sh import xte | |
CACHE_FILE = "/tmp/zeray.cache" | |
SINGLE_OFFSET = 16 | |
class Xte(object): |
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
#!/bin/sh | |
# (c) Eduard Bloch <[email protected]>, Gregory Colpart <[email protected]> | |
# LICENSE: GPL | |
# Purpose: initial PPPoE configuration on Debian | |
# Depends: ppp, whiptail, gettext, sed | |
export TEXTDOMAINDIR="/usr/share/locale" | |
export TEXTDOMAIN=pppoeconf | |
export OPTSFILE="/etc/ppp/peers/dsl-provider" | |
export REALINTFILE="/etc/network/interfaces" |
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 <cstdlib> | |
#include <cstring> | |
#include <cstdio> | |
#define fin stdin | |
#define fout stdout | |
#define MAX_CARD 102 | |
#define MAX_WEIGHT 100002 | |
int n; | |
int weight; |
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 <cstdlib> | |
#include <cstring> | |
#include <cstdio> | |
#define MAX_ITEM 62 | |
#define MAX_MONEY 32002 | |
int n; | |
int money; | |
int cost[MAX_ITEM]; | |
int value[MAX_ITEM]; |
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 <cstdlib> | |
#include <cstring> | |
#include <cstdio> | |
#define MAX_CASTLE 102 | |
#define MAX_HEIGHT 10002 | |
#define fin stdin | |
#define fout stdout | |
int n; | |
int min_height = 0x7FFFFFFF; |