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 random | |
import pylab | |
import numpy | |
#print random.randint(1, 6) | |
dist = {} |
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/python | |
# -*- coding=utf8 -*- | |
import unittest | |
import myvm | |
class TestBasicsVM(unittest.TestCase): | |
def setUp(self): | |
self.vm = myvm.VM(16*1024, 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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
type Suit rune | |
const ( | |
AnySuit Suit = iota |
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/python | |
import glob | |
import os | |
import sys | |
ext = sys.argv[1] | |
print ext | |
for f in glob.glob("Track ?." + ext): |
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 subprocess | |
import os | |
import os.path | |
def nullaction(src, dst): | |
print "%s => %s"%(src, dst) | |
def exists(path): | |
try: |
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 random | |
import matplotlib.pyplot as plt | |
SIZE = 30 | |
PARTICLE = 10000 | |
bag = {} | |
for i in range(PARTICLE): | |
x = random.randint(0, SIZE - 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
クロスワードにおける文字出現頻度. | |
使った辞書は豚辞書(第12版) | |
ぢ : 147 | |
ぺ : 991 | |
を : 1211 | |
ぴ : 1216 | |
ぬ : 1481 | |
づ : 1544 | |
ぽ : 1569 |
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
(defn fib [n] | |
(cond | |
(= n 0) 1 | |
(= n 1) 2 | |
else (+ (fib (- n 1)) (fib (- n 2))))) | |
(defn fibs [n] | |
(loop [a 1 b 2 i 0 xs '()] | |
(begin |
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
(fold1 add 0 (filter (fn [n] (or (= (mod n 5) 0) (= (mod n 3) 0))) (. broom SeqRange 0 1000 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
;; 動作は https://github.com/bgnori/broom/commit/95e2532c0111aa2130171bdb6b09ec151466f087 で確認 | |
(def now (. time Now)) | |
(def a-day (* 24 (. time Hour))) | |
(def delta (* (- 1 (. now Day)) a-day)) | |
(def first-day (. now Add delta)) | |
(def m (. now Month)) | |
(println (. now Year) m) |