Skip to content

Instantly share code, notes, and snippets.

@border
border / MyBot.py
Created November 10, 2011 14:48
A ants bot for AIChallenge
#!/usr/bin/env python
from ants import *
# define a class with a do_turn method
# the Ants.run method will parse and update bot input
# it will also run the do_turn method for us
class MyBot:
def __init__(self):
# define class level variables, will be remembered between turns
pass
@border
border / ants.go
Created November 11, 2011 05:29
A ants bot for AIChallenge By Golang
package main
import (
"os"
"rand"
)
type MyBot struct {
orders map[Location]Location
}
@border
border / stock5Min.c
Created January 8, 2012 15:15
通达信股票天和5分钟数据格式分析, 参考: http://alantop.5166.info/gpdatasoft/gpformat/gpformat.htm
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
struct stock5Min
{
unsigned short monthDay; // 月日
unsigned short hourMin; // 小时, 分钟
@border
border / youtube.go
Created March 11, 2012 15:53
Youtube subtitle and download URL
package main
import (
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strings"
)
@border
border / googlesearch.go
Created August 27, 2012 07:56
Go talks io12: Go Concurrency Patterns
package main
import (
"fmt"
"math/rand"
"time"
)
var (
Web = fakeSearch("web")
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@border
border / log.go
Created August 30, 2012 10:04
Log Example For Go
package utils
import (
"log"
"os"
)
var (
Log *log.Logger
)
@border
border / tail.go
Created August 31, 2012 02:34
tail by go
package main
import (
"bufio"
"flag"
"os"
"time"
)
var (
@border
border / goauth2-example.go
Created September 1, 2012 16:32
Google goauth2 example
package main
import (
"code.google.com/p/goauth2/oauth"
"crypto/tls"
"io/ioutil"
"log"
"net/http"
"text/template"
)
@border
border / sina.go
Created September 3, 2012 07:06
goauth2 for sina weibo
// Copyright 2012 Jiang Bian ([email protected]). All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Email: [email protected]
// Blog: http://wifihack.net/
// Sina WeiBo oauth2 Login, Base on goauth2 lib
package main