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 | |
# ε-Greedy base multi-armed bandit | |
import random | |
slotmachine_rate = [3, 5, 10, 20, 16, 15, 21, 22, 6] | |
score_map = [[0.0, 0] for i in xrange(len(slotmachine_rate))] | |
search_rate = 0.1 |
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 multiprocessing | |
import traceback | |
import random | |
import time | |
import sys | |
def random_error_func(x): | |
n = random.random() |
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
days, input_load, worker_stacks, total_stacks, output, ave_lead_time | |
case 100% input 1...6 | |
0 2 [2, 0, 0, 0, 0] 2 0 5 | |
1 5 [5, 2, 0, 0, 0] 7 0 6 | |
2 2 [2, 5, 2, 0, 0] 9 0 6 | |
3 3 [3, 5, 2, 2, 0] 12 0 6 | |
4 3 [3, 4, 4, 2, 2] 15 0 7 | |
5 6 [6, 3, 4, 5, 1] 19 2 8 | |
6 1 [4, 3, 6, 1, 5] 19 1 8 | |
7 4 [4, 4, 3, 6, 2] 19 4 8 |
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 urllib | |
import json | |
import datetime | |
import os | |
import time | |
# http://www.kbremner.com/2014/03/15/kickstarter-part1.html | |
# https://github.com/markolson/kickscraper/wiki/Project |
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
def uniq_two(item_prices, max_price): | |
bucket = {} | |
for price in item_prices: | |
if price > max_price: | |
continue | |
if price not in bucket : | |
bucket[price] = 0 | |
bucket[price] += 1 | |
result = [] |
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 | |
#python 2.7 | |
class island_count: | |
def __init__(self, pattern = None): | |
self.pattern = None | |
if pattern: | |
self.load(pattern) |
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=World=None | |
print dir()[len([])], dir()[len([None])] |
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 random | |
def amida_shuffle(line_num, exchange_num): | |
lines = range(line_num) | |
for i in xrange(exchange_num): | |
p = random.randrange(line_num - 1) | |
lines[p], lines[p+1] = lines[p+1], lines[p] | |
return lines |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Security.Cryptography; | |
using System.Diagnostics; | |
namespace ConsoleApplication1 |
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 urllib | |
import BeautifulSoup | |
import urlparse | |
import time | |
def main(): | |
urlList = open("seed.txt","r").read().splitlines() | |
allowDomainList = set(open("allowDomain.txt","r").read().splitlines()) |