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 string | |
from copy import deepcopy | |
from random import shuffle | |
PENTO = 5 | |
_ = None | |
# O to Z | |
piece_labels = string.ascii_uppercase[-12:] |
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
from copy import copy | |
coin_kind = [1, 5, 10, 50, 100, 500] | |
def minimal_coin_set(value): | |
# greedy algorithm | |
ret = {} | |
for coin in sorted(coin_kind, reverse=True): | |
ret[coin] = value // coin | |
value %= coin |
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
class SshClient { | |
SshClient(String user, String host, int port, int timeout) { | |
// ... | |
} | |
SshClient(String user, String host) { | |
this(user, host, 22, 60); | |
} | |
SshClient(String user, String host, int port) { |
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/env python3 | |
""" | |
Git interface to difflib.py | |
""" | |
import sys | |
import os | |
import time | |
import difflib | |
import re |
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/env python3 | |
from copy import deepcopy | |
from enum import Enum | |
from random import shuffle | |
class Simbol(Enum): | |
empty = 0 | |
maru = 1 | |
batu = 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
#!/usr/bin/env python3 | |
""" | |
KdV equation solver | |
""" | |
from numpy import pi, cos, linspace, arange | |
from numpy.fft import rfft, irfft | |
# Constant in Zabusky & Kruskal (1965) |
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 | |
# | |
# Create a rootfs environment for chroot building. | |
# | |
# Requires | |
# - OS installing CDROM at the current directory, | |
# - the root authority. | |
# | |
# mount install cd |
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
""" | |
A simple Paxos implementation for study. | |
""" | |
from collections import Counter | |
class Proposer: | |
def __init__(self, acceptors): | |
self.acceptors = acceptors |
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
// Configurations of Visual Studio Code. | |
{ | |
//-------- Editor configuration -------- | |
// Controls the font family. | |
"editor.fontFamily": "源ノ角ゴシック Code JP", | |
// Controls the font size. | |
"editor.fontSize": 12, |
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
from sys import argv | |
from math import sqrt, pi, tan, atan2 | |
def mandelbrot(r, i): | |
limit = 256 | |
threshold = 1e10 | |
zr = 0.0 | |
zi = 0.0 | |
for n in range(limit): |
NewerOlder