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 python | |
# -*- coding: utf-8 -*- | |
import functools | |
import threading | |
import time | |
try: | |
# Python 3 | |
from queue import Queue |
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
Vagrant.configure("2") do |config| | |
(1..3).each do |i| | |
config.vm.define "node#{i}" do |node| | |
node.vm.hostname = "node#{i}.example.com" | |
node.vm.box = "bento/centos-7.2" | |
node.vm.network "private_network", ip: "192.168.33.1#{i}" | |
node.vm.provision :shell do |shell| | |
shell.path = "deploy.sh" | |
end |
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 python | |
# -*- coding: utf-8 -*- | |
from abc import ABCMeta | |
from abc import abstractmethod | |
from datetime import datetime | |
from threading import Thread | |
import threading | |
import time |
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 python | |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
import threading | |
import time | |
def spawn(function, *args, **kwargs): | |
thread = threading.Thread(target=function, args=args, kwargs=kwargs) |
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 python | |
# -*- coding: utf-8 -*- | |
import calendar | |
from datetime import datetime | |
from datetime import timedelta | |
_FIELD_NAMES = [ | |
'years', | |
'monthes', |
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 python | |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
SECOND = {'microsecond': 0} | |
MINUTE = dict({'second': 0}, **SECOND) | |
HOUR = dict({'minute': 0}, **MINUTE) | |
DAY = dict({'hour': 0}, **HOUR) | |
MONTH = dict({'day': 0}, **DAY) |
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 python | |
# -*- coding: utf-8 -*- | |
import importlib | |
import click | |
class ImportableType(click.ParamType): | |
''' Python のインポート可能なパスを受け取るための型 ''' |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.define :node1, primary: true do |node1| | |
node1.vm.box = "centos7" | |
node1.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
node1.vm.network "private_network", ip: "192.168.33.11" | |
node1.vm.provider "virtualbox" do |vb| |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.define :node1, primary: true do |node1| | |
node1.vm.box = "centos7" | |
node1.vm.box_url = "https://github.com/holms/vagrant-centos7-box/releases/download/7.1.1503.001/CentOS-7.1.1503-x86_64-netboot.box" | |
node1.vm.network "private_network", ip: "192.168.33.11" | |
node1.vm.provider "virtualbox" do |vb| |
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 python | |
# -*- coding: utf-8 -*- | |
''' | |
argparse の挙動が Python 2.x と Python 3.x で異なる件について | |
本家のチケット: http://bugs.python.org/issue16308 | |
''' | |
import argparse |