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 Range: | |
def __init__(self,stop,start=0): | |
self.start=start | |
self.stop=stop | |
def __iter__(self): | |
return self | |
def __next__(self): | |
if self.start > self.stop-1: | |
raise StopIteration | |
n=self.start |
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 queue: | |
def __init__(self, capacity = 10): | |
''' | |
capacity 队列大小 | |
''' | |
self.capacity = capacity | |
self.size = 0 | |
self.front = 0 | |
self.rear = 0 | |
self.array = [0]*capacity |
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 | |
# 接口隔离原则 | |
# 也就是多继承 | |
class LandAnimal(metaclass=ABCMeta): | |
@abstractmethod | |
def walk(self): | |
pass | |
class SkyAnimal(metaclass=ABCMeta): | |
@abstractmethod |
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 | |
# USE ROOT RUN | |
# install some tools | |
sudo yum install -y wget | |
# use aliyun | |
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo | |
sudo yum install -y kernel-headers |
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 | |
# USE ROOT RUN | |
yum install -y perl gcc kernel-devel | |
# install | |
blkid | |
mkdir /mnt/cdrom | |
mount -t iso9660 /dev/cdrom /mnt/cdrom/ |
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 | |
# USE ROOT RUN | |
# install gitlab runner | |
sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 | |
sudo chmod +x /usr/local/bin/gitlab-runner | |
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash | |
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner | |
# add gitlab-runner to docker group | |
sudo gpasswd -a gitlab-runner docker |
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
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse |