Skip to content

Instantly share code, notes, and snippets.

View shiracamus's full-sized avatar

@shiracamus shiracamus

View GitHub Profile
import random
import time
DEPOP = 1 # 過疎条件
OVERCROW = 4 # 過密条件
ALIVE_LOWER = 3 # 発生条件(下限)
ALIVE_UPPER = 3 # 発生条件(上限)
ETERNAL = False # セルの永続化フラグ
INITIALIZE_ALIVE_RATE = 20 # 初期セルの生存率(%)
import time
def sec_to_time(sec):
"""引数secの秒数を'HH:MM:SS'形式文字列に変換して返す"""
m, s = divmod(int(sec), 60)
h, m = divmod(m, 60)
return f'{h:02}h {m:02}m {s:02}s'
import time
from multiprocessing import Process, Pipe
from tkinter import Tk, ttk, StringVar
def execute():
"""
コマンド実行
"""
print('コマンドボタン 押下')
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1181&lang=ja
from collections import defaultdict
class Die:
TOP, FRONT, RIGHT, BACK, LEFT, BOTTOM = 0, 1, 2, 3, 4, 5
ROLL = {
TOP: (FRONT, RIGHT, BACK, LEFT),
FRONT: (TOP, FRONT, BOTTOM, BACK),
RIGHT: (TOP, RIGHT, BOTTOM, LEFT),
@shiracamus
shiracamus / docker-compose.nextcamp.yml
Last active October 18, 2020 08:36
WebGME MIC docker-compose YAML for Security Next Camp 2020 in Japan
# To build and launch (first time):
# $ docker-compose up -d
# To create new images (--no-cache) to force building from scratch:
# $ docker-compose build
# To launch again (leave out -d for non daemon launch):
# $ docker-compose up -d
# Short command for rebuilding and restarting
# $ docker-compose up -d --build
# To stop containers:
# $ docker-compose stop
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.function.Consumer;
import java.awt.Component;
import java.awt.CardLayout;
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
import java.awt.Rectangle;
import javax.swing.*;
import sys
import csv
from time import sleep
import requests
from bs4 import BeautifulSoup
def main():
genre = 'tonkatsu' if len(sys.argv) < 2 else sys.argv[1]
save_csv(f'{genre}.csv', shops(genre),
enum Cell { WALL, ROAD };
class Map {
public final int width;
public final int height;
private final Cell[][] cells;
public Map(int width, int height) {
if (width < 5 || height < 5 || width % 2 == 0 || height % 2 == 0) {
new IllegalArgumentException("縦・横共に5以上の奇数で作成してください。");
import java.awt.*;
import javax.swing.*;
class Life {
private static final String DEAD = "0";
private static final String ALIVE = "1";
private String state = DEAD;
public void dead() { state = DEAD; }
public void alive() { state = ALIVE; }