├── LICENSE ├── PS1.md ├── README.md ├── dockerfiles ├── QingCloudSDK │ └── Dockerfile ├── androidautobuild │ ├── Dockerfile │ └── sources.list ├── dmonit │ ├── Dockerfile │ └── Makefile ├── mitmproxy │ ├── Dockerfile │ ├── Readme.md │ └── sources.list ├── postgres │ └── Dockerfile └── smb │ └── Dockerfile ├── docs ├── Pictures │ ├── background.pdf │ ├── chapter_head_1.pdf │ ├── chapter_head_2.pdf │ └── placeholder.jpg ├── StyleInd.ist ├── bibliography.bib ├── compile.bat ├── main.aux ├── main.bbl ├── main.bcf ├── main.blg ├── main.idx ├── main.ilg ├── main.ind ├── main.log ├── main.out ├── main.pdf ├── main.ptc ├── main.run.xml ├── main.tex ├── main.toc └── structure.tex ├── dotfile ├── .bashrc ├── .tmux.conf ├── .vimrc └── coc-settings.json ├── gh60.c ├── golangdev └── Dockerfile ├── mesos ├── docker-systemd │ ├── docker.service │ ├── system-docker.service │ └── system-docker.socket ├── master.sh ├── mesos-flannel-slave.sh ├── mesos-flannel.sh ├── mesos-systemd │ ├── multinode │ │ ├── gen.py │ │ ├── master.sh │ │ └── slave.sh │ └── singlenode │ │ ├── localinstall.sh │ │ └── netinstall.sh ├── repush.sh └── slave.sh ├── note ├── 779MGO设计调优.md ├── 788MongoDB存储过程性能调优.md ├── 790heredocJS多行字符串.md ├── AboutRancherOS.md ├── AndroidAutoBuild.md ├── DatatablesNote.md ├── GitMultRemote.md ├── GolangWebManual.md ├── HTMLinsertBefore.md ├── HomeBrew.md ├── MacAchieveEncoding.md ├── MetaRemap.md ├── MyPHPEnv.md ├── PHPExtensionWindows.md ├── PythonEscape.md ├── RHELAddLocalRepo.md ├── Readme.md ├── SetMysqlPassword.md ├── SetPasswordMongo.md ├── SublimeLicense.md ├── ToolBoxConfig.md ├── VirtualboxTray.md ├── WgetJdk.md ├── aboutGIT.md ├── baiduyunLocateError.md ├── bootstrap弹出插件.md ├── brewMysqlInstallLog.md ├── butterFly_termial.md ├── dockerChangeStoragePosition.md ├── dockerPostgresql.md ├── dockerReg.md ├── dockerRegV2.md ├── etcd.md ├── golangProjectOnIdea.md ├── golangUnitTest.md ├── golang中的坑.md ├── iterm2的坑.md ├── jsDownloadFile.md ├── json.toolunicodeescape.md ├── killall.md ├── liteIDE改装.md ├── mongodbUse_id.md ├── puttySmallKeyboard.md ├── puttyblue.md ├── pythonSimpleHTTPSERVER.md ├── saveGitPassword.md ├── ubuntuChangeRepo.sh ├── viEscpaeDelays.md ├── 取消sshPublicKeyKnowHost认证.md └── 科大lugDNS.md ├── picture ├── MacTheme │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ └── 4 (4).jpg ├── lwqq │ ├── l1.jpg │ ├── l2.jpg │ ├── l3.jpg │ ├── l4.jpg │ ├── l5.jpg │ ├── l6.jpg │ └── l7.jpg ├── pprof.svg └── wqq │ ├── w1.png │ ├── w2.png │ ├── w3.png │ ├── w4.png │ ├── w5.png │ ├── w6.png │ ├── w7.png │ └── w8.png ├── prob ├── LFS journey.md ├── LinuxHeaderInstall.md ├── Linux分区.md ├── Linux虚拟机网络配置.md ├── MacTheme.md ├── PHP-RSA加密跨域通讯实战.md ├── PHPweb开发学习路线.md ├── qqOnLinux.md └── test.py ├── pythondev ├── .vimrc └── Dockerfile ├── rsakey ├── id_rsa.pub ├── id_rsa.zip └── ppk.zip ├── script ├── caidanhezidev ├── cleandocker ├── db.sh ├── e ├── env.sh ├── freem ├── k └── xdev └── st2 ├── Dockerfile ├── docker-entrypoint.sh ├── st2.conf ├── st2ctl └── supervisord.conf /PS1.md: -------------------------------------------------------------------------------- 1 | PS1="\[\033[32m\]\w\[\033[0m\]\n[\[\e[32m\]#\##\[\e[31m\]\u@\[\e[36m\]\h]\$\[\e[m\] " 2 | 3 | 多行的,第一行显示路径 4 | 5 | 6 | PS1="[\[\e[32m\]#\##\[\e[31m\]\u@\[\e[36m\]\h \w]\$\[\e[m\]" 7 | 单行的 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Linux 问题解决 2 | ========== 3 | 4 | 分享我的问题解决经验,开放我的环境,欢迎Fork 5 | 6 | LUKE! 7 | -------------------------------------------------------------------------------- /dockerfiles/QingCloudSDK/Dockerfile: -------------------------------------------------------------------------------- 1 | from python:2 2 | RUN ingcloud-sdk 3 | CMD /bin/bash 4 | -------------------------------------------------------------------------------- /dockerfiles/androidautobuild/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | MAINTAINER lijianying12@gmail.com 4 | 5 | RUN apt-get update && apt-get install -y sudo unzip openjdk-8-jdk gcc-multilib lib32z1 lib32stdc++6 git wget && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 6 | 7 | ENV ANDROID_HOME /opt/android-sdk-linux/ 8 | ENV ANDROID_SDK_FILENAME sdk-tools-linux-4333796.zip 9 | ENV ANDROID_SDK_URL https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME} 10 | ENV PATH ${PATH}:${ANDROID_HOME}/tools:${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${JAVA_HOME}/bin/ 11 | 12 | RUN mkdir -p ${ANDROID_HOME} && \ 13 | cd ${ANDROID_HOME} && \ 14 | wget -q ${ANDROID_SDK_URL} && \ 15 | unzip ${ANDROID_SDK_FILENAME} && \ 16 | rm ${ANDROID_SDK_FILENAME} &&\ 17 | echo y | sdkmanager "build-tools;26.0.0" \ 18 | "build-tools;26.0.1" \ 19 | "build-tools;26.0.2" \ 20 | "build-tools;26.0.3" \ 21 | "build-tools;27.0.0" \ 22 | "build-tools;27.0.1" \ 23 | "build-tools;27.0.2" \ 24 | "build-tools;27.0.3" \ 25 | "build-tools;28.0.0" \ 26 | "build-tools;28.0.1" \ 27 | "build-tools;28.0.2" \ 28 | "build-tools;28.0.3" \ 29 | "build-tools;29.0.0" \ 30 | "build-tools;29.0.1" \ 31 | "cmake;3.10.2.4988404" \ 32 | "cmake;3.6.4111459" \ 33 | "extras;android;gapid;1" \ 34 | "extras;android;gapid;3" \ 35 | "extras;android;m2repository" \ 36 | "extras;google;auto" \ 37 | "extras;google;google_play_services" \ 38 | "extras;google;instantapps" \ 39 | "extras;google;m2repository" \ 40 | "extras;google;market_apk_expansion" \ 41 | "extras;google;market_licensing" \ 42 | "extras;google;simulators" \ 43 | "extras;google;webdriver" \ 44 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0" \ 45 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4" \ 46 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha8" \ 47 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1" \ 48 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2" \ 49 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3" \ 50 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4" \ 51 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5" \ 52 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" \ 53 | "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" \ 54 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0" \ 55 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4" \ 56 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8" \ 57 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1" \ 58 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2" \ 59 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3" \ 60 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4" \ 61 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5" \ 62 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" \ 63 | "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \ 64 | "lldb;2.0" \ 65 | "lldb;2.1" \ 66 | "lldb;2.2" \ 67 | "lldb;2.3" \ 68 | "lldb;3.0" \ 69 | "lldb;3.1" \ 70 | "ndk-bundle" \ 71 | "ndk;20.0.5594570" \ 72 | "patcher;v4" \ 73 | "platform-tools" \ 74 | "platforms;android-26" \ 75 | "platforms;android-27" \ 76 | "platforms;android-28" \ 77 | "platforms;android-29" \ 78 | "tools" 79 | 80 | ENV PATH ${PATH}:/opt/gradle/gradle-current/bin/ 81 | RUN mkdir -p /opt/gradle && cd /opt/gradle && wget http://127.0.0.1:8000/gradle-4.8.1-bin.zip && wget http://127.0.0.1:8000/gradle-4.9-bin.zip && wget http://127.0.0.1:8000/gradle-5.5.1-bin.zip && unzip gradle-4.8.1-bin.zip &&\ 82 | unzip gradle-4.9-bin.zip &&\ 83 | unzip gradle-5.5.1-bin.zip &&\ 84 | rm *.zip 85 | -------------------------------------------------------------------------------- /dockerfiles/androidautobuild/sources.list: -------------------------------------------------------------------------------- 1 | # 2 | 3 | # deb cdrom:[Ubuntu-Server 14.04.2 LTS _Trusty Tahr_ - Release amd64 (20150218.1)]/ trusty main restricted 4 | 5 | #deb cdrom:[Ubuntu-Server 14.04.2 LTS _Trusty Tahr_ - Release amd64 (20150218.1)]/ trusty main restricted 6 | 7 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 8 | # newer versions of the distribution. 9 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty main restricted 10 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty main restricted 11 | 12 | ## Major bug fix updates produced after the final release of the 13 | ## distribution. 14 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty-updates main restricted 15 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty-updates main restricted 16 | 17 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 18 | ## team. Also, please note that software in universe WILL NOT receive any 19 | ## review or updates from the Ubuntu security team. 20 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty universe 21 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty universe 22 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty-updates universe 23 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty-updates universe 24 | 25 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 26 | ## team, and may not be under a free licence. Please satisfy yourself as to 27 | ## your rights to use the software. Also, please note that software in 28 | ## multiverse WILL NOT receive any review or updates from the Ubuntu 29 | ## security team. 30 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty multiverse 31 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty multiverse 32 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty-updates multiverse 33 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty-updates multiverse 34 | 35 | ## N.B. software from this repository may not have been tested as 36 | ## extensively as that contained in the main release, although it includes 37 | ## newer versions of some applications which may provide useful features. 38 | ## Also, please note that software in backports WILL NOT receive any review 39 | ## or updates from the Ubuntu security team. 40 | deb http://jp.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 41 | deb-src http://jp.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 42 | 43 | deb http://security.ubuntu.com/ubuntu trusty-security main restricted 44 | deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted 45 | deb http://security.ubuntu.com/ubuntu trusty-security universe 46 | deb-src http://security.ubuntu.com/ubuntu trusty-security universe 47 | deb http://security.ubuntu.com/ubuntu trusty-security multiverse 48 | deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse 49 | 50 | ## Uncomment the following two lines to add software from Canonical's 51 | ## 'partner' repository. 52 | ## This software is not part of Ubuntu, but is offered by Canonical and the 53 | ## respective vendors as a service to Ubuntu users. 54 | # deb http://archive.canonical.com/ubuntu trusty partner 55 | # deb-src http://archive.canonical.com/ubuntu trusty partner 56 | 57 | ## Uncomment the following two lines to add software from Ubuntu's 58 | ## 'extras' repository. 59 | ## This software is not part of Ubuntu, but is offered by third-party 60 | ## developers who want to ship their latest software. 61 | # deb http://extras.ubuntu.com/ubuntu trusty main 62 | # deb-src http://extras.ubuntu.com/ubuntu trusty main 63 | -------------------------------------------------------------------------------- /dockerfiles/dmonit/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list && apt-get update 4 | RUN apt-get install -y curl telnet git m4 texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev 5 | RUN apt-get install -y vim-nox locales xfonts-utils fontconfig tmux openssh-server screen 6 | COPY .tmux.conf /root/ 7 | COPY .bashrc /root/ 8 | COPY .vimrc /root/ 9 | COPY freem /bin/ 10 | COPY xdev /bin/ 11 | COPY e /bin/ 12 | RUN chmod +x /bin/e /bin/xdev /bin/freem 13 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen "en_US.UTF-8" 14 | RUN mkdir /root/.ssh 15 | CMD service ssh start && echo $PUBKEY > /root/.ssh/authorized_keys && /bin/bash 16 | -------------------------------------------------------------------------------- /dockerfiles/dmonit/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | cp ../../dotfile/.tmux.conf . 3 | cp ../../dotfile/.vimrc . 4 | cp ../../dotfile/.bashrc . 5 | cp ../../script/freem . 6 | cp ../../script/xdev . 7 | cp ../../script/e . 8 | docker build -t dmonit:1.1 . 9 | rm .tmux.conf 10 | rm .vimrc 11 | rm .bashrc 12 | rm freem 13 | rm xdev 14 | rm e 15 | clean: 16 | rm .tmux.conf 17 | rm .vimrc 18 | rm .bashrc 19 | rm freem 20 | rm xdev 21 | rm e 22 | -------------------------------------------------------------------------------- /dockerfiles/mitmproxy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | COPY sources.list /etc/apt/sources.list 4 | ENV LANG en_US.UTF-8 5 | RUN apt-get update && apt-get install -y mitmproxy locales xfonts-utils fontconfig && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen "en_US.UTF-8" 6 | 7 | 8 | -------------------------------------------------------------------------------- /dockerfiles/mitmproxy/Readme.md: -------------------------------------------------------------------------------- 1 | # 使用方法说明: 2 | 构建完成之后使用如下脚本来做到hijacking 3 | 4 | ``` 5 | #!/usr/bin/env python 6 | # coding=utf-8 7 | 8 | 9 | def request(context, flow): 10 | if 'test.wifi.plus' == flow.request.host: 11 | if flow.request.scheme == "http": 12 | flow.request.host = "127.0.0.1" 13 | flow.request.port = 3000 14 | ``` 15 | 16 | 命令 mitmproxy -p 8321 -s proxy.py 17 | 18 | 端口为http代理端口 19 | 脚本为上面的文件 20 | 21 | Docker命令直接运行的方法: 22 | ``` 23 | docker run -it --rm -p 8321:8321 -v /root/proxy.py:/root/proxy.py mitmproxy mitmproxy -p 8321 -s /root/proxy.py 24 | 25 | ``` 26 | -------------------------------------------------------------------------------- /dockerfiles/mitmproxy/sources.list: -------------------------------------------------------------------------------- 1 | deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 2 | deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 3 | deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 4 | deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 5 | deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 6 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 7 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 8 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 9 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 10 | deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 11 | -------------------------------------------------------------------------------- /dockerfiles/postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | from ubuntu:14.04 2 | 3 | RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list && apt-get update && apt-get -y install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 4 | USER postgres 5 | RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf 6 | RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf 7 | EXPOSE 5432 8 | CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"] 9 | -------------------------------------------------------------------------------- /dockerfiles/smb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list && apt-get update && apt-get install -y samba smbfs 4 | CMD ['/bin/bash'] 5 | -------------------------------------------------------------------------------- /docs/Pictures/background.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/Pictures/background.pdf -------------------------------------------------------------------------------- /docs/Pictures/chapter_head_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/Pictures/chapter_head_1.pdf -------------------------------------------------------------------------------- /docs/Pictures/chapter_head_2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/Pictures/chapter_head_2.pdf -------------------------------------------------------------------------------- /docs/Pictures/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/Pictures/placeholder.jpg -------------------------------------------------------------------------------- /docs/StyleInd.ist: -------------------------------------------------------------------------------- 1 | delim_0 "\\dotfill\ " 2 | delim_1 "\\dotfill\ " 3 | headings_flag 1 4 | heading_prefix "\\vspace*{0.5cm}\\nopagebreak\n\\tikz\\node at (0pt,0pt) [rounded corners=5pt,draw=ocre,fill=ocre!10,line width=1pt,inner sep=5pt]{\\parbox{\\linewidth-2\\fboxsep-2\\fboxrule-2pt}{\\centering\\large\\sffamily\\bfseries\\textcolor{black}{" heading_suffix "}}};\\vspace*{0.2cm}\\nopagebreak\n" -------------------------------------------------------------------------------- /docs/bibliography.bib: -------------------------------------------------------------------------------- 1 | @book{book_key, 2 | address = {City}, 3 | publisher = {Publisher}, 4 | author = {Smith, John}, 5 | title = {Book title}, 6 | year = {2012}, 7 | volume = {3}, 8 | series = {2}, 9 | edition = {1}, 10 | pages = {123--200}, 11 | month = {January} 12 | } 13 | 14 | @article{article_key, 15 | address = {City}, 16 | publisher = {Publisher}, 17 | author = {Smith, James}, 18 | title = {Article title}, 19 | year = {2013}, 20 | volume = {14}, 21 | number = {6}, 22 | pages = {1--8}, 23 | month = {March} 24 | } 25 | -------------------------------------------------------------------------------- /docs/compile.bat: -------------------------------------------------------------------------------- 1 | ::clean 2 | del /s /q main.aux main.bcf main.blg main.ilg main.log main.out main.pdf main.ptc main.run.xml main.toc 3 | 4 | ::comp 5 | pdflatex main 6 | makeindex main.idx -s StyleInd.ist 7 | biber main 8 | pdflatex main 9 | pdflatex main -------------------------------------------------------------------------------- /docs/main.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | \providecommand\zref@newlabel[2]{} 3 | \providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} 4 | \HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined 5 | \global\let\oldcontentsline\contentsline 6 | \gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} 7 | \global\let\oldnewlabel\newlabel 8 | \gdef\newlabel#1#2{\newlabelxx{#1}#2} 9 | \gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} 10 | \AtEndDocument{\ifx\hyper@anchor\@undefined 11 | \let\contentsline\oldcontentsline 12 | \let\newlabel\oldnewlabel 13 | \fi} 14 | \fi} 15 | \global\let\hyper@last\relax 16 | \gdef\HyperFirstAtBeginDocument#1{#1} 17 | \providecommand\HyField@AuxAddToFields[1]{} 18 | \@writefile{toc}{\boolfalse {citerequest}\boolfalse {citetracker}\boolfalse {pagetracker}\boolfalse {backtracker}\relax } 19 | \@writefile{lof}{\boolfalse {citerequest}\boolfalse {citetracker}\boolfalse {pagetracker}\boolfalse {backtracker}\relax } 20 | \@writefile{lot}{\boolfalse {citerequest}\boolfalse {citetracker}\boolfalse {pagetracker}\boolfalse {backtracker}\relax } 21 | \select@language{english} 22 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\select@language{english}} 23 | \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\select@language{english}} 24 | \@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\select@language{english}} 25 | \pgfsyspdfmark {pgfid2}{0}{55380990} 26 | \pgfsyspdfmark {pgfid1}{5966969}{48902215} 27 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {chapter}{\numberline {1}系统安装}{5}{chapter.1}} 28 | \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\addvspace {10\p@ }} 29 | \@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\addvspace {10\p@ }} 30 | \ttl@writefile{ptc}{\ttl@starttoc{default@1}} 31 | \pgfsyspdfmark {pgfid4}{0}{55380990} 32 | \pgfsyspdfmark {pgfid3}{5966969}{48902215} 33 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {1.1}艾玛测试}{5}{section.1.1}} 34 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {1.2}Citation}{5}{section.1.2}} 35 | \abx@aux@backref{1}{book_key}{0}{5}{5} 36 | \abx@aux@backref{2}{article_key}{0}{5}{5} 37 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {1.3}Lists}{5}{section.1.3}} 38 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Numbered List}{5}{subsection.1.3.1}} 39 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.2}Bullet Points}{5}{subsection.1.3.2}} 40 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.3}Descriptions and Definitions}{5}{subsection.1.3.3}} 41 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {chapter}{\numberline {2}In-text Elements}{7}{chapter.2}} 42 | \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\addvspace {10\p@ }} 43 | \@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\addvspace {10\p@ }} 44 | \ttl@writefile{ptc}{\ttl@stoptoc{default@1}} 45 | \ttl@writefile{ptc}{\ttl@starttoc{default@2}} 46 | \pgfsyspdfmark {pgfid6}{0}{55380990} 47 | \pgfsyspdfmark {pgfid5}{5966969}{48902215} 48 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.1}Theorems}{7}{section.2.1}} 49 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Several equations}{7}{subsection.2.1.1}} 50 | \zref@newlabel{mdf@pagelabel-1}{\default{2.1.1}\page{7}\abspage{7}\mdf@pagevalue{7}} 51 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.2}Single Line}{7}{subsection.2.1.2}} 52 | \zref@newlabel{mdf@pagelabel-2}{\default{2.1.2}\page{7}\abspage{7}\mdf@pagevalue{7}} 53 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.2}Definitions}{7}{section.2.2}} 54 | \zref@newlabel{mdf@pagelabel-3}{\default{2.2}\page{7}\abspage{7}\mdf@pagevalue{7}} 55 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.3}Notations}{8}{section.2.3}} 56 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.4}Remarks}{8}{section.2.4}} 57 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.5}Corollaries}{8}{section.2.5}} 58 | \zref@newlabel{mdf@pagelabel-4}{\default{2.5}\page{8}\abspage{8}\mdf@pagevalue{8}} 59 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.6}Propositions}{8}{section.2.6}} 60 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.6.1}Several equations}{8}{subsection.2.6.1}} 61 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.6.2}Single Line}{8}{subsection.2.6.2}} 62 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.7}Examples}{8}{section.2.7}} 63 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.7.1}Equation and Text}{8}{subsection.2.7.1}} 64 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {2.7.2}Paragraph of Text}{9}{subsection.2.7.2}} 65 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.8}Exercises}{9}{section.2.8}} 66 | \zref@newlabel{mdf@pagelabel-5}{\default{2.8}\page{9}\abspage{9}\mdf@pagevalue{9}} 67 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.9}Problems}{9}{section.2.9}} 68 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {2.10}Vocabulary}{9}{section.2.10}} 69 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {chapter}{\numberline {3}Presenting Information}{11}{chapter.3}} 70 | \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\addvspace {10\p@ }} 71 | \@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\addvspace {10\p@ }} 72 | \ttl@writefile{ptc}{\ttl@stoptoc{default@2}} 73 | \ttl@writefile{ptc}{\ttl@starttoc{default@3}} 74 | \pgfsyspdfmark {pgfid9}{0}{55380990} 75 | \pgfsyspdfmark {pgfid8}{5966969}{48902215} 76 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {3.1}Table}{11}{section.3.1}} 77 | \@writefile{lot}{\defcounter {refsection}{0}\relax }\@writefile{lot}{\contentsline {table}{\numberline {3.1}{\ignorespaces Table caption}}{11}{table.3.1}} 78 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {3.2}Figure}{11}{section.3.2}} 79 | \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {3.1}{\ignorespaces Figure caption}}{11}{figure.3.1}} 80 | \pgfsyspdfmark {pgfid11}{0}{55380990} 81 | \pgfsyspdfmark {pgfid10}{5966969}{48902215} 82 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {chapter}{\leavevmode {\color {ocre}Bibliography}}{13}{chapter*.2}} 83 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{Books}{13}{section*.3}} 84 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{Articles}{13}{section*.4}} 85 | \pgfsyspdfmark {pgfid13}{0}{55380990} 86 | \pgfsyspdfmark {pgfid12}{5966969}{49623111} 87 | \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {chapter}{\leavevmode {\color {ocre}Index}}{15}{section*.5}} 88 | \ttl@finishall 89 | -------------------------------------------------------------------------------- /docs/main.bbl: -------------------------------------------------------------------------------- 1 | % $ biblatex auxiliary file $ 2 | % $ biblatex version 1.7 $ 3 | % $ biber version 0.9.9 $ 4 | % Do not modify the above lines! 5 | % 6 | % This is an auxiliary file used by the 'biblatex' package. 7 | % This file may safely be deleted. It will be recreated by 8 | % biber or bibtex as required. 9 | % 10 | \begingroup 11 | \makeatletter 12 | \@ifundefined{ver@biblatex.sty} 13 | {\@latex@error 14 | {Missing 'biblatex' package} 15 | {The bibliography requires the 'biblatex' package.} 16 | \aftergroup\endinput} 17 | {} 18 | \endgroup 19 | 20 | 21 | \refsection{0} 22 | \entry{article_key}{article}{} 23 | \name{labelname}{1}{}{% 24 | {{hash=26a8b4a95216218b2dfc1460f6d4c494}{Smith}{S\bibinitperiod}{James}{J\bibinitperiod}{}{}{}{}}% 25 | } 26 | \name{author}{1}{}{% 27 | {{hash=26a8b4a95216218b2dfc1460f6d4c494}{Smith}{S\bibinitperiod}{James}{J\bibinitperiod}{}{}{}{}}% 28 | } 29 | \list{location}{1}{% 30 | {City}% 31 | } 32 | \list{publisher}{1}{% 33 | {Publisher}% 34 | } 35 | \strng{namehash}{26a8b4a95216218b2dfc1460f6d4c494} 36 | \strng{fullhash}{26a8b4a95216218b2dfc1460f6d4c494} 37 | \field{labelalpha}{Smi13} 38 | \field{sortinit}{S} 39 | \field{month}{03} 40 | \field{number}{6} 41 | \field{title}{Article title} 42 | \field{volume}{14} 43 | \field{year}{2013} 44 | \field{pages}{1\bibrangedash 8} 45 | \endentry 46 | 47 | \entry{book_key}{book}{} 48 | \name{labelname}{1}{}{% 49 | {{hash=5d0ddda3a367ceb26fbaeca02e391c22}{Smith}{S\bibinitperiod}{John}{J\bibinitperiod}{}{}{}{}}% 50 | } 51 | \name{author}{1}{}{% 52 | {{hash=5d0ddda3a367ceb26fbaeca02e391c22}{Smith}{S\bibinitperiod}{John}{J\bibinitperiod}{}{}{}{}}% 53 | } 54 | \list{location}{1}{% 55 | {City}% 56 | } 57 | \list{publisher}{1}{% 58 | {Publisher}% 59 | } 60 | \strng{namehash}{5d0ddda3a367ceb26fbaeca02e391c22} 61 | \strng{fullhash}{5d0ddda3a367ceb26fbaeca02e391c22} 62 | \field{labelalpha}{Smi12} 63 | \field{sortinit}{S} 64 | \field{edition}{1} 65 | \field{month}{01} 66 | \field{series}{2} 67 | \field{title}{Book title} 68 | \field{volume}{3} 69 | \field{year}{2012} 70 | \field{pages}{123\bibrangedash 200} 71 | \endentry 72 | 73 | \endrefsection 74 | \endinput 75 | 76 | -------------------------------------------------------------------------------- /docs/main.bcf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | bblencoding 7 | utf8 8 | 9 | 10 | bibencoding 11 | utf8 12 | 13 | 14 | debug 15 | 0 16 | 17 | 18 | mincrossrefs 19 | 2 20 | 21 | 22 | sortcase 23 | 1 24 | 25 | 26 | sortupper 27 | 1 28 | 29 | 30 | 31 | 32 | 33 | 34 | alphaothers 35 | + 36 | 37 | 38 | labelalpha 39 | 1 40 | 41 | 42 | labelnamespec 43 | shortauthor 44 | author 45 | shorteditor 46 | editor 47 | translator 48 | 49 | 50 | labelyear 51 | 0 52 | 53 | 54 | labelyearspec 55 | year 56 | eventyear 57 | origyear 58 | urlyear 59 | 60 | 61 | maxalphanames 62 | 3 63 | 64 | 65 | maxbibnames 66 | 3 67 | 68 | 69 | maxcitenames 70 | 3 71 | 72 | 73 | maxitems 74 | 3 75 | 76 | 77 | minalphanames 78 | 1 79 | 80 | 81 | minbibnames 82 | 1 83 | 84 | 85 | mincitenames 86 | 1 87 | 88 | 89 | minitems 90 | 1 91 | 92 | 93 | singletitle 94 | 0 95 | 96 | 97 | sortalphaothers 98 | + 99 | 100 | 101 | sortlos 102 | 1 103 | 104 | 105 | uniquelist 106 | 0 107 | 108 | 109 | uniquename 110 | 0 111 | 112 | 113 | useauthor 114 | 1 115 | 116 | 117 | useeditor 118 | 1 119 | 120 | 121 | useprefix 122 | 0 123 | 124 | 125 | usetranslator 126 | 0 127 | 128 | 129 | 130 | 131 | 132 | * 133 | original 134 | romanised 135 | uniform 136 | translated 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | mm 264 | 265 | presort 266 | 267 | 268 | sortkey 269 | 270 | 271 | sortname 272 | author 273 | editor 274 | translator 275 | sorttitle 276 | title 277 | 278 | 279 | sortyear 280 | year 281 | 282 | 283 | sorttitle 284 | title 285 | 286 | 287 | volume 288 | 0000 289 | 290 | 291 | 292 | 293 | 294 | bibliography.bib 295 | 296 | 297 | book_key 298 | article_key 299 | 300 | 301 | -------------------------------------------------------------------------------- /docs/main.blg: -------------------------------------------------------------------------------- 1 | [0] Config.pm:300> INFO - This is Biber 0.9.9 2 | [0] Config.pm:303> INFO - Logfile is 'main.blg' 3 | [1] biber-MSWIN:142> INFO - === %a %b %e, %Y, %H:%M:%S 4 | [1] Biber.pm:271> INFO - Reading 'main.bcf' 5 | [14] Biber.pm:586> INFO - Found 2 citekeys in bib section 0 6 | [22] Biber.pm:2585> INFO - Processing bib section 0 7 | [40] Biber.pm:2677> INFO - Looking for bibtex format file 'bibliography.bib' for section 0 8 | [43] bibtex.pm:833> INFO - Decoding LaTeX character macros into UTF-8 9 | [44] bibtex.pm:837> INFO - Finished Decoding LaTeX character macros into UTF-8 10 | [44] bibtex.pm:708> INFO - Found BibTeX data source 'bibliography.bib' 11 | [100] Biber.pm:2480> INFO - Sorting list 'MAIN' keys 12 | [100] Biber.pm:2484> INFO - No sort tailoring available for locale 'English_United States.1252' 13 | [108] Biber.pm:2480> INFO - Sorting list 'SHORTHANDS' keys 14 | [108] Biber.pm:2484> INFO - No sort tailoring available for locale 'English_United States.1252' 15 | [118] bbl.pm:427> INFO - Writing 'main.bbl' with encoding 'UTF-8' 16 | [119] bbl.pm:498> INFO - Output to main.bbl 17 | -------------------------------------------------------------------------------- /docs/main.idx: -------------------------------------------------------------------------------- 1 | \indexentry{艾玛测试|hyperpage}{5} 2 | \indexentry{Citation|hyperpage}{5} 3 | \indexentry{Lists|hyperpage}{5} 4 | \indexentry{Lists!Numbered List|hyperpage}{5} 5 | \indexentry{Lists!Bullet Points|hyperpage}{5} 6 | \indexentry{Lists!Descriptions and Definitions|hyperpage}{5} 7 | \indexentry{Theorems|hyperpage}{7} 8 | \indexentry{Theorems!Several Equations|hyperpage}{7} 9 | \indexentry{Theorems!Single Line|hyperpage}{7} 10 | \indexentry{Definitions|hyperpage}{7} 11 | \indexentry{Notations|hyperpage}{8} 12 | \indexentry{Remarks|hyperpage}{8} 13 | \indexentry{Corollaries|hyperpage}{8} 14 | \indexentry{Propositions|hyperpage}{8} 15 | \indexentry{Propositions!Several Equations|hyperpage}{8} 16 | \indexentry{Propositions!Single Line|hyperpage}{8} 17 | \indexentry{Examples|hyperpage}{8} 18 | \indexentry{Examples!Equation and Text|hyperpage}{8} 19 | \indexentry{Examples!Paragraph of Text|hyperpage}{9} 20 | \indexentry{Exercises|hyperpage}{9} 21 | \indexentry{Problems|hyperpage}{9} 22 | \indexentry{Vocabulary|hyperpage}{9} 23 | \indexentry{Table|hyperpage}{11} 24 | \indexentry{Figure|hyperpage}{11} 25 | -------------------------------------------------------------------------------- /docs/main.ilg: -------------------------------------------------------------------------------- 1 | This is makeindex, version 2.15 [TeX Live 2010] (kpathsea + Thai support). 2 | Scanning style file ./StyleInd.ist.....done (5 attributes redefined, 0 ignored). 3 | Scanning input file main.idx....done (24 entries accepted, 0 rejected). 4 | Sorting entries....done (118 comparisons). 5 | Generating output file main.ind....done (80 lines written, 0 warnings). 6 | Output written in main.ind. 7 | Transcript written in main.ilg. 8 | -------------------------------------------------------------------------------- /docs/main.ind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/main.ind -------------------------------------------------------------------------------- /docs/main.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/main.log -------------------------------------------------------------------------------- /docs/main.out: -------------------------------------------------------------------------------- 1 | \BOOKMARK [0][-]{chapter.1}{\174\373\176\337\133\211\210\305}{}% 1 2 | \BOOKMARK [1][-]{section.1.1}{\202\176\163\233\155\113\213\325}{chapter.1}% 2 3 | \BOOKMARK [1][-]{section.1.2}{Citation}{chapter.1}% 3 4 | \BOOKMARK [1][-]{section.1.3}{Lists}{chapter.1}% 4 5 | \BOOKMARK [2][-]{subsection.1.3.1}{Numbered List}{section.1.3}% 5 6 | \BOOKMARK [2][-]{subsection.1.3.2}{Bullet Points}{section.1.3}% 6 7 | \BOOKMARK [2][-]{subsection.1.3.3}{Descriptions and Definitions}{section.1.3}% 7 8 | \BOOKMARK [0][-]{chapter.2}{In-text Elements}{}% 8 9 | \BOOKMARK [1][-]{section.2.1}{Theorems}{chapter.2}% 9 10 | \BOOKMARK [2][-]{subsection.2.1.1}{Several equations}{section.2.1}% 10 11 | \BOOKMARK [2][-]{subsection.2.1.2}{Single Line}{section.2.1}% 11 12 | \BOOKMARK [1][-]{section.2.2}{Definitions}{chapter.2}% 12 13 | \BOOKMARK [1][-]{section.2.3}{Notations}{chapter.2}% 13 14 | \BOOKMARK [1][-]{section.2.4}{Remarks}{chapter.2}% 14 15 | \BOOKMARK [1][-]{section.2.5}{Corollaries}{chapter.2}% 15 16 | \BOOKMARK [1][-]{section.2.6}{Propositions}{chapter.2}% 16 17 | \BOOKMARK [2][-]{subsection.2.6.1}{Several equations}{section.2.6}% 17 18 | \BOOKMARK [2][-]{subsection.2.6.2}{Single Line}{section.2.6}% 18 19 | \BOOKMARK [1][-]{section.2.7}{Examples}{chapter.2}% 19 20 | \BOOKMARK [2][-]{subsection.2.7.1}{Equation and Text}{section.2.7}% 20 21 | \BOOKMARK [2][-]{subsection.2.7.2}{Paragraph of Text}{section.2.7}% 21 22 | \BOOKMARK [1][-]{section.2.8}{Exercises}{chapter.2}% 22 23 | \BOOKMARK [1][-]{section.2.9}{Problems}{chapter.2}% 23 24 | \BOOKMARK [1][-]{section.2.10}{Vocabulary}{chapter.2}% 24 25 | \BOOKMARK [0][-]{chapter.3}{Presenting Information}{}% 25 26 | \BOOKMARK [1][-]{section.3.1}{Table}{chapter.3}% 26 27 | \BOOKMARK [1][-]{section.3.2}{Figure}{chapter.3}% 27 28 | \BOOKMARK [0][-]{chapter*.2}{Bibliography}{}% 28 29 | \BOOKMARK [1][-]{section*.3}{Books}{chapter*.2}% 29 30 | \BOOKMARK [1][-]{section*.4}{Articles}{chapter*.2}% 30 31 | \BOOKMARK [0][-]{section*.5}{Index}{}% 31 32 | -------------------------------------------------------------------------------- /docs/main.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/docs/main.pdf -------------------------------------------------------------------------------- /docs/main.ptc: -------------------------------------------------------------------------------- 1 | \boolfalse {citerequest}\boolfalse {citetracker}\boolfalse {pagetracker}\boolfalse {backtracker}\relax 2 | \defcounter {refsection}{0}\relax 3 | \select@language {english} 4 | \defcounter {refsection}{0}\relax 5 | \contentsline {chapter}{\numberline {1}系统安装}{5}{chapter.1} 6 | \ttl@starttoc {default@1} 7 | \defcounter {refsection}{0}\relax 8 | \contentsline {section}{\numberline {1.1}艾玛测试}{5}{section.1.1} 9 | \defcounter {refsection}{0}\relax 10 | \contentsline {section}{\numberline {1.2}Citation}{5}{section.1.2} 11 | \defcounter {refsection}{0}\relax 12 | \contentsline {section}{\numberline {1.3}Lists}{5}{section.1.3} 13 | \defcounter {refsection}{0}\relax 14 | \contentsline {subsection}{\numberline {1.3.1}Numbered List}{5}{subsection.1.3.1} 15 | \defcounter {refsection}{0}\relax 16 | \contentsline {subsection}{\numberline {1.3.2}Bullet Points}{5}{subsection.1.3.2} 17 | \defcounter {refsection}{0}\relax 18 | \contentsline {subsection}{\numberline {1.3.3}Descriptions and Definitions}{5}{subsection.1.3.3} 19 | \defcounter {refsection}{0}\relax 20 | \contentsline {chapter}{\numberline {2}In-text Elements}{7}{chapter.2} 21 | \ttl@stoptoc {default@1} 22 | \ttl@starttoc {default@2} 23 | \defcounter {refsection}{0}\relax 24 | \contentsline {section}{\numberline {2.1}Theorems}{7}{section.2.1} 25 | \defcounter {refsection}{0}\relax 26 | \contentsline {subsection}{\numberline {2.1.1}Several equations}{7}{subsection.2.1.1} 27 | \defcounter {refsection}{0}\relax 28 | \contentsline {subsection}{\numberline {2.1.2}Single Line}{7}{subsection.2.1.2} 29 | \defcounter {refsection}{0}\relax 30 | \contentsline {section}{\numberline {2.2}Definitions}{7}{section.2.2} 31 | \defcounter {refsection}{0}\relax 32 | \contentsline {section}{\numberline {2.3}Notations}{8}{section.2.3} 33 | \defcounter {refsection}{0}\relax 34 | \contentsline {section}{\numberline {2.4}Remarks}{8}{section.2.4} 35 | \defcounter {refsection}{0}\relax 36 | \contentsline {section}{\numberline {2.5}Corollaries}{8}{section.2.5} 37 | \defcounter {refsection}{0}\relax 38 | \contentsline {section}{\numberline {2.6}Propositions}{8}{section.2.6} 39 | \defcounter {refsection}{0}\relax 40 | \contentsline {subsection}{\numberline {2.6.1}Several equations}{8}{subsection.2.6.1} 41 | \defcounter {refsection}{0}\relax 42 | \contentsline {subsection}{\numberline {2.6.2}Single Line}{8}{subsection.2.6.2} 43 | \defcounter {refsection}{0}\relax 44 | \contentsline {section}{\numberline {2.7}Examples}{8}{section.2.7} 45 | \defcounter {refsection}{0}\relax 46 | \contentsline {subsection}{\numberline {2.7.1}Equation and Text}{8}{subsection.2.7.1} 47 | \defcounter {refsection}{0}\relax 48 | \contentsline {subsection}{\numberline {2.7.2}Paragraph of Text}{9}{subsection.2.7.2} 49 | \defcounter {refsection}{0}\relax 50 | \contentsline {section}{\numberline {2.8}Exercises}{9}{section.2.8} 51 | \defcounter {refsection}{0}\relax 52 | \contentsline {section}{\numberline {2.9}Problems}{9}{section.2.9} 53 | \defcounter {refsection}{0}\relax 54 | \contentsline {section}{\numberline {2.10}Vocabulary}{9}{section.2.10} 55 | \defcounter {refsection}{0}\relax 56 | \contentsline {chapter}{\numberline {3}Presenting Information}{11}{chapter.3} 57 | \ttl@stoptoc {default@2} 58 | \ttl@starttoc {default@3} 59 | \defcounter {refsection}{0}\relax 60 | \contentsline {section}{\numberline {3.1}Table}{11}{section.3.1} 61 | \defcounter {refsection}{0}\relax 62 | \contentsline {section}{\numberline {3.2}Figure}{11}{section.3.2} 63 | \defcounter {refsection}{0}\relax 64 | \contentsline {chapter}{\leavevmode {\color {ocre}Bibliography}}{13}{chapter*.2} 65 | \defcounter {refsection}{0}\relax 66 | \contentsline {section}{Books}{13}{section*.3} 67 | \defcounter {refsection}{0}\relax 68 | \contentsline {section}{Articles}{13}{section*.4} 69 | \defcounter {refsection}{0}\relax 70 | \contentsline {chapter}{\leavevmode {\color {ocre}Index}}{15}{section*.5} 71 | \contentsfinish 72 | -------------------------------------------------------------------------------- /docs/main.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 28 | 33 | 36 | 39 | 42 | ]> 43 | 44 | 45 | latex 46 | 47 | main.bcf 48 | 49 | 50 | main.bbl 51 | 52 | 53 | blx-compat.def 54 | biblatex.def 55 | alphabetic.bbx 56 | standard.bbx 57 | alphabetic.cbx 58 | biblatex.cfg 59 | english.lbx 60 | 61 | 62 | 63 | biber 64 | 65 | biber 66 | main 67 | 68 | 69 | main.bcf 70 | 71 | 72 | main.bbl 73 | 74 | 75 | main.bbl 76 | 77 | 78 | main.bcf 79 | 80 | 81 | bibliography.bib 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/main.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % The Legrand Orange Book 3 | % LaTeX Template 4 | % Version 1.4 (12/4/14) 5 | % 6 | % This template has been downloaded from: 7 | % http://www.LaTeXTemplates.com 8 | % 9 | % Original author: 10 | % Mathias Legrand (legrand.mathias@gmail.com) 11 | % 12 | % License: 13 | % CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/) 14 | % 15 | % Compiling this template: 16 | % This template uses biber for its bibliography and makeindex for its index. 17 | % When you first open the template, compile it from the command line with the 18 | % commands below to make sure your LaTeX distribution is configured correctly: 19 | % 20 | % 1) pdflatex main 21 | % 2) makeindex main.idx -s StyleInd.ist 22 | % 3) biber main 23 | % 4) pdflatex main x 2 24 | % 25 | % After this, when you wish to update the bibliography/index use the appropriate 26 | % command above and make sure to compile with pdflatex several times 27 | % afterwards to propagate your changes to the document. 28 | % 29 | % This template also uses a number of packages which may need to be 30 | % updated to the newest versions for the template to compile. It is strongly 31 | % recommended you update your LaTeX distribution if you have any 32 | % compilation errors. 33 | % 34 | % Important note: 35 | % Chapter heading images should have a 2:1 width:height ratio, 36 | % e.g. 920px width and 460px height. 37 | % 38 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 | 40 | %---------------------------------------------------------------------------------------- 41 | % PACKAGES AND OTHER DOCUMENT CONFIGURATIONS 42 | %---------------------------------------------------------------------------------------- 43 | 44 | \documentclass[11pt,fleqn]{book} % Default font size and left-justified equations 45 | 46 | \usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry} % Page margins 47 | \usepackage{CJKutf8} 48 | 49 | 50 | \usepackage{xcolor} % Required for specifying colors by name 51 | \definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book 52 | 53 | % Font Settings 54 | \usepackage{avant} % Use the Avantgarde font for headings 55 | %\usepackage{times} % Use the Times font for headings 56 | \usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Sym­bol, Chancery and Com­puter Modern fonts 57 | 58 | \usepackage{microtype} % Slightly tweak font spacing for aesthetics 59 | \usepackage[utf8]{inputenc} % Required for including letters with accents 60 | \usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs 61 | 62 | % Bibliography 63 | \usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex} 64 | \addbibresource{bibliography.bib} % BibTeX bibliography file 65 | \defbibheading{bibempty}{} 66 | 67 | % Index 68 | \usepackage{calc} % For simpler calculation - used for spacing the index letter headings correctly 69 | \usepackage{makeidx} % Required to make an index 70 | \makeindex % Tells LaTeX to create the files required for indexing 71 | 72 | %---------------------------------------------------------------------------------------- 73 | 74 | \input{structure} % Insert the commands.tex file which contains the majority of the structure behind the template 75 | 76 | \begin{document} 77 | \begin{CJK*}{UTF8}{gbsn} 78 | 79 | %---------------------------------------------------------------------------------------- 80 | % TITLE PAGE 81 | %---------------------------------------------------------------------------------------- 82 | 83 | \begingroup 84 | \thispagestyle{empty} 85 | \AddToShipoutPicture*{\put(6,5){\includegraphics[scale=1]{background}}} % Image background 86 | \centering 87 | \vspace*{9cm} 88 | \par\normalfont\fontsize{35}{35}\sffamily\selectfont 89 | UBUNTU常见问题解答\par % Book title 90 | \vspace*{1cm} 91 | {\Huge jianying Li}\par % Author name 92 | \endgroup 93 | 94 | %---------------------------------------------------------------------------------------- 95 | % COPYRIGHT PAGE 96 | %---------------------------------------------------------------------------------------- 97 | 98 | \newpage 99 | ~\vfill 100 | \thispagestyle{empty} 101 | 102 | \noindent Copyright \copyright\ 2014 李建赢\\ % Copyright notice 103 | 104 | 105 | \noindent \textsc{http://ubtamator.github.io/}\\ % URL 106 | 107 | \noindent Licensed under GPL V3. For view detail : http://www.gnu.org/copyleft/gpl.html\\ % License information 108 | 109 | \noindent \textit{First printing, March 2013} % Printing/edition date 110 | 111 | %---------------------------------------------------------------------------------------- 112 | % TABLE OF CONTENTS 113 | %---------------------------------------------------------------------------------------- 114 | 115 | \chapterimage{chapter_head_1.pdf} % Table of contents heading image 116 | 117 | \pagestyle{empty} % No headers 118 | 119 | \tableofcontents % Print the table of contents itself 120 | 121 | \cleardoublepage % Forces the first chapter to start on an odd page so it's on the right 122 | 123 | \pagestyle{fancy} % Print headers again 124 | 125 | %---------------------------------------------------------------------------------------- 126 | % CHAPTER 1 127 | %---------------------------------------------------------------------------------------- 128 | 129 | \chapterimage{chapter_head_2.pdf} % Chapter heading image 130 | 131 | \chapter{系统安装} 132 | 133 | \section{艾玛测试}\index{艾玛测试} 134 | 135 | 前面老师是傻逼 136 | 137 | %------------------------------------------------ 138 | 139 | \section{Citation}\index{Citation} 140 | 141 | This statement requires citation \cite{book_key}; this one is more specific \cite[122]{article_key}. 142 | 143 | %------------------------------------------------ 144 | 145 | \section{Lists}\index{Lists} 146 | 147 | Lists are useful to present information in a concise and/or ordered way\footnote{Footnote example...}. 148 | 149 | \subsection{Numbered List}\index{Lists!Numbered List} 150 | 151 | \begin{enumerate} 152 | \item The first item 153 | \item The second item 154 | \item The third item 155 | \end{enumerate} 156 | 157 | \subsection{Bullet Points}\index{Lists!Bullet Points} 158 | 159 | \begin{itemize} 160 | \item The first item 161 | \item The second item 162 | \item The third item 163 | \end{itemize} 164 | 165 | \subsection{Descriptions and Definitions}\index{Lists!Descriptions and Definitions} 166 | 167 | \begin{description} 168 | \item[Name] Description 169 | \item[Word] Definition 170 | \item[Comment] Elaboration 171 | \end{description} 172 | 173 | %---------------------------------------------------------------------------------------- 174 | % CHAPTER 2 175 | %---------------------------------------------------------------------------------------- 176 | 177 | \chapter{In-text Elements} 178 | 179 | \section{Theorems}\index{Theorems} 180 | 181 | This is an example of theorems. 182 | 183 | \subsection{Several equations}\index{Theorems!Several Equations} 184 | This is a theorem consisting of several equations. 185 | 186 | \begin{theorem}[Name of the theorem] 187 | In $E=\mathbb{R}^n$ all norms are equivalent. It has the properties: 188 | \begin{align} 189 | & \big| ||\mathbf{x}|| - ||\mathbf{y}|| \big|\leq || \mathbf{x}- \mathbf{y}||\\ 190 | & ||\sum_{i=1}^n\mathbf{x}_i||\leq \sum_{i=1}^n||\mathbf{x}_i||\quad\text{where $n$ is a finite integer} 191 | \end{align} 192 | \end{theorem} 193 | 194 | \subsection{Single Line}\index{Theorems!Single Line} 195 | This is a theorem consisting of just one line. 196 | 197 | \begin{theorem} 198 | A set $\mathcal{D}(G)$ in dense in $L^2(G)$, $|\cdot|_0$. 199 | \end{theorem} 200 | 201 | %------------------------------------------------ 202 | 203 | \section{Definitions}\index{Definitions} 204 | 205 | This is an example of a definition. A definition could be mathematical or it could define a concept. 206 | 207 | \begin{definition}[Definition name] 208 | Given a vector space $E$, a norm on $E$ is an application, denoted $||\cdot||$, $E$ in $\mathbb{R}^+=[0,+\infty[$ such that: 209 | \begin{align} 210 | & ||\mathbf{x}||=0\ \Rightarrow\ \mathbf{x}=\mathbf{0}\\ 211 | & ||\lambda \mathbf{x}||=|\lambda|\cdot ||\mathbf{x}||\\ 212 | & ||\mathbf{x}+\mathbf{y}||\leq ||\mathbf{x}||+||\mathbf{y}|| 213 | \end{align} 214 | \end{definition} 215 | 216 | %------------------------------------------------ 217 | 218 | \section{Notations}\index{Notations} 219 | 220 | \begin{notation} 221 | Given an open subset $G$ of $\mathbb{R}^n$, the set of functions $\varphi$ are: 222 | \begin{enumerate} 223 | \item Bounded support $G$; 224 | \item Infinitely differentiable; 225 | \end{enumerate} 226 | a vector space is denoted by $\mathcal{D}(G)$. 227 | \end{notation} 228 | 229 | %------------------------------------------------ 230 | 231 | \section{Remarks}\index{Remarks} 232 | 233 | This is an example of a remark. 234 | 235 | \begin{remark} 236 | The concepts presented here are now in conventional employment in mathematics. Vector spaces are taken over the field $\mathbb{K}=\mathbb{R}$, however, established properties are easily extended to $\mathbb{K}=\mathbb{C}$. 237 | \end{remark} 238 | 239 | %------------------------------------------------ 240 | 241 | \section{Corollaries}\index{Corollaries} 242 | 243 | This is an example of a corollary. 244 | 245 | \begin{corollary}[Corollary name] 246 | The concepts presented here are now in conventional employment in mathematics. Vector spaces are taken over the field $\mathbb{K}=\mathbb{R}$, however, established properties are easily extended to $\mathbb{K}=\mathbb{C}$. 247 | \end{corollary} 248 | 249 | %------------------------------------------------ 250 | 251 | \section{Propositions}\index{Propositions} 252 | 253 | This is an example of propositions. 254 | 255 | \subsection{Several equations}\index{Propositions!Several Equations} 256 | 257 | \begin{proposition}[Proposition name] 258 | It has the properties: 259 | \begin{align} 260 | & \big| ||\mathbf{x}|| - ||\mathbf{y}|| \big|\leq || \mathbf{x}- \mathbf{y}||\\ 261 | & ||\sum_{i=1}^n\mathbf{x}_i||\leq \sum_{i=1}^n||\mathbf{x}_i||\quad\text{where $n$ is a finite integer} 262 | \end{align} 263 | \end{proposition} 264 | 265 | \subsection{Single Line}\index{Propositions!Single Line} 266 | 267 | \begin{proposition} 268 | Let $f,g\in L^2(G)$; if $\forall \varphi\in\mathcal{D}(G)$, $(f,\varphi)_0=(g,\varphi)_0$ then $f = g$. 269 | \end{proposition} 270 | 271 | %------------------------------------------------ 272 | 273 | \section{Examples}\index{Examples} 274 | 275 | This is an example of examples. 276 | 277 | \subsection{Equation and Text}\index{Examples!Equation and Text} 278 | 279 | \begin{example} 280 | Let $G=\{x\in\mathbb{R}^2:|x|<3\}$ and denoted by: $x^0=(1,1)$; consider the function: 281 | \begin{equation} 282 | f(x)=\left\{\begin{aligned} & \mathrm{e}^{|x|} & & \text{si $|x-x^0|\leq 1/2$}\\ 283 | & 0 & & \text{si $|x-x^0|> 1/2$}\end{aligned}\right. 284 | \end{equation} 285 | The function $f$ has bounded support, we can take $A=\{x\in\mathbb{R}^2:|x-x^0|\leq 1/2+\epsilon\}$ for all $\epsilon\in\intoo{0}{5/2-\sqrt{2}}$. 286 | \end{example} 287 | 288 | \subsection{Paragraph of Text}\index{Examples!Paragraph of Text} 289 | 290 | \begin{example}[Example name] 291 | \lipsum[2] 292 | \end{example} 293 | 294 | %------------------------------------------------ 295 | 296 | \section{Exercises}\index{Exercises} 297 | 298 | This is an example of an exercise. 299 | 300 | \begin{exercise} 301 | This is a good place to ask a question to test learning progress or further cement ideas into students' minds. 302 | \end{exercise} 303 | 304 | %------------------------------------------------ 305 | 306 | \section{Problems}\index{Problems} 307 | 308 | \begin{problem} 309 | What is the average airspeed velocity of an unladen swallow? 310 | \end{problem} 311 | 312 | %------------------------------------------------ 313 | 314 | \section{Vocabulary}\index{Vocabulary} 315 | 316 | Define a word to improve a students' vocabulary. 317 | 318 | \begin{vocabulary}[Word] 319 | Definition of word. 320 | \end{vocabulary} 321 | 322 | %---------------------------------------------------------------------------------------- 323 | % CHAPTER 3 324 | %---------------------------------------------------------------------------------------- 325 | 326 | \chapterimage{chapter_head_1.pdf} % Chapter heading image 327 | 328 | \chapter{Presenting Information} 329 | 330 | \section{Table}\index{Table} 331 | 332 | \begin{table}[h] 333 | \centering 334 | \begin{tabular}{l l l} 335 | \toprule 336 | \textbf{Treatments} & \textbf{Response 1} & \textbf{Response 2}\\ 337 | \midrule 338 | Treatment 1 & 0.0003262 & 0.562 \\ 339 | Treatment 2 & 0.0015681 & 0.910 \\ 340 | Treatment 3 & 0.0009271 & 0.296 \\ 341 | \bottomrule 342 | \end{tabular} 343 | \caption{Table caption} 344 | \end{table} 345 | 346 | %------------------------------------------------ 347 | 348 | \section{Figure}\index{Figure} 349 | 350 | \begin{figure}[h] 351 | \centering\includegraphics[scale=0.5]{placeholder} 352 | \caption{Figure caption} 353 | \end{figure} 354 | 355 | %---------------------------------------------------------------------------------------- 356 | % BIBLIOGRAPHY 357 | %---------------------------------------------------------------------------------------- 358 | 359 | \chapter*{Bibliography} 360 | \addcontentsline{toc}{chapter}{\textcolor{ocre}{Bibliography}} 361 | \section*{Books} 362 | \addcontentsline{toc}{section}{Books} 363 | \printbibliography[heading=bibempty,type=book] 364 | \section*{Articles} 365 | \addcontentsline{toc}{section}{Articles} 366 | \printbibliography[heading=bibempty,type=article] 367 | 368 | %---------------------------------------------------------------------------------------- 369 | % INDEX 370 | %---------------------------------------------------------------------------------------- 371 | 372 | \cleardoublepage 373 | \phantomsection 374 | \setlength{\columnsep}{0.75cm} 375 | \addcontentsline{toc}{chapter}{\textcolor{ocre}{Index}} 376 | \printindex 377 | 378 | %---------------------------------------------------------------------------------------- 379 | \end{CJK*} 380 | \end{document} -------------------------------------------------------------------------------- /docs/main.toc: -------------------------------------------------------------------------------- 1 | \boolfalse {citerequest}\boolfalse {citetracker}\boolfalse {pagetracker}\boolfalse {backtracker}\relax 2 | \defcounter {refsection}{0}\relax 3 | \select@language {english} 4 | \defcounter {refsection}{0}\relax 5 | \contentsline {chapter}{\numberline {1}系统安装}{5}{chapter.1} 6 | \defcounter {refsection}{0}\relax 7 | \contentsline {section}{\numberline {1.1}艾玛测试}{5}{section.1.1} 8 | \defcounter {refsection}{0}\relax 9 | \contentsline {section}{\numberline {1.2}Citation}{5}{section.1.2} 10 | \defcounter {refsection}{0}\relax 11 | \contentsline {section}{\numberline {1.3}Lists}{5}{section.1.3} 12 | \defcounter {refsection}{0}\relax 13 | \contentsline {subsection}{\numberline {1.3.1}Numbered List}{5}{subsection.1.3.1} 14 | \defcounter {refsection}{0}\relax 15 | \contentsline {subsection}{\numberline {1.3.2}Bullet Points}{5}{subsection.1.3.2} 16 | \defcounter {refsection}{0}\relax 17 | \contentsline {subsection}{\numberline {1.3.3}Descriptions and Definitions}{5}{subsection.1.3.3} 18 | \defcounter {refsection}{0}\relax 19 | \contentsline {chapter}{\numberline {2}In-text Elements}{7}{chapter.2} 20 | \defcounter {refsection}{0}\relax 21 | \contentsline {section}{\numberline {2.1}Theorems}{7}{section.2.1} 22 | \defcounter {refsection}{0}\relax 23 | \contentsline {subsection}{\numberline {2.1.1}Several equations}{7}{subsection.2.1.1} 24 | \defcounter {refsection}{0}\relax 25 | \contentsline {subsection}{\numberline {2.1.2}Single Line}{7}{subsection.2.1.2} 26 | \defcounter {refsection}{0}\relax 27 | \contentsline {section}{\numberline {2.2}Definitions}{7}{section.2.2} 28 | \defcounter {refsection}{0}\relax 29 | \contentsline {section}{\numberline {2.3}Notations}{8}{section.2.3} 30 | \defcounter {refsection}{0}\relax 31 | \contentsline {section}{\numberline {2.4}Remarks}{8}{section.2.4} 32 | \defcounter {refsection}{0}\relax 33 | \contentsline {section}{\numberline {2.5}Corollaries}{8}{section.2.5} 34 | \defcounter {refsection}{0}\relax 35 | \contentsline {section}{\numberline {2.6}Propositions}{8}{section.2.6} 36 | \defcounter {refsection}{0}\relax 37 | \contentsline {subsection}{\numberline {2.6.1}Several equations}{8}{subsection.2.6.1} 38 | \defcounter {refsection}{0}\relax 39 | \contentsline {subsection}{\numberline {2.6.2}Single Line}{8}{subsection.2.6.2} 40 | \defcounter {refsection}{0}\relax 41 | \contentsline {section}{\numberline {2.7}Examples}{8}{section.2.7} 42 | \defcounter {refsection}{0}\relax 43 | \contentsline {subsection}{\numberline {2.7.1}Equation and Text}{8}{subsection.2.7.1} 44 | \defcounter {refsection}{0}\relax 45 | \contentsline {subsection}{\numberline {2.7.2}Paragraph of Text}{9}{subsection.2.7.2} 46 | \defcounter {refsection}{0}\relax 47 | \contentsline {section}{\numberline {2.8}Exercises}{9}{section.2.8} 48 | \defcounter {refsection}{0}\relax 49 | \contentsline {section}{\numberline {2.9}Problems}{9}{section.2.9} 50 | \defcounter {refsection}{0}\relax 51 | \contentsline {section}{\numberline {2.10}Vocabulary}{9}{section.2.10} 52 | \defcounter {refsection}{0}\relax 53 | \contentsline {chapter}{\numberline {3}Presenting Information}{11}{chapter.3} 54 | \defcounter {refsection}{0}\relax 55 | \contentsline {section}{\numberline {3.1}Table}{11}{section.3.1} 56 | \defcounter {refsection}{0}\relax 57 | \contentsline {section}{\numberline {3.2}Figure}{11}{section.3.2} 58 | \defcounter {refsection}{0}\relax 59 | \contentsline {chapter}{\leavevmode {\color {ocre}Bibliography}}{13}{chapter*.2} 60 | \defcounter {refsection}{0}\relax 61 | \contentsline {section}{Books}{13}{section*.3} 62 | \defcounter {refsection}{0}\relax 63 | \contentsline {section}{Articles}{13}{section*.4} 64 | \defcounter {refsection}{0}\relax 65 | \contentsline {chapter}{\leavevmode {\color {ocre}Index}}{15}{section*.5} 66 | \contentsfinish 67 | -------------------------------------------------------------------------------- /docs/structure.tex: -------------------------------------------------------------------------------- 1 | %---------------------------------------------------------------------------------------- 2 | % VARIOUS REQUIRED PACKAGES 3 | %---------------------------------------------------------------------------------------- 4 | 5 | \usepackage{titlesec} % Allows customization of titles 6 | 7 | \usepackage{graphicx} % Required for including pictures 8 | \graphicspath{{Pictures/}} % Specifies the directory where pictures are stored 9 | 10 | \usepackage{lipsum} % Inserts dummy text 11 | 12 | \usepackage{tikz} % Required for drawing custom shapes 13 | 14 | \usepackage[english]{babel} % English language/hyphenation 15 | 16 | \usepackage{enumitem} % Customize lists 17 | \setlist{nolistsep} % Reduce spacing between bullet points and numbered lists 18 | 19 | \usepackage{booktabs} % Required for nicer horizontal rules in tables 20 | 21 | \usepackage{eso-pic} % Required for specifying an image background in the title page 22 | 23 | %---------------------------------------------------------------------------------------- 24 | % MAIN TABLE OF CONTENTS 25 | %---------------------------------------------------------------------------------------- 26 | 27 | \usepackage{titletoc} % Required for manipulating the table of contents 28 | 29 | \contentsmargin{0cm} % Removes the default margin 30 | % Chapter text styling 31 | \titlecontents{chapter}[1.25cm] % Indentation 32 | {\addvspace{15pt}\large\sffamily\bfseries} % Spacing and font options for chapters 33 | {\color{ocre!60}\contentslabel[\Large\thecontentslabel]{1.25cm}\color{ocre}} % Chapter number 34 | {} 35 | {\color{ocre!60}\normalsize\sffamily\bfseries\;\titlerule*[.5pc]{.}\;\thecontentspage} % Page number 36 | % Section text styling 37 | \titlecontents{section}[1.25cm] % Indentation 38 | {\addvspace{5pt}\sffamily\bfseries} % Spacing and font options for sections 39 | {\contentslabel[\thecontentslabel]{1.25cm}} % Section number 40 | {} 41 | {\sffamily\hfill\color{black}\thecontentspage} % Page number 42 | [] 43 | % Subsection text styling 44 | \titlecontents{subsection}[1.25cm] % Indentation 45 | {\addvspace{1pt}\sffamily\small} % Spacing and font options for subsections 46 | {\contentslabel[\thecontentslabel]{1.25cm}} % Subsection number 47 | {} 48 | {\sffamily\;\titlerule*[.5pc]{.}\;\thecontentspage} % Page number 49 | [] 50 | 51 | %---------------------------------------------------------------------------------------- 52 | % MINI TABLE OF CONTENTS IN CHAPTER HEADS 53 | %---------------------------------------------------------------------------------------- 54 | 55 | % Section text styling 56 | \titlecontents{lsection}[0em] % Indendating 57 | {\footnotesize\sffamily} % Font settings 58 | {} 59 | {} 60 | {} 61 | 62 | % Subsection text styling 63 | \titlecontents{lsubsection}[.5em] % Indentation 64 | {\normalfont\footnotesize\sffamily} % Font settings 65 | {} 66 | {} 67 | {} 68 | 69 | %---------------------------------------------------------------------------------------- 70 | % PAGE HEADERS 71 | %---------------------------------------------------------------------------------------- 72 | 73 | \usepackage{fancyhdr} % Required for header and footer configuration 74 | 75 | \pagestyle{fancy} 76 | \renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings 77 | \renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings 78 | \fancyhf{} \fancyhead[LE,RO]{\sffamily\normalsize\thepage} % Font setting for the page number in the header 79 | \fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages 80 | \fancyhead[RE]{\leftmark} % Print the current chapter name on the right side of even pages 81 | \renewcommand{\headrulewidth}{0.5pt} % Width of the rule under the header 82 | \addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly 83 | \renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer 84 | \fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified 85 | 86 | % Removes the header from odd empty pages at the end of chapters 87 | \makeatletter 88 | \renewcommand{\cleardoublepage}{ 89 | \clearpage\ifodd\c@page\else 90 | \hbox{} 91 | \vspace*{\fill} 92 | \thispagestyle{empty} 93 | \newpage 94 | \fi} 95 | 96 | %---------------------------------------------------------------------------------------- 97 | % THEOREM STYLES 98 | %---------------------------------------------------------------------------------------- 99 | 100 | \usepackage{amsmath,amsfonts,amssymb,amsthm} % For math equations, theorems, symbols, etc 101 | 102 | \newcommand{\intoo}[2]{\mathopen{]}#1\,;#2\mathclose{[}} 103 | \newcommand{\ud}{\mathop{\mathrm{{}d}}\mathopen{}} 104 | \newcommand{\intff}[2]{\mathopen{[}#1\,;#2\mathclose{]}} 105 | \newtheorem{notation}{Notation}[chapter] 106 | 107 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 108 | %%%%%%%%%%%%%%%%%%%% dedicated to boxed/framed environements %%%%%%%%%%%%%% 109 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 110 | \newtheoremstyle{ocrenumbox}% % Theorem style name 111 | {0pt}% Space above 112 | {0pt}% Space below 113 | {\normalfont}% % Body font 114 | {}% Indent amount 115 | {\small\bf\sffamily\color{ocre}}% % Theorem head font 116 | {\;}% Punctuation after theorem head 117 | {0.25em}% Space after theorem head 118 | {\small\sffamily\color{ocre}\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1) 119 | \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black}---\nobreakspace#3.}} % Optional theorem note 120 | \renewcommand{\qedsymbol}{$\blacksquare$}% Optional qed square 121 | 122 | \newtheoremstyle{blacknumex}% Theorem style name 123 | {5pt}% Space above 124 | {5pt}% Space below 125 | {\normalfont}% Body font 126 | {} % Indent amount 127 | {\small\bf\sffamily}% Theorem head font 128 | {\;}% Punctuation after theorem head 129 | {0.25em}% Space after theorem head 130 | {\small\sffamily{\tiny\ensuremath{\blacksquare}}\nobreakspace\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1) 131 | \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}% Optional theorem note 132 | 133 | \newtheoremstyle{blacknumbox} % Theorem style name 134 | {0pt}% Space above 135 | {0pt}% Space below 136 | {\normalfont}% Body font 137 | {}% Indent amount 138 | {\small\bf\sffamily}% Theorem head font 139 | {\;}% Punctuation after theorem head 140 | {0.25em}% Space after theorem head 141 | {\small\sffamily\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1) 142 | \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries---\nobreakspace#3.}}% Optional theorem note 143 | 144 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 145 | %%%%%%%%%%%%% dedicated to non-boxed/non-framed environements %%%%%%%%%%%%% 146 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 147 | \newtheoremstyle{ocrenum}% % Theorem style name 148 | {5pt}% Space above 149 | {5pt}% Space below 150 | {\normalfont}% % Body font 151 | {}% Indent amount 152 | {\small\bf\sffamily\color{ocre}}% % Theorem head font 153 | {\;}% Punctuation after theorem head 154 | {0.25em}% Space after theorem head 155 | {\small\sffamily\color{ocre}\thmname{#1}\nobreakspace\thmnumber{\@ifnotempty{#1}{}\@upn{#2}}% Theorem text (e.g. Theorem 2.1) 156 | \thmnote{\nobreakspace\the\thm@notefont\sffamily\bfseries\color{black}---\nobreakspace#3.}} % Optional theorem note 157 | \renewcommand{\qedsymbol}{$\blacksquare$}% Optional qed square 158 | \makeatother 159 | 160 | % Defines the theorem text style for each type of theorem to one of the three styles above 161 | \newcounter{dummy} 162 | \numberwithin{dummy}{section} 163 | \theoremstyle{ocrenumbox} 164 | \newtheorem{theoremeT}[dummy]{Theorem} 165 | \newtheorem{problem}{Problem}[chapter] 166 | \newtheorem{exerciseT}{Exercise}[chapter] 167 | \theoremstyle{blacknumex} 168 | \newtheorem{exampleT}{Example}[chapter] 169 | \theoremstyle{blacknumbox} 170 | \newtheorem{vocabulary}{Vocabulary}[chapter] 171 | \newtheorem{definitionT}{Definition}[section] 172 | \newtheorem{corollaryT}[dummy]{Corollary} 173 | \theoremstyle{ocrenum} 174 | \newtheorem{proposition}[dummy]{Proposition} 175 | 176 | %---------------------------------------------------------------------------------------- 177 | % DEFINITION OF COLORED BOXES 178 | %---------------------------------------------------------------------------------------- 179 | 180 | \RequirePackage[framemethod=default]{mdframed} % Required for creating the theorem, definition, exercise and corollary boxes 181 | 182 | % Theorem box 183 | \newmdenv[skipabove=7pt, 184 | skipbelow=7pt, 185 | backgroundcolor=black!5, 186 | linecolor=ocre, 187 | innerleftmargin=5pt, 188 | innerrightmargin=5pt, 189 | innertopmargin=5pt, 190 | leftmargin=0cm, 191 | rightmargin=0cm, 192 | innerbottommargin=5pt]{tBox} 193 | 194 | % Exercise box 195 | \newmdenv[skipabove=7pt, 196 | skipbelow=7pt, 197 | rightline=false, 198 | leftline=true, 199 | topline=false, 200 | bottomline=false, 201 | backgroundcolor=ocre!10, 202 | linecolor=ocre, 203 | innerleftmargin=5pt, 204 | innerrightmargin=5pt, 205 | innertopmargin=5pt, 206 | innerbottommargin=5pt, 207 | leftmargin=0cm, 208 | rightmargin=0cm, 209 | linewidth=4pt]{eBox} 210 | 211 | % Definition box 212 | \newmdenv[skipabove=7pt, 213 | skipbelow=7pt, 214 | rightline=false, 215 | leftline=true, 216 | topline=false, 217 | bottomline=false, 218 | linecolor=ocre, 219 | innerleftmargin=5pt, 220 | innerrightmargin=5pt, 221 | innertopmargin=0pt, 222 | leftmargin=0cm, 223 | rightmargin=0cm, 224 | linewidth=4pt, 225 | innerbottommargin=0pt]{dBox} 226 | 227 | % Corollary box 228 | \newmdenv[skipabove=7pt, 229 | skipbelow=7pt, 230 | rightline=false, 231 | leftline=true, 232 | topline=false, 233 | bottomline=false, 234 | linecolor=gray, 235 | backgroundcolor=black!5, 236 | innerleftmargin=5pt, 237 | innerrightmargin=5pt, 238 | innertopmargin=5pt, 239 | leftmargin=0cm, 240 | rightmargin=0cm, 241 | linewidth=4pt, 242 | innerbottommargin=5pt]{cBox} 243 | 244 | % Creates an environment for each type of theorem and assigns it a theorem text style from the "Theorem Styles" section above and a colored box from above 245 | \newenvironment{theorem}{\begin{tBox}\begin{theoremeT}}{\end{theoremeT}\end{tBox}} 246 | \newenvironment{exercise}{\begin{eBox}\begin{exerciseT}}{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciseT}\end{eBox}} 247 | \newenvironment{definition}{\begin{dBox}\begin{definitionT}}{\end{definitionT}\end{dBox}} 248 | \newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}} 249 | \newenvironment{corollary}{\begin{cBox}\begin{corollaryT}}{\end{corollaryT}\end{cBox}} 250 | 251 | %---------------------------------------------------------------------------------------- 252 | % REMARK ENVIRONMENT 253 | %---------------------------------------------------------------------------------------- 254 | 255 | \newenvironment{remark}{\par\vspace{10pt}\small % Vertical white space above the remark and smaller font size 256 | \begin{list}{}{ 257 | \leftmargin=35pt % Indentation on the left 258 | \rightmargin=25pt}\item\ignorespaces % Indentation on the right 259 | \makebox[-2.5pt]{\begin{tikzpicture}[overlay] 260 | \node[draw=ocre!60,line width=1pt,circle,fill=ocre!25,font=\sffamily\bfseries,inner sep=2pt,outer sep=0pt] at (-15pt,0pt){\textcolor{ocre}{R}};\end{tikzpicture}} % Orange R in a circle 261 | \advance\baselineskip -1pt}{\end{list}\vskip5pt} % Tighter line spacing and white space after remark 262 | 263 | %---------------------------------------------------------------------------------------- 264 | % SECTION NUMBERING IN THE MARGIN 265 | %---------------------------------------------------------------------------------------- 266 | 267 | \makeatletter 268 | \renewcommand{\@seccntformat}[1]{\llap{\textcolor{ocre}{\csname the#1\endcsname}\hspace{1em}}} 269 | \renewcommand{\section}{\@startsection{section}{1}{\z@} 270 | {-4ex \@plus -1ex \@minus -.4ex} 271 | {1ex \@plus.2ex } 272 | {\normalfont\large\sffamily\bfseries}} 273 | \renewcommand{\subsection}{\@startsection {subsection}{2}{\z@} 274 | {-3ex \@plus -0.1ex \@minus -.4ex} 275 | {0.5ex \@plus.2ex } 276 | {\normalfont\sffamily\bfseries}} 277 | \renewcommand{\subsubsection}{\@startsection {subsubsection}{3}{\z@} 278 | {-2ex \@plus -0.1ex \@minus -.2ex} 279 | {.2ex \@plus.2ex } 280 | {\normalfont\small\sffamily\bfseries}} 281 | \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@} 282 | {-2ex \@plus-.2ex \@minus .2ex} 283 | {.1ex} 284 | {\normalfont\small\sffamily\bfseries}} 285 | 286 | %---------------------------------------------------------------------------------------- 287 | % HYPERLINKS IN THE DOCUMENTS 288 | %---------------------------------------------------------------------------------------- 289 | 290 | % For an unclear reason, the package should be loaded now and not later 291 | \usepackage{hyperref} 292 | \hypersetup{hidelinks,backref=true,pagebackref=true,hyperindex=true,colorlinks=false,breaklinks=true,urlcolor= ocre,bookmarks=true,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}} 293 | 294 | %---------------------------------------------------------------------------------------- 295 | % CHAPTER HEADINGS 296 | %---------------------------------------------------------------------------------------- 297 | 298 | % The set-up below should be (sadly) manually adapted to the overall margin page septup controlled by the geometry package loaded in the main.tex document. It is possible to implement below the dimensions used in the goemetry package (top,bottom,left,right)... TO BE DONE 299 | 300 | \newcommand{\thechapterimage}{} 301 | \newcommand{\chapterimage}[1]{\renewcommand{\thechapterimage}{#1}} 302 | 303 | % Numbered chapters with mini tableofcontents 304 | \def\thechapter{\arabic{chapter}} 305 | \def\@makechapterhead#1{ 306 | \thispagestyle{empty} 307 | {\centering \normalfont\sffamily 308 | \ifnum \c@secnumdepth >\m@ne 309 | \if@mainmatter 310 | \startcontents 311 | \begin{tikzpicture}[remember picture,overlay] 312 | \node at (current page.north west) 313 | {\begin{tikzpicture}[remember picture,overlay] 314 | \node[anchor=north west,inner sep=0pt] at (0,0) {\includegraphics[width=\paperwidth]{\thechapterimage}}; 315 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 316 | % Commenting the 3 lines below removes the small contents box in the chapter heading 317 | \fill[color=ocre!10!white,opacity=.6] (1cm,0) rectangle (8cm,-7cm); 318 | \node[anchor=north west] at (1.1cm,.35cm) {\parbox[t][8cm][t]{6.5cm}{\huge\bfseries\flushleft \printcontents{l}{1}{\setcounter{tocdepth}{2}}}}; 319 | \draw[anchor=west] (5cm,-9cm) node [rounded corners=20pt,fill=ocre!10!white,text opacity=1,draw=ocre,draw opacity=1,line width=1.5pt,fill opacity=.6,inner sep=12pt]{\huge\sffamily\bfseries\textcolor{black}{\thechapter. #1\strut\makebox[22cm]{}}}; 320 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 321 | \end{tikzpicture}}; 322 | \end{tikzpicture}} 323 | \par\vspace*{230\p@} 324 | \fi 325 | \fi} 326 | 327 | % Unnumbered chapters without mini tableofcontents (could be added though) 328 | \def\@makeschapterhead#1{ 329 | \thispagestyle{empty} 330 | {\centering \normalfont\sffamily 331 | \ifnum \c@secnumdepth >\m@ne 332 | \if@mainmatter 333 | \begin{tikzpicture}[remember picture,overlay] 334 | \node at (current page.north west) 335 | {\begin{tikzpicture}[remember picture,overlay] 336 | \node[anchor=north west,inner sep=0pt] at (0,0) {\includegraphics[width=\paperwidth]{\thechapterimage}}; 337 | \draw[anchor=west] (5cm,-9cm) node [rounded corners=20pt,fill=ocre!10!white,fill opacity=.6,inner sep=12pt,text opacity=1,draw=ocre,draw opacity=1,line width=1.5pt]{\huge\sffamily\bfseries\textcolor{black}{#1\strut\makebox[22cm]{}}}; 338 | \end{tikzpicture}}; 339 | \end{tikzpicture}} 340 | \par\vspace*{230\p@} 341 | \fi 342 | \fi 343 | } 344 | \makeatother -------------------------------------------------------------------------------- /dotfile/.bashrc: -------------------------------------------------------------------------------- 1 | export TERM='xterm-256color' 2 | export LANG=en_US.UTF-8 3 | export LC_CTYPE="en_US.UTF-8" 4 | export LC_ALL=en_US.UTF-8 5 | TZ='Asia/Shanghai'; export TZ 6 | stty stop '' 7 | stty start '' 8 | stty -ixon 9 | stty -ixoff 10 | PS1="[\[\e[32m\]#\##\[\e[31m\]\u@\[\e[36m\]\h \w]\$\[\e[m\]" 11 | alias resetenv='curl https://raw.githubusercontent.com/lijianying10/FixLinux/master/script/env.sh | bash' 12 | 13 | export GOPATH=/go 14 | export PATH=$PATH:/go/bin/:/usr/local/go/bin/:/usr/local/node/bin/ 15 | -------------------------------------------------------------------------------- /dotfile/.tmux.conf: -------------------------------------------------------------------------------- 1 | # 0 is too far from ` ;) 2 | set -g base-index 1 3 | 4 | # Automatically set window title 5 | set-window-option -g automatic-rename on 6 | set-option -g set-titles on 7 | 8 | set -g default-terminal screen-256color 9 | set -g status-keys vi 10 | set -g history-limit 10000 11 | 12 | setw -g mode-keys vi 13 | setw -g monitor-activity on 14 | 15 | bind-key v split-window -h 16 | bind-key s split-window -v 17 | 18 | bind-key -n M-S resize-pane -D 2 19 | bind-key -n M-W resize-pane -U 2 20 | bind-key -n M-A resize-pane -L 2 21 | bind-key -n M-D resize-pane -R 2 22 | 23 | # Vim style pane selection 24 | bind h select-pane -L 25 | bind j select-pane -D 26 | bind k select-pane -U 27 | bind l select-pane -R 28 | 29 | # Use Alt-vim keys without prefix key to switch panes 30 | #bind -n M-h select-pane -L 31 | #bind -n M-j select-pane -D 32 | #bind -n M-k select-pane -U 33 | #bind -n M-l select-pane -R 34 | 35 | # Use Alt-arrow keys without prefix key to switch panes 36 | #bind -n M-Left select-pane -L 37 | #bind -n M-Right select-pane -R 38 | #bind -n M-Up select-pane -U 39 | #bind -n M-Down select-pane -D 40 | 41 | # Shift arrow to switch windows 42 | bind -n M-h previous-window 43 | bind -n M-l next-window 44 | 45 | bind -n M-a select-pane -L # move left 46 | bind -n M-s select-pane -D # move down 47 | bind -n M-w select-pane -U # move up 48 | bind -n M-d select-pane -R # move right 49 | 50 | bind -n M-q split-window -h 51 | bind -n M-e split-window -v 52 | 53 | bind -n M-r command-prompt "rename-window '%%'" 54 | 55 | # No delay for escape key press 56 | set -sg escape-time 0 57 | 58 | # Reload tmux config 59 | bind r source-file ~/.tmux.conf 60 | 61 | # THEME 62 | set -g status-bg black 63 | set -g status-fg white 64 | set -g window-status-current-bg white 65 | set -g window-status-current-fg black 66 | #set -g window-status-current-attr bold 67 | set -g status-interval 1 68 | set -g status-left-length 30 69 | #set -g status-left '#[fg=green](#S) #(whoami)' 70 | set -g status-right '#[fg=green]#(freem)#[default] #[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M:%S#[default] #[fg=white]#(date +%s)#[default]' 71 | -------------------------------------------------------------------------------- /dotfile/.vimrc: -------------------------------------------------------------------------------- 1 | filetype off " required 2 | 3 | " Specify a directory for plugins 4 | " - For Neovim: ~/.local/share/nvim/plugged 5 | " - Avoid using standard Vim directory names like 'plugin' 6 | call plug#begin('~/.vim/plugged') 7 | " Initialize plugin system 8 | Plug 'fatih/vim-go' 9 | Plug 'mileszs/ack.vim' 10 | Plug 'majutsushi/tagbar' 11 | Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } 12 | Plug 'vim-airline/vim-airline' 13 | Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 14 | Plug 'junegunn/fzf.vim' 15 | " for HTML 16 | Plug 'mattn/emmet-vim' 17 | " for typescript 18 | Plug 'leafgarland/typescript-vim' 19 | " for JS 20 | Plug 'pangloss/vim-javascript' 21 | " for SNIP tool 22 | Plug 'SirVer/ultisnips' 23 | " Snippets are separated from the engine. Add this if you want them: 24 | Plug 'honza/vim-snippets' 25 | Plug 'w0rp/ale' 26 | Plug 'joshdick/onedark.vim' 27 | Plug 'neoclide/coc.nvim', {'branch': 'release'} 28 | Plug 'google/vim-maktaba' 29 | Plug 'bazelbuild/vim-bazel' 30 | Plug 'tmhedberg/simpylfold' 31 | call plug#end() 32 | 33 | let g:python3_host_prog = '/usr/bin/python3' 34 | " let g:python_host_prog = '/usr/bin/python' 35 | let g:loaded_python_provider=1 36 | let g:python_host_skip_check=1 37 | 38 | " 代码高亮用的 39 | syntax enable 40 | filetype plugin on 41 | set number 42 | set noswapfile 43 | let g:go_fmt_command = "goimports" "保存的时候自动运行goimports 44 | let g:go_highlight_build_constraints = 1 45 | let g:go_highlight_extra_types = 1 46 | let g:go_highlight_fields = 1 47 | let g:go_highlight_functions = 1 48 | let g:go_highlight_methods = 1 49 | let g:go_highlight_operators = 1 50 | let g:go_highlight_structs = 1 51 | let g:go_highlight_types = 1 52 | let g:go_def_mode='gopls' 53 | let g:go_info_mode='gopls' 54 | 55 | " 颜色配置 56 | colorscheme onedark 57 | 58 | " 标签分析 59 | let g:tagbar_type_go = { 60 | \ 'ctagstype' : 'go', 61 | \ 'kinds' : [ 62 | \ 'p:package', 63 | \ 'i:imports:1', 64 | \ 'c:constants', 65 | \ 'v:variables', 66 | \ 't:types', 67 | \ 'n:interfaces', 68 | \ 'w:fields', 69 | \ 'e:embedded', 70 | \ 'm:methods', 71 | \ 'r:constructor', 72 | \ 'f:functions' 73 | \ ], 74 | \ 'sro' : '.', 75 | \ 'kind2scope' : { 76 | \ 't' : 'ctype', 77 | \ 'n' : 'ntype' 78 | \ }, 79 | \ 'scope2kind' : { 80 | \ 'ctype' : 't', 81 | \ 'ntype' : 'n' 82 | \ }, 83 | \ 'ctagsbin' : 'gotags', 84 | \ 'ctagsargs' : '-sort -silent' 85 | \ } 86 | 87 | " 标签映射 88 | " execute "set =\ei" 89 | " execute "set =\eo" 90 | " execute "set =\ep" 91 | " execute "set =\eu" 92 | " execute "set =\el" 93 | " execute "set =\en" 94 | " execute "set =\ey" 95 | " execute "set =\ec" 96 | 97 | nmap :TagbarToggle 98 | imap :TagbarTogglei 99 | nmap :NERDTreeToggle 100 | imap :NERDTreeToggle 101 | nmap :q 102 | nmap :tabn 103 | imap :tabn 104 | nmap :tabp 105 | imap :tabp 106 | nmap :w:GoMetaLinter 107 | nmap (coc-definition) 108 | nmap :undo 109 | nmap :GoErrCheck 110 | nmap :w 111 | imap :w 112 | imap :pc 113 | nmap :pc 114 | nmap r :Ack 115 | nmap t :FZF 116 | 117 | set backspace=indent,eol,start " 让backspace能正常工作的配置 118 | 119 | " 这是对PowerLine的设置 120 | set encoding=utf-8 121 | set laststatus=2 122 | let g:Powerline_symbols='unicode' 123 | 124 | " tab设置 125 | set ts=4 126 | set expandtab 127 | 128 | " 解决esc延迟问题 129 | set timeoutlen=1000 ttimeoutlen=0 130 | 131 | "高亮显示搜索匹配到的字符串 132 | set hlsearch 133 | 134 | "在搜索模式下,随着搜索字符的逐个输入,实时进行字符串匹配,并对首个匹配到的字符串高亮显示 135 | set incsearch 136 | 137 | " 解决Tmux下 背景颜色不一致的问题 138 | set t_ut= 139 | 140 | " tab 也使用airline 141 | let g:airline#extensions#tabline#enabled = 1 142 | 143 | " 使用Powerline字体 144 | let g:airline_powerline_fonts = 1 145 | let g:ackprg = 'ack -s -H --nopager --nocolor --nogroup --column --smart-case' 146 | 147 | function SetClipData() 148 | let clipdata = getreg("") 149 | call system("echo -n '".clipdata."' > /tmp/clipdata") 150 | endfunction 151 | 152 | func GetClipData() 153 | let clipdata = system("cat /tmp/clipdata") 154 | call append(getpos(".")[1],split(clipdata,"\n")) 155 | endfunction 156 | 157 | nmap c :call SetClipData() 158 | nmap v :call GetClipData() 159 | inoremap { {}i 160 | inoremap ( ()i 161 | inoremap " ""i 162 | inoremap ' ''i 163 | 164 | augroup gopkgs 165 | autocmd! 166 | autocmd FileType go command! -buffer Import exe 'GoImport' fzf#run({'source': 'gopkgs'})[0] 167 | autocmd FileType go command! -buffer Doc exe 'GoDoc' fzf#run({'source': 'gopkgs'})[0] 168 | augroup END 169 | 170 | " for js check 171 | let g:javascript_plugin_jsdoc = 1 172 | let g:javascript_plugin_ngdoc = 1 173 | let g:javascript_plugin_flow = 1 174 | 175 | " Snippets tool config 176 | " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. 177 | let g:UltiSnipsExpandTrigger="" 178 | let g:UltiSnipsJumpForwardTrigger="" 179 | let g:UltiSnipsJumpBackwardTrigger="" 180 | 181 | " If you want :UltiSnipsEdit to split your window. 182 | let g:UltiSnipsEditSplit="vertical" 183 | 184 | " tabs for golang 185 | au FileType go set noexpandtab 186 | au FileType go set shiftwidth=4 187 | au FileType go set softtabstop=4 188 | au FileType go set tabstop=4 189 | 190 | " For ale 191 | let g:ale_linters = {'go': ['golint']} 192 | " Error and warning signs. 193 | let g:ale_sign_error = '⤫' 194 | let g:ale_sign_warning = '⚠' 195 | " Enable integration with airline. 196 | let g:airline#extensions#ale#enabled = 1 197 | 198 | " For ack 199 | " Real time preview 200 | let g:ackpreview=1 201 | 202 | " Offset while scroll line 203 | set scrolloff=6 204 | 205 | set completeopt-=preview 206 | 207 | " ------------------------------------------------------------------------------------------------- 208 | " coc.nvim default settings 209 | " ------------------------------------------------------------------------------------------------- 210 | 211 | " TextEdit might fail if hidden is not set. 212 | set hidden 213 | 214 | " Some servers have issues with backup files, see #649. 215 | set nobackup 216 | set nowritebackup 217 | 218 | " Give more space for displaying messages. 219 | set cmdheight=2 220 | 221 | " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable 222 | " delays and poor user experience. 223 | set updatetime=300 224 | 225 | " Don't pass messages to |ins-completion-menu|. 226 | set shortmess+=c 227 | 228 | " Use tab for trigger completion with characters ahead and navigate. 229 | " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by 230 | " other plugin before putting this into your config. 231 | inoremap 232 | \ pumvisible() ? "\" : 233 | \ check_back_space() ? "\" : 234 | \ coc#refresh() 235 | inoremap pumvisible() ? "\" : "\" 236 | 237 | function! s:check_back_space() abort 238 | let col = col('.') - 1 239 | return !col || getline('.')[col - 1] =~# '\s' 240 | endfunction 241 | 242 | " Use to trigger completion. 243 | if has('nvim') 244 | inoremap coc#refresh() 245 | else 246 | inoremap coc#refresh() 247 | endif 248 | 249 | " Make auto-select the first completion item and notify coc.nvim to 250 | " format on enter, could be remapped by other vim plugin 251 | inoremap pumvisible() ? coc#_select_confirm() 252 | \: "\u\\=coc#on_enter()\" 253 | 254 | " Use `[g` and `]g` to navigate diagnostics 255 | " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. 256 | nmap [g (coc-diagnostic-prev) 257 | nmap ]g (coc-diagnostic-next) 258 | 259 | " GoTo code navigation. 260 | nmap gd (coc-definition) 261 | nmap gy (coc-type-definition) 262 | nmap gi (coc-implementation) 263 | nmap gr (coc-references) 264 | 265 | " Use K to show documentation in preview window. 266 | nnoremap K :call show_documentation() 267 | 268 | function! s:show_documentation() 269 | if (index(['vim','help'], &filetype) >= 0) 270 | execute 'h '.expand('') 271 | elseif (coc#rpc#ready()) 272 | call CocActionAsync('doHover') 273 | else 274 | execute '!' . &keywordprg . " " . expand('') 275 | endif 276 | endfunction 277 | 278 | " Highlight the symbol and its references when holding the cursor. 279 | autocmd CursorHold * silent call CocActionAsync('highlight') 280 | 281 | " Symbol renaming. 282 | nmap rn (coc-rename) 283 | 284 | " Formatting selected code. 285 | xmap f (coc-format-selected) 286 | nmap f (coc-format-selected) 287 | 288 | augroup mygroup 289 | autocmd! 290 | " Setup formatexpr specified filetype(s). 291 | autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') 292 | " Update signature help on jump placeholder. 293 | autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') 294 | augroup end 295 | 296 | " Applying codeAction to the selected region. 297 | " Example: `aap` for current paragraph 298 | xmap a (coc-codeaction-selected) 299 | nmap a (coc-codeaction-selected) 300 | 301 | " Remap keys for applying codeAction to the current buffer. 302 | nmap ac (coc-codeaction) 303 | " Apply AutoFix to problem on the current line. 304 | nmap qf (coc-fix-current) 305 | 306 | " Map function and class text objects 307 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server. 308 | xmap if (coc-funcobj-i) 309 | omap if (coc-funcobj-i) 310 | xmap af (coc-funcobj-a) 311 | omap af (coc-funcobj-a) 312 | xmap ic (coc-classobj-i) 313 | omap ic (coc-classobj-i) 314 | xmap ac (coc-classobj-a) 315 | omap ac (coc-classobj-a) 316 | 317 | " Remap and for scroll float windows/popups. 318 | if has('nvim-0.4.0') || has('patch-8.2.0750') 319 | nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" 320 | nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" 321 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" 322 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" 323 | vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" 324 | vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" 325 | endif 326 | 327 | " Use CTRL-S for selections ranges. 328 | " Requires 'textDocument/selectionRange' support of language server. 329 | " nmap (coc-range-select) 330 | " xmap (coc-range-select) 331 | 332 | " Add `:Format` command to format current buffer. 333 | command! -nargs=0 Format :call CocAction('format') 334 | 335 | " Add `:Fold` command to fold current buffer. 336 | command! -nargs=? Fold :call CocAction('fold', ) 337 | 338 | " Add `:OR` command for organize imports of the current buffer. 339 | command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') 340 | 341 | " Add (Neo)Vim's native statusline support. 342 | " NOTE: Please see `:h coc-status` for integrations with external plugins that 343 | " provide custom statusline: lightline.vim, vim-airline. 344 | set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} 345 | 346 | " Mappings for CoCList 347 | " Show all diagnostics. 348 | nnoremap a :CocList diagnostics 349 | " Manage extensions. 350 | nnoremap e :CocList extensions 351 | " Show commands. 352 | nnoremap c :CocList commands 353 | " Find symbol of current document. 354 | nnoremap o :CocList outline 355 | " Search workspace symbols. 356 | nnoremap s :CocList -I symbols 357 | " Do default action for next item. 358 | nnoremap j :CocNext 359 | " Do default action for previous item. 360 | nnoremap k :CocPrev 361 | " Resume latest coc list. 362 | nnoremap p :CocListResume 363 | 364 | " ------------------------------------------------------------------------------------------------- 365 | " coc.nvim default settings end 366 | " ------------------------------------------------------------------------------------------------- 367 | 368 | " disable vim-go :GoDef short cut (gd) 369 | " this is handled by LanguageClient [LC] 370 | let g:go_def_mapping_enabled = 0 371 | 372 | " set number line width 1 373 | set nuw=1 374 | 375 | " disable vim-go gopls 376 | let g:go_gopls_enabled=0 377 | 378 | " enable fold 379 | set foldmethod=syntax 380 | set foldlevel=4 381 | let g:SimpylFold_docstring_preview=1 382 | -------------------------------------------------------------------------------- /dotfile/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "languageserver": { 3 | "golang": { 4 | "command": "gopls", 5 | "rootPatterns": ["go.mod"], 6 | "filetypes": ["go"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /gh60.c: -------------------------------------------------------------------------------- 1 | #include "keymap_common.h" 2 | 3 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 4 | /* 0: qwerty */ 5 | KEYMAP_ANSI( 6 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ 7 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ 8 | ESC,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \ 9 | LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, FN0, \ 10 | LCTL,LGUI,LALT, SPC, DEL, UP,HOME, END), 11 | /* 1: colemak */ 12 | KEYMAP_ANSI( 13 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ 14 | TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \ 15 | BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \ 16 | LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \ 17 | LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), 18 | /* 2: dvorak */ 19 | KEYMAP_ANSI( 20 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \ 21 | TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \ 22 | CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \ 23 | LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \ 24 | LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), 25 | /* 3: workman */ 26 | KEYMAP_ANSI( 27 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ 28 | TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \ 29 | BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \ 30 | LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \ 31 | LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL), 32 | /* 4: Poker with Arrow */ 33 | KEYMAP_ANSI( 34 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 35 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 36 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ 37 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ 38 | TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), 39 | /* 5: Poker with Esc */ 40 | KEYMAP_ANSI( 41 | TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 42 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 43 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ 44 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ 45 | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), 46 | /* 6: Poker Fn 47 | * ,-----------------------------------------------------------. 48 | * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | 49 | * |-----------------------------------------------------------| 50 | * | |FnQ| Up| | | | | | |Cal| |Hom|Ins|FnL | 51 | * |-----------------------------------------------------------| 52 | * | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| | 53 | * |-----------------------------------------------------------| 54 | * | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| | 55 | * |-----------------------------------------------------------| 56 | * | | | | FnS | | | | | 57 | * `-----------------------------------------------------------' 58 | * Fn: to Fn overlay 59 | * FnL: to Layout selector overaly 60 | * FnQ: toggle Esc overlay 61 | * FnS: toggle Arrow overlay 62 | */ 63 | KEYMAP_ANSI( 64 | GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \ 65 | TRNS,FN2, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, FN4, \ 66 | TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \ 67 | TRNS,DEL, TRNS,WHOM,MUTE,VOLD,VOLU,MPLY,MPRV,MNXT,MSTP, TRNS, \ 68 | TRNS,TRNS,TRNS, FN1, TRNS,DOWN,LEFT,RIGHT), 69 | /* 7: Layout selector 70 | * ,-----------------------------------------------------------. 71 | * | Lq| Lc| Ld| Lw| | | | | | | | | | | 72 | * |-----------------------------------------------------------| 73 | * | |Lq |Lw | | | | | | | | | | | | 74 | * |-----------------------------------------------------------| 75 | * | | | |Ld | | | | | | | | | | 76 | * |-----------------------------------------------------------| 77 | * | | | |Lc | | | | | | | | | 78 | * |-----------------------------------------------------------| 79 | * | | | | | | | | | 80 | * `-----------------------------------------------------------' 81 | * Lq: set Qwerty layout 82 | * Lc: set Colemak layout 83 | * Ld: set Dvorak layout 84 | * Lw: set Workman layout 85 | */ 86 | KEYMAP_ANSI( 87 | TRNS, FN6, FN7, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 88 | TRNS,FN5, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ 89 | TRNS,TRNS,TRNS,FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ 90 | TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ 91 | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), 92 | }; 93 | const uint16_t PROGMEM fn_actions[] = { 94 | /* Poker Layout */ 95 | [0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay 96 | [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay 97 | [2] = ACTION_LAYER_TOGGLE(5), // toggle Esc overlay 98 | [3] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // Task(RControl,RShift+Esc) 99 | [4] = ACTION_LAYER_MOMENTARY(7), // to Layout selector 100 | [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout 101 | [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout 102 | [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout 103 | [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout 104 | }; 105 | 106 | #ifdef KEYMAP_IN_EEPROM_ENABLE 107 | uint16_t keys_count(void) { 108 | return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS; 109 | } 110 | 111 | uint16_t fn_actions_count(void) { 112 | return sizeof(fn_actions) / sizeof(fn_actions[0]); 113 | } 114 | #endif -------------------------------------------------------------------------------- /golangdev/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ENV GOPATH="/go" PATH="/go/bin:/usr/local/go/bin:$PATH:/usr/local/node/bin/" TZ=Asia/Shanghai 4 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &&\ 5 | apt-get update &&\ 6 | apt-get install -y --no-install-recommends telnet dnsutils mercurial build-essential curl git m4 texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev zip unzip locales xfonts-utils fontconfig ctags cmake libc6-dev pkg-config libelf1 wget iputils-ping software-properties-common ninja-build gettext libtool libtool-bin autotools-dev automake sudo python3-pip python3-setuptools ssh-client supervisor nginx tmux screen openssh-server ack-grep python3-dev &&\ 7 | mkdir /go && mkdir /var/run/sshd && chmod 0755 /var/run/sshd &&\ 8 | wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz && tar xf node-v14.15.4-linux-x64.tar.xz && mv node-v14.15.4-linux-x64 /usr/local/node && rm node-v14.15.4-linux-x64.tar.xz && \ 9 | wget https://github.com/krallin/tini/releases/download/v0.19.0/tini-amd64 -O /bin/tini && chmod +x /bin/tini &&\ 10 | wget https://github.com/neovim/neovim/archive/v0.4.4.tar.gz && tar xf v0.4.4.tar.gz && rm v0.4.4.tar.gz && cd neovim-0.4.4 && mkdir .deps && cd .deps && cmake ../third-party/ && make -j8 && cd .. && mkdir build && cd build && cmake .. && make -j8 && make install && cd / && rm -rf /neovim-0.4.4/ &&\ 11 | curl -fsSL "https://dl.google.com/go/go1.15.8.linux-amd64.tar.gz" -o golang.tar.gz \ 12 | && echo "d3379c32a90fdf9382166f8f48034c459a8cc433730bc9476d39d9082c94583b golang.tar.gz" | sha256sum -c - \ 13 | && tar -C /usr/local -xzf golang.tar.gz \ 14 | && rm golang.tar.gz &&\ 15 | curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim &&\ 16 | curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/.vimrc -o ~/.vimrc &&\ 17 | curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/.bashrc -o ~/.bashrc &&\ 18 | mkdir -p ~/.config && mkdir -p /root/.vim/ &&\ 19 | ln -s /root/.vim /root/.config/nvim &&\ 20 | ln -s /root/.vimrc /root/.vim/init.vim &&\ 21 | curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/coc-settings.json -o /root/.config/nvim/coc-settings.json &&\ 22 | mkdir -p ~/.vim/colors/ &&\ 23 | npm install --global yarn &&\ 24 | npm install -g neovim &&\ 25 | pip3 install neovim --upgrade && nvim -i NONE -c PlugInstall! -c quitall &&\ 26 | nvim +GoInstallBinaries +qall &&\ 27 | echo "en_US.UTF-8 UTF-8" > /etc/locale.gen &&\ 28 | locale-gen "en_US.UTF-8"&& mkdir ~/.fonts/ &&\ 29 | cd ~/.fonts/ &&\ 30 | git clone https://github.com/eugeii/consolas-powerline-vim.git &&\ 31 | cd consolas-powerline-vim/ &&\ 32 | cp *.ttf .. &&\ 33 | cd .. &&\ 34 | rm -rf consolas-powerline-vim/ &&\ 35 | mkfontscale &&\ 36 | mkfontdir &&\ 37 | fc-cache -vf 38 | 39 | ENTRYPOINT ["/bin/tini", "--"] 40 | CMD ["/usr/bin/sleep", "200d"] 41 | -------------------------------------------------------------------------------- /mesos/docker-systemd/docker.service: -------------------------------------------------------------------------------- 1 | Description=Docker Application Container Engine 2 | Documentation=https://docs.docker.com 3 | After=network.target docker.socket 4 | Requires=docker.socket 5 | 6 | [Service] 7 | Type=notify 8 | EnvironmentFile=/run/flannel/subnet.env 9 | # the default is not to use systemd for cgroups because the delegate issues still 10 | # exists and systemd currently does not support the cgroup feature set required 11 | # for containers run by docker 12 | ExecStart=/usr/bin/docker daemon --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} 13 | MountFlags=slave 14 | LimitNOFILE=1048576 15 | LimitNPROC=1048576 16 | LimitCORE=infinity 17 | TimeoutStartSec=0 18 | # set delegate yes so that systemd does not reset the cgroups of docker containers 19 | Delegate=yes 20 | 21 | [Install] 22 | WantedBy=multi-user.target 23 | -------------------------------------------------------------------------------- /mesos/docker-systemd/system-docker.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Application Container Engine 3 | Documentation=https://docs.docker.com 4 | After=network.target system-docker.socket 5 | Requires=system-docker.socket 6 | 7 | [Service] 8 | Type=notify 9 | # the default is not to use systemd for cgroups because the delegate issues still 10 | # exists and systemd currently does not support the cgroup feature set required 11 | # for containers run by docker 12 | ExecStart=/usr/bin/docker daemon --exec-root=/var/run/system-docker -H unix:///var/run/system-docker.sock -p /var/run/system-docker.pid -g /var/lib/system-docker/ 13 | MountFlags=slave 14 | LimitNOFILE=1048576 15 | LimitNPROC=1048576 16 | LimitCORE=infinity 17 | TimeoutStartSec=0 18 | # set delegate yes so that systemd does not reset the cgroups of docker containers 19 | Delegate=yes 20 | 21 | [Install] 22 | WantedBy=multi-user.target 23 | -------------------------------------------------------------------------------- /mesos/docker-systemd/system-docker.socket: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Socket for the API 3 | PartOf=system-docker.service 4 | 5 | [Socket] 6 | ListenStream=/var/run/system-docker.sock 7 | SocketMode=0660 8 | SocketUser=root 9 | SocketGroup=docker 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /mesos/master.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | set -x 3 | docker run --rm -v /opt/:/data/ afafaf.newb.xyz/zookeeper:3.3.6 4 | docker run --rm -v /opt/:/data/ afafaf.newb.xyz/etcd:2.3.7 5 | docker run --rm -v /opt/:/data/ afafaf.newb.xyz/mesos:0.28.2 6 | docker run --rm -v /opt/:/data/ afafaf.newb.xyz/marathon:1.1.1 7 | docker run --rm -v /opt/:/data/ afafaf.newb.xyz/jdk:8u91 8 | 9 | echo "Now instal" 10 | 11 | mkdir -p /opt/etcd-2.3.7 12 | mv /opt/etcd /opt/etcd-2.3.7 13 | mv /opt/etcdctl /opt/etcd-2.3.7 14 | cd /opt 15 | tar xf jdk-8u91-linux-x64.tar.gz 16 | tar xf marathon-1.1.1.tgz 17 | tar xf mesos-0.28.2.tar.gz 18 | tar xf zookeeper-3.3.6.tar.gz 19 | rm jdk-8u91-linux-x64.tar.gz marathon-1.1.1.tgz mesos-0.28.2.tar.gz zookeeper-3.3.6.tar.gz 20 | -------------------------------------------------------------------------------- /mesos/mesos-flannel-slave.sh: -------------------------------------------------------------------------------- 1 | # Config 2 | REG=docker.elenet.me/jianying.li 3 | ##REG=index.alauda.cn/philo 4 | ##REG=afafaf.newb.xyz 5 | HostIP=192.168.56.101 6 | #HostIP=192.168.81.110 7 | IFACE=eth0 8 | 9 | ZKID=1 10 | ZKIPS=$HostIP 11 | ETCDNAME=etcd0 12 | ETCDCLUSTER='etcd0=http://$HostIP:2380' 13 | 14 | # systemd: 15 | 16 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/docker.service -O /usr/lib/systemd/system/docker.service 17 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/system-docker.service -O /usr/lib/systemd/system/system-docker.service 18 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/system-docker.socket -O /usr/lib/systemd/system/system-docker.socket 19 | 20 | # start system-docker 21 | systemctl daemon-reload 22 | systemctl restart system-docker 23 | 24 | 25 | # deploy flannel: 26 | 27 | docker -H unix:///var/run/system-docker.sock pull $REG/flannel:0.5.5 28 | docker -H unix:///var/run/system-docker.sock tag $REG/flannel:0.5.5 flannel:0.5.5 29 | 30 | #runflannel: 31 | 32 | docker -H unix:///var/run/system-docker.sock run --name flannel -it -d -v /run/flannel/:/run/flannel/ --net=host --privileged flannel:0.5.5 /opt/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints="http://$HostIP:4001,http://$HostIP:2379" 33 | 34 | # run user-docker 35 | systemctl restart docker 36 | 37 | # run mesos-slave 38 | 39 | docker -H unix:///var/run/system-docker.sock run -d \ 40 | -e MESOS_HOSTNAME=$HostIP \ 41 | -e MESOS_IP=$HostIP \ 42 | -e MESOS_MASTER=zk://$HostIP:2181,$HostIP:2181/mesos \ 43 | -v /sys/fs/cgroup:/sys/fs/cgroup \ 44 | -v /root/:/root/ \ 45 | -v /var/run/docker.sock:/var/run/docker.sock \ 46 | --name mesos-slave --net host --privileged --restart always \ 47 | $REG/mesos-slave:0.28.1-centos-7 48 | 49 | -------------------------------------------------------------------------------- /mesos/mesos-flannel.sh: -------------------------------------------------------------------------------- 1 | # Config 2 | REG=docker.elenet.me/jianying.li 3 | ##REG=index.alauda.cn/philo 4 | ##REG=afafaf.newb.xyz 5 | HostIP=192.168.56.101 6 | #HostIP=192.168.81.110 7 | IFACE=eth0 8 | 9 | ZKID=1 10 | ZKIPS=$HostIP 11 | ETCDNAME=etcd0 12 | ETCDCLUSTER='etcd0=http://$HostIP:2380' 13 | 14 | # systemd: 15 | 16 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/docker.service -O /usr/lib/systemd/system/docker.service 17 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/system-docker.service -O /usr/lib/systemd/system/system-docker.service 18 | wget https://raw.githubusercontent.com/lijianying10/FixLinux/master/mesos/docker-systemd/system-docker.socket -O /usr/lib/systemd/system/system-docker.socket 19 | 20 | # start system-docker 21 | systemctl daemon-reload 22 | systemctl restart system-docker 23 | 24 | # get-etcd: 25 | docker -H unix:///var/run/system-docker.sock pull $REG/etcd:2.3.7 26 | docker -H unix:///var/run/system-docker.sock tag $REG/etcd:2.3.7 etcd:2.3.7 27 | 28 | 29 | #system-docker-etcd: 30 | 31 | 32 | docker -H unix:///var/run/system-docker.sock run -it --net=host --privileged -d --name etcd etcd:2.3.7\ 33 | /etcd -name etcd0 \ 34 | -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ 35 | -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ 36 | -initial-advertise-peer-urls http://${HostIP}:2380 \ 37 | -listen-peer-urls http://0.0.0.0:2380 \ 38 | -initial-cluster-token etcd-cluster-1 \ 39 | -initial-cluster etcd0=http://${HostIP}:2380 \ 40 | -initial-cluster-state new 41 | 42 | # deploy flannel: 43 | 44 | docker -H unix:///var/run/system-docker.sock pull $REG/flannel:0.5.5 45 | docker -H unix:///var/run/system-docker.sock tag $REG/flannel:0.5.5 flannel:0.5.5 46 | 47 | # Add flannel subnet: 48 | docker -H unix:///var/run/system-docker.sock exec -it etcd /etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' 49 | 50 | #docker -H unix:///var/run/system-docker.sock run -it --rm --net=host etcd:2.3.7 /etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' 51 | 52 | #curl -L -X PUT http://127.0.0.1:2379/v2/keys/coreos.com/network/config -d value='{ "Network": "10.1.0.0/16" }' 53 | 54 | #runflannel: 55 | 56 | docker -H unix:///var/run/system-docker.sock run --name flannel -it -d -v /run/flannel/:/run/flannel/ --net=host --privileged flannel:0.5.5 /opt/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints="http://$HostIP:4001,http://$HostIP:2379" 57 | 58 | 59 | #run zk 60 | docker -H unix:///var/run/system-docker.sock run -d -it \ 61 | -e MYID=$ZKID \ 62 | -e SERVERS=$ZKIPS \ 63 | -v /var/lib/zookeeper:/root/zookeeperbackup \ 64 | --name=zookeeper --net=host --privileged --restart=always $REG/zookeeper:3.4.7-centos-7 65 | 66 | # run Mesos 67 | 68 | docker -H unix:///var/run/system-docker.sock run -d \ 69 | -e MESOS_HOSTNAME=$HostIP \ 70 | -e MESOS_IP=$HostIP \ 71 | -e MESOS_QUORUM=1 \ 72 | -e MESOS_ZK=zk://$HostIP:2181,$HostIP:2181/mesos \ 73 | --name mesos-master --net host --privileged --restart always $REG/mesos-master:0.28.1-centos-7 74 | 75 | #run marathon 76 | 77 | docker -H unix:///var/run/system-docker.sock run -d \ 78 | -e MARATHON_HOSTNAME=$HostIP \ 79 | -e MARATHON_HTTPS_ADDRESS=$HostIP \ 80 | -e MARATHON_HTTP_ADDRESS=$HostIP \ 81 | -e MARATHON_MASTER=zk://$HostIP:2181,$HostIP:2181/mesos \ 82 | -e MARATHON_ZK=zk://$HostIP:2181,$HostIP:2181/mesos \ 83 | --name marathon --net host --privileged --restart always $REG/marathon:1.1.1-centos-7 84 | 85 | # run user-docker 86 | systemctl restart docker 87 | 88 | # run mesos-slave 89 | 90 | docker -H unix:///var/run/system-docker.sock run -d \ 91 | -e MESOS_HOSTNAME=$HostIP \ 92 | -e MESOS_IP=$HostIP \ 93 | -e MESOS_MASTER=zk://$HostIP:2181,$HostIP:2181/mesos \ 94 | -v /sys/fs/cgroup:/sys/fs/cgroup \ 95 | -v /root/:/root/ \ 96 | -v /var/run/docker.sock:/var/run/docker.sock \ 97 | --name mesos-slave --net host --privileged --restart always \ 98 | $REG/mesos-slave:0.28.1-centos-7 99 | 100 | # run in single docker 101 | 102 | #docker -H unix:///var/run/system-docker.sock run -d \ 103 | #-v /sys/fs/cgroup:/sys/fs/cgroup \ 104 | #-v /var/run/docker.sock:/var/run/docker.sock \ 105 | #--name marathon --net host --privileged --restart always \ 106 | #$REG/mesos-single-docker:1 107 | 108 | cat > /root/dns.cfg < /root/dns.json << EOF 135 | { 136 | "cmd": "/root/mesos-dns -config=/root/dns.cfg", 137 | "cpus": 0.3, 138 | "mem": 128, 139 | "id": "mesos-dns", 140 | "instances": 1, 141 | "constraints": [["hostname", "CLUSTER", "$HostIP"]] 142 | } 143 | EOF 144 | 145 | chmod +x mesos-dns 146 | curl -i -H 'Content-Type: application/json' -d @dns.json http://$HostIP:8080/v2/apps 147 | 148 | -------------------------------------------------------------------------------- /mesos/mesos-systemd/multinode/gen.py: -------------------------------------------------------------------------------- 1 | import sys 2 | MasterHost= '192.168.122.86,192.168.122.87,192.168.122.88' 3 | SlaveHosts= '192.168.122.89'.split(',') 4 | MasterHosts=MasterHost.split(',') 5 | 6 | QUORUM=0 7 | 8 | if len(MasterHosts)==1: 9 | QUORUM=1 10 | 11 | if len(MasterHosts)==3: 12 | QUORUM=2 13 | 14 | if len(MasterHosts)==5: 15 | QUORUM=3 16 | 17 | if QUORUM==0: 18 | print "Humber master host error" 19 | sys.exit(1) 20 | 21 | idx=0 22 | ETCDCLUSTER='' 23 | ETCDENDPOINTS='' 24 | ZKP='' 25 | for HostIP in MasterHosts: 26 | ETCDCLUSTER+="etcd"+str(idx)+"=http://"+HostIP+":2380," 27 | ETCDENDPOINTS+="http://"+HostIP+":4001,http://"+HostIP+":2379," 28 | ZKP+=HostIP+":2181," 29 | idx+=1 30 | ETCDCLUSTER = ETCDCLUSTER[0:-1] 31 | ETCDENDPOINTS= ETCDENDPOINTS[0:-1] 32 | ZKP= "zk://"+ZKP[0:-1]+"/mesos" 33 | 34 | SlaveScript=open("slave.sh",'r').read() 35 | MasterScript=open("master.sh",'r').read() 36 | 37 | def Gen(ip,script,ix,ismaster): 38 | RES="" 39 | if ismaster: 40 | RES+="NUMHOSTS='"+str(len(MasterHosts)) + "'\n" 41 | RES+="ZKID='"+str(ix+1)+"'\n" 42 | RES+="ETCDNAME='etcd"+str(ix)+"'\n" 43 | RES+="ZKP='"+ZKP+"'\n" 44 | RES+="HostIP='"+ip+"'\n" 45 | RES+="QUORUM='"+str(QUORUM)+"'\n" 46 | RES+="ZKIPS='" + MasterHost + "'\n" 47 | RES+="ETCDCLUSTER='"+ETCDCLUSTER+"'\n" 48 | RES+="ETCDENDPOINTS='"+ETCDENDPOINTS+"'\n" 49 | RES+="set -x\n" 50 | RES+="set -e\n" 51 | open('out/'+ip+'.sh','w').write(RES+script) 52 | 53 | idxm=0 54 | for HostIP in MasterHosts: 55 | Gen(HostIP,MasterScript,idxm,1) 56 | idxm+=1 57 | 58 | idx=0 59 | for HostIP in SlaveHosts: 60 | Gen(HostIP,SlaveScript,idx,0) 61 | idx+=1 62 | 63 | 64 | RES="" 65 | for HostIP in MasterHosts+SlaveHosts: 66 | RES+="scp "+HostIP+".sh root@"+HostIP+":install.sh\n" 67 | open('out/scp.sh','w').write(RES) 68 | 69 | -------------------------------------------------------------------------------- /mesos/mesos-systemd/multinode/master.sh: -------------------------------------------------------------------------------- 1 | 2 | set -x 3 | set -e 4 | 5 | IFACE='ens3' 6 | 7 | echo $ZKID > /var/lib/zookeeper/myid 8 | if [ -n "$ZKIPS" ]; then 9 | printf '%s' "$ZKIPS" | awk 'BEGIN { RS = "," }; { printf "server.%i=%s:2888:3888\n", NR, $0 }' >> /etc/zookeeper/conf/zoo.cfg 10 | fi 11 | sudo systemctl restart zookeeper 12 | sleep 3 13 | echo $ZKP >/etc/mesos/zk 14 | echo $QUORUM > /etc/mesos-master/quorum 15 | echo $HostIP > /etc/mesos-master/hostname 16 | echo $HostIP > /etc/mesos-master/ip 17 | echo $HostIP > /etc/mesos-slave/hostname 18 | echo $HostIP > /etc/mesos-slave/ip 19 | echo 'mesos,docker' > /etc/mesos-slave/containerizers 20 | systemctl restart mesos-master 21 | systemctl restart mesos-slave 22 | 23 | cat > /etc/systemd/system/etcd.service << EOF 24 | [Unit] 25 | Description=etcd key-value store 26 | Documentation=https://github.com/coreos/etcd 27 | 28 | [Service] 29 | ExecStart=/bin/etcd -name ${ETCDNAME} \ 30 | -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ 31 | -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ 32 | -initial-advertise-peer-urls http://${HostIP}:2380 \ 33 | -listen-peer-urls http://0.0.0.0:2380 \ 34 | -initial-cluster-token etcd-cluster-1 \ 35 | -initial-cluster $ETCDCLUSTER \ 36 | -initial-cluster-state new 37 | Restart=always 38 | RestartSec=10s 39 | LimitNOFILE=40000 40 | 41 | [Install] 42 | WantedBy=multi-user.target 43 | EOF 44 | 45 | systemctl daemon-reload 46 | systemctl restart etcd 47 | sleep 5 48 | etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' 49 | 50 | 51 | systemctl restart marathon 52 | 53 | cat > /etc/systemd/system/flannel.service << EOF 54 | [Unit] 55 | Description=flannel vlan network 56 | After=network.target docker.socket 57 | 58 | [Service] 59 | ExecStart=/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints=$ETCDENDPOINTS 60 | Restart=always 61 | RestartSec=10s 62 | LimitNOFILE=40000 63 | 64 | [Install] 65 | WantedBy=multi-user.target 66 | EOF 67 | systemctl daemon-reload 68 | systemctl restart flannel 69 | 70 | cat > /usr/lib/systemd/system/docker.service << EOF 71 | Description=Docker Application Container Engine 72 | Documentation=https://docs.docker.com 73 | After=network.target docker.socket 74 | Requires=docker.socket 75 | 76 | [Service] 77 | Type=notify 78 | EnvironmentFile=/run/flannel/subnet.env 79 | # the default is not to use systemd for cgroups because the delegate issues still 80 | # exists and systemd currently does not support the cgroup feature set required 81 | # for containers run by docker 82 | ExecStart=/usr/bin/docker daemon --storage-driver=overlay --log-driver=journald --bip=\${FLANNEL_SUBNET} --mtu=\${FLANNEL_MTU} 83 | MountFlags=slave 84 | LimitNOFILE=1048576 85 | LimitNPROC=1048576 86 | LimitCORE=infinity 87 | TimeoutStartSec=0 88 | # set delegate yes so that systemd does not reset the cgroups of docker containers 89 | Delegate=yes 90 | 91 | [Install] 92 | WantedBy=multi-user.target 93 | EOF 94 | 95 | sleep 2 96 | systemctl daemon-reload 97 | systemctl restart docker -------------------------------------------------------------------------------- /mesos/mesos-systemd/multinode/slave.sh: -------------------------------------------------------------------------------- 1 | 2 | set -x 3 | set -e 4 | 5 | IFACE='ens3' 6 | 7 | echo $ZKP >/etc/mesos/zk 8 | echo $HostIP > /etc/mesos-slave/hostname 9 | echo $HostIP > /etc/mesos-slave/ip 10 | echo 'mesos,docker' > /etc/mesos-slave/containerizers 11 | systemctl restart mesos-slave 12 | 13 | cat > /etc/systemd/system/flannel.service << EOF 14 | [Unit] 15 | Description=flannel vlan network 16 | After=network.target docker.socket 17 | 18 | [Service] 19 | ExecStart=/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints=$ETCDENDPOINTS 20 | Restart=always 21 | RestartSec=10s 22 | LimitNOFILE=40000 23 | 24 | [Install] 25 | WantedBy=multi-user.target 26 | EOF 27 | systemctl daemon-reload 28 | systemctl restart flannel 29 | sleep 2 30 | 31 | cat > /usr/lib/systemd/system/docker.service << EOF 32 | Description=Docker Application Container Engine 33 | Documentation=https://docs.docker.com 34 | After=network.target docker.socket 35 | Requires=docker.socket 36 | 37 | [Service] 38 | Type=notify 39 | EnvironmentFile=/run/flannel/subnet.env 40 | # the default is not to use systemd for cgroups because the delegate issues still 41 | # exists and systemd currently does not support the cgroup feature set required 42 | # for containers run by docker 43 | ExecStart=/usr/bin/docker daemon --storage-driver=overlay --log-driver=journald --bip=\${FLANNEL_SUBNET} --mtu=\${FLANNEL_MTU} 44 | MountFlags=slave 45 | LimitNOFILE=1048576 46 | LimitNPROC=1048576 47 | LimitCORE=infinity 48 | TimeoutStartSec=0 49 | # set delegate yes so that systemd does not reset the cgroups of docker containers 50 | Delegate=yes 51 | 52 | [Install] 53 | WantedBy=multi-user.target 54 | EOF 55 | 56 | sleep 2 57 | systemctl daemon-reload 58 | systemctl restart docker -------------------------------------------------------------------------------- /mesos/mesos-systemd/singlenode/localinstall.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | # CONFIG 4 | 5 | HostIP='172.16.30.65' 6 | IFACE='em1' 7 | 8 | ZKID='1' 9 | ETCDNAME='etcd0' 10 | HostIP='172.16.30.65' 11 | ZKIPS='172.16.30.65' 12 | ETCDCLUSTER='etcd0=http://172.16.30.65:2380' 13 | ETCDENDPOINTS='http://172.16.30.65:4001,http://172.16.30.65:2379' 14 | ZKP='zk://172.16.30.65:2181/mesos' 15 | QUORUM=1 16 | 17 | set -x 18 | set -e 19 | 20 | 21 | echo $HostIP > /etc/mesos-slave/hostname 22 | echo $HostIP > /etc/mesos-master/hostname 23 | echo 'mesos,docker' > /etc/mesos-slave/containerizers 24 | echo $ZKID > /var/lib/zookeeper/myid 25 | sudo systemctl start zookeeper 26 | echo $ZKP >/etc/mesos/zk 27 | echo $QUORUM > /etc/mesos-master/quorum 28 | systemctl start mesos-master 29 | systemctl start mesos-slave 30 | 31 | cat > /etc/systemd/system/etcd.service << EOF 32 | [Unit] 33 | Description=etcd key-value store 34 | Documentation=https://github.com/coreos/etcd 35 | 36 | [Service] 37 | ExecStart=/bin/etcd -name etcd0 \ 38 | -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ 39 | -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ 40 | -initial-advertise-peer-urls http://${HostIP}:2380 \ 41 | -listen-peer-urls http://0.0.0.0:2380 \ 42 | -initial-cluster-token etcd-cluster-1 \ 43 | -initial-cluster $ETCDCLUSTER \ 44 | -initial-cluster-state new 45 | Restart=always 46 | RestartSec=10s 47 | LimitNOFILE=40000 48 | 49 | [Install] 50 | WantedBy=multi-user.target 51 | EOF 52 | 53 | systemctl daemon-reload 54 | systemctl start etcd 55 | sleep 5 56 | etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' 57 | 58 | 59 | 60 | cat > /etc/systemd/system/flannel.service << EOF 61 | [Unit] 62 | Description=flannel vlan network 63 | After=network.target docker.socket 64 | 65 | [Service] 66 | ExecStart=/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints=$ETCDENDPOINTS 67 | Restart=always 68 | RestartSec=10s 69 | LimitNOFILE=40000 70 | 71 | [Install] 72 | WantedBy=multi-user.target 73 | EOF 74 | systemctl daemon-reload 75 | systemctl start flannel 76 | 77 | cat > /usr/lib/systemd/system/docker.service << EOF 78 | Description=Docker Application Container Engine 79 | Documentation=https://docs.docker.com 80 | After=network.target docker.socket 81 | Requires=docker.socket 82 | 83 | [Service] 84 | Type=notify 85 | EnvironmentFile=/run/flannel/subnet.env 86 | # the default is not to use systemd for cgroups because the delegate issues still 87 | # exists and systemd currently does not support the cgroup feature set required 88 | # for containers run by docker 89 | ExecStart=/usr/bin/docker daemon --log-driver=journald --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} 90 | MountFlags=slave 91 | LimitNOFILE=1048576 92 | LimitNPROC=1048576 93 | LimitCORE=infinity 94 | TimeoutStartSec=0 95 | # set delegate yes so that systemd does not reset the cgroups of docker containers 96 | Delegate=yes 97 | 98 | [Install] 99 | WantedBy=multi-user.target 100 | EOF 101 | 102 | 103 | systemctl daemon-reload 104 | systemctl restart docker 105 | -------------------------------------------------------------------------------- /mesos/mesos-systemd/singlenode/netinstall.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | set -e 3 | 4 | #config 5 | 6 | HostIP='192.168.56.112' 7 | IFACE='enp0s3' 8 | 9 | # package install 10 | 11 | sudo rpm -Uvh http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm 12 | sudo yum -y install mesos marathon mesosphere-zookeeper 13 | 14 | ## ETCD install 15 | curl -L https://github.com/coreos/etcd/releases/download/v2.3.7/etcd-v2.3.7-darwin-amd64.zip -o etcd-v2.3.7-darwin-amd64.zip 16 | unzip etcd-v2.3.7-darwin-amd64.zip 17 | cd etcd-v2.3.7-darwin-amd64 18 | mv etcd /bin/ 19 | mv etcdctl /bin/ 20 | 21 | cd .. 22 | wget https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz 23 | tar xf flannel-0.5.5-linux-amd64.tar.gz 24 | cd flannel-0.5.5-linux-amd64 25 | mv flanneld /bin/ 26 | 27 | echo $HostIP > /etc/mesos-slave/hostname 28 | echo 'mesos,docker' > /etc/mesos-slave/containerizers 29 | echo 1 > /var/lib/zookeeper/myid 30 | sudo systemctl start zookeeper 31 | echo zk://$HostIP:2181/mesos >/etc/mesos/zk 32 | echo 1 > /etc/mesos-master/quorum 33 | systemctl start mesos-master 34 | systemctl start mesos-slave 35 | 36 | cat > /etc/systemd/system/etcd.service << EOF 37 | [Unit] 38 | Description=etcd key-value store 39 | Documentation=https://github.com/coreos/etcd 40 | 41 | [Service] 42 | ExecStart=/bin/etcd -name etcd0 \ 43 | -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \ 44 | -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ 45 | -initial-advertise-peer-urls http://${HostIP}:2380 \ 46 | -listen-peer-urls http://0.0.0.0:2380 \ 47 | -initial-cluster-token etcd-cluster-1 \ 48 | -initial-cluster etcd0=http://${HostIP}:2380 \ 49 | -initial-cluster-state new 50 | Restart=always 51 | RestartSec=10s 52 | LimitNOFILE=40000 53 | 54 | [Install] 55 | WantedBy=multi-user.target 56 | EOF 57 | 58 | systemctl daemon-reload 59 | systemctl start etcd 60 | sleep 2 61 | etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' 62 | 63 | cat > /etc/systemd/system/flannel.service << EOF 64 | [Unit] 65 | Description=flannel vlan network 66 | After=network.target docker.socket 67 | 68 | [Service] 69 | ExecStart=/bin/flanneld --ip-masq=true --iface=$IFACE -etcd-endpoints=$ETCDENDPOINTS 70 | Restart=always 71 | RestartSec=10s 72 | LimitNOFILE=40000 73 | 74 | [Install] 75 | WantedBy=multi-user.target 76 | EOF 77 | 78 | systemctl daemon-reload 79 | systemctl start flannel 80 | 81 | cat > /usr/lib/systemd/system/docker.service << EOF 82 | Description=Docker Application Container Engine 83 | Documentation=https://docs.docker.com 84 | After=network.target docker.socket 85 | Requires=docker.socket 86 | 87 | [Service] 88 | Type=notify 89 | EnvironmentFile=/run/flannel/subnet.env 90 | # the default is not to use systemd for cgroups because the delegate issues still 91 | # exists and systemd currently does not support the cgroup feature set required 92 | # for containers run by docker 93 | ExecStart=/usr/bin/docker daemon --log-driver=journald --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU} 94 | MountFlags=slave 95 | LimitNOFILE=1048576 96 | LimitNPROC=1048576 97 | LimitCORE=infinity 98 | TimeoutStartSec=0 99 | # set delegate yes so that systemd does not reset the cgroups of docker containers 100 | Delegate=yes 101 | 102 | [Install] 103 | WantedBy=multi-user.target 104 | EOF 105 | 106 | 107 | systemctl daemon-reload 108 | systemctl restart docker 109 | -------------------------------------------------------------------------------- /mesos/repush.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "docker tag $2/$1 $3/$1" 3 | echo "docker push $3/$1" 4 | 5 | 6 | -------------------------------------------------------------------------------- /mesos/slave.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/mesos/slave.sh -------------------------------------------------------------------------------- /note/779MGO设计调优.md: -------------------------------------------------------------------------------- 1 | #MGO 设计调优。 2 | > 真的是那句话,不是你不行,知识你不了解。而已。 3 | 4 | 5 | 1. 肯定是不能加两个索引了。 6 | 1. 索引的代价实在是太大了,不但占用内存还还大量损失查询性能,真心不能忍耐啊。 7 | 1. 设计的时候DBRef肯定是需要的,直接用有意义的ID查询肯定是性能最好的。 8 | 1. 控制key的数量肯定是必须的。比如说用户数量就是key的数量这就够了。别整那么多。collection不然损失性能。 9 | 1. 如果真的想控制数量的话,那么数据关联肯定是十分必须的。 10 | 1. 流量控制肯定也是必须的。 11 | 1. 流量的来源在于Find直接返回所有查询结果。卧槽。直接吃掉所有流量。 12 | 1. 直接用FindOne 避免查询多个结果回来肯定是必须的 13 | 1. FindOne就够了吗?我确实遇到这个坑了。在[博文](http://www.cnblogs.com/crazylights/archive/2013/05/08/3068098.html)中已经提到关于这种情况适用filter的方法了。直接参考就OK了。 14 | ```js 15 | FindOne({_id:xxx},{Items:{"$slice":[3,1]}}) 16 | ``` 17 | > 虽然适用了这种方法来设计,使得查询结果减少流量降低了。但是依然存在问题 18 | 1. 一定更要注意,不能直接dbref因为slice不好加啊。可以用过顺序id加分页,或者算时间。233 很实用,典型的用空间换时间。 19 | 20 | ```js 21 | db.user.findOne({user_id:2}, {"book.price":1,"book.price.":{$slice:[-10,4]}}) 22 | 23 | 解释下其含义哈: 24 | 1. user集合 25 | 2. user.book.price 表示用户拥有书籍, 书籍呢有很多价格列表 26 | 3. 注意红色字体 "book.price." 末尾必须有个点 27 | 4. 查找价格列表里的4条数据, 从右边第10个位置开始便宜 28 | ``` 29 | 但是也有不同的语法说明,到时候试试吧。 30 | 31 | 1. update 要做精细修改。 32 | 33 | 34 | ```go 35 | 比如Update({_id:xxx},{$set:{"Items.3.Item.Health":38}});//修改第三把武器的健康值 36 | ``` 37 | 38 | > 至于一次修改和批量修改,MongoDB默认100ms flush一次(2.x),只要两次修改比较贴近,被一起保存的可能性很高。 39 | 40 | 上面这些是引用别人说的话,还是全要直接精细修改,然后数据库会自动一起修改的,性能不成问题 41 | 42 | 1. 最后几点注意 43 | 1. 控制io(系统吞吐)这事整个系统的核心,也是系统性能的核心。 44 | 2. 控制内存(不要让index膨胀) 45 | 1. 控制index个数, 46 | 1. 控制key的个数 47 | 3. CPU控制不要让js做大量的计算,能迁移到客户端的计算就迁移到客户端,让他们算完之后在通讯 48 | 4. 第一个性能不够的估计是硬盘,可以通过RAID或者企业级SSD搞定整个问题。 49 | 50 | ## Golang MGO驱动使用 51 | 52 | [ref1](http://golangtc.com/t/53d0d2e1320b525265000052) 53 | 54 | [ref2](http://jimmykuu.sinaapp.com/static/books/mgo_guide/index.html) 55 | -------------------------------------------------------------------------------- /note/788MongoDB存储过程性能调优.md: -------------------------------------------------------------------------------- 1 | #MongoDB 存储过程的使用以及性能调优方案。 2 | AUTH:PHILO 3 | > [在2012年的一个blog里面看到了一个关于性能问题](在2012年的一个blog里面看到了一个关于性能问题) 4 | 5 | 虽然MongoDB给了我们很多驱动可以用,但是都没有mongodb的shell来的方便。 6 | 就比如说最近需要做的DBRef嵌套类型的数据要做CRUD如果使用mog驱动的话会非常麻烦。 7 | 因此我们这里来做个试验,首先给`test`数据库添加初始化数据添加Server-side script 8 | 以及测试 9 | 10 | ## mongo 添加数据 11 | 12 | ```js 13 | db.people.insert({"_id":"test","phone","233333"}) //输入原始数据 14 | 15 | 16 | // 数据库修改函数 17 | // update之后返回修改后的数据。 18 | peopleUpdate=function(id,phone){ 19 | db.people.update({ 20 | "_id":id, 21 | },{$set:{ 22 | phone:phone 23 | }}); 24 | return db.people.findOne({"_id":id}); 25 | } 26 | 27 | //添加数据库函数 28 | db.system.js.insert({"_id":"peopleUpdatePhone","value": peopleUpdate }); 29 | // 修改数据库函数 30 | db.system.js.update({"_id":"peopleUpdatePhone"},{$set:{"value": peopleUpdate }}) 31 | //执行数据库函数 32 | db.eval("peopleUpdatePhone('test','23333test')") 33 | 34 | ``` 35 | 测试之后在mongo shell里面是ok的。 36 | 37 | ## golang 调用函数并返回 38 | ``` 39 | package main 40 | 41 | import ( 42 | "labix.org/v2/mgo" 43 | "labix.org/v2/mgo/bson" 44 | ) 45 | 46 | func main() { 47 | session, err := mgo.Dial("") 48 | if err != nil { 49 | panic(err) 50 | } 51 | defer session.Close() 52 | 53 | session.SetMode(mgo.Monotonic, true) 54 | 55 | db := session.DB("test") 56 | var result interface{} 57 | db.Run(bson.M{"eval": "peopleUpdatePhone('test','new test');"},&result) 58 | } 59 | ``` 60 | 61 | 如上面代码所示,就可以执行修改了。 62 | 但是要注意[锁的问题](http://francs3.blog.163.com/blog/static/405767272012112811268129/):eval会产生写入锁。结果你懂得。 63 | 64 | ## 性能测试。 65 | > 我直接测试了调用main函数10000次 66 | 67 | 1. eval 68 | 1. 在测试中eval表现不佳,因为会锁库。 69 | 1. 顺便吐槽一下mongodb的锁那真的是相当的大。 70 | 1. 最后测试我每等到结果,甚至有几次修改一次要用4秒钟。(因为之前的锁没打开。) 71 | 1. runCommand 72 | 1. 会快很多很多 73 | 1. 2w次update同一个key的操作大概是3s。 74 | 75 | 76 | 77 | ##总结 78 | 1. 我用的是MBP MGX82 79 | 2. 虽然性能不是很好(跟MYSql还是差很多)但是以及够支持一般的应用了 80 | 3. 不是MongoDB不暴力,仅仅是因为我不懂而已。 81 | 82 | 83 | -------------------------------------------------------------------------------- /note/790heredocJS多行字符串.md: -------------------------------------------------------------------------------- 1 | 2 | function heredoc(fn) { 3 | return fn.toString().split('\n').slice(1,-1).join('\n') + '\n' 4 | } 5 | 6 | var tmpl = heredoc(function(){/* 7 | !!! 5 8 | html 9 | include header 10 | body 11 | //if IE 6 12 | .alert.alert-error 13 | center 对不起,我们不支持IE6,请升级你的浏览器 14 | a(href="http://windows.microsoft.com/zh-CN/internet-explorer/download-ie") | IE8官方下载 15 | a(href="https://www.google.com/intl/en/chrome/browser/") | Chrome下载 16 | include head 17 | .container 18 | .row-fluid 19 | .span8 20 | block main 21 | include pagerbar 22 | .span4 23 | include sidebar 24 | include footer 25 | include script 26 | */}); 27 | -------------------------------------------------------------------------------- /note/AboutRancherOS.md: -------------------------------------------------------------------------------- 1 | 0.4.1 以及之前一个版本的RC可以通过这样添加不安全REPO: 2 | 3 | ros c set rancher.docker.args '[daemon, --log-opt, max-size=25m, --log-opt, max-file=2, -s, overlay, -G,docker, -H, 'unix:///var/run/docker.sock', --userland-proxy=false,--insecure-registry,c.reg:5000]' 4 | 5 | 重启不会丢失。 6 | 7 | -------------------------------------------------------------------------------- /note/AndroidAutoBuild.md: -------------------------------------------------------------------------------- 1 | http://developer.android.com/intl/pt-br/tools/building/building-cmdline.html#ReleaseMode 2 | http://developer.android.com/intl/pt-br/tools/publishing/app-signing.html 3 | http://developer.android.com/intl/pt-br/tools/help/proguard.html 4 | -------------------------------------------------------------------------------- /note/DatatablesNote.md: -------------------------------------------------------------------------------- 1 | # datatables (datatables.net) 2 | dt 是非常常见的数据控件但是好用的开源的可以商业化的真心不多 3 | 但是这个就是一个非常灵活的demo。 4 | 5 | 参考: 6 | [javascript as data source](http://www.datatables.net/examples/data_sources/js_array.html) 7 | 8 | ## 数据刷新: 9 | 10 | ### initial情况参考: 11 | ```javascript 12 | $('#example').dataTable( { 13 | "destroy": true,//如果需要重新加载的时候请加上这个 14 | "data": dataSet, 15 | "columns": [ 16 | { "title": "Engine" }, 17 | { "title": "Browser" }, 18 | { "title": "Platform" }, 19 | { "title": "Version", "class": "center" }, 20 | { "title": "Grade", "class": "center" } 21 | ] 22 | } ); 23 | ``` 24 | 加上上面注释的数据主要是因为DT不可以reinitial 25 | 26 | # 2014年12月1日补充 27 | 28 | 还总是有那么几列不听话什么的。 29 | 宽度上很不好看 30 | ```javascript 31 | $('#example').dataTable( { 32 | "autoWidth": true, 33 | "data": dataset, 34 | "columns": [ 35 | { "title": "index","width": "5%" }, 36 | { "title": "guid" }, 37 | { "title": "file" }, 38 | { "title": "Version"}, 39 | { "title": "author" } 40 | ] 41 | } ); 42 | ``` 43 | 44 | -------------------------------------------------------------------------------- /note/GitMultRemote.md: -------------------------------------------------------------------------------- 1 | # git添加多个repo 2 | 3 | ```bash 4 | git remote add coding pathTogit.git 5 | git push coding 6 | ``` 7 | 第一句是添加远端镜像, coding是名字,后面的parameter是地址 8 | 别忘了在push的时候加上参数就行了 9 | -------------------------------------------------------------------------------- /note/GolangWebManual.md: -------------------------------------------------------------------------------- 1 | #Golang web 代码COPY手册 2 | 我们从来都不开发代码,我们只是代码的搬运工。 3 | **-- 阿飞** 4 | 5 | 希望大家都变卡卡西。 **--啊贱** 6 | 7 | 大家copy愉快,文档只做参考。不行的地方别忘了给我发issue。 8 | 9 | ## golang web 开发check list 10 | ### 本章节提供golang web开发的知识面参考。 11 | 1. 基础知识全部略过,包含内容: 12 | 1. 流程控制 13 | 2. OOP 14 | 3. 基础语法知识 15 | 1. 路由器 16 | 1. 手动路由 17 | 2. 自动路由 18 | 2. 页面加载 19 | 1. 纯静态页面(推荐,前后分离,工程好做。) 20 | 2. 模板页面(gtpl模板,浪费cpu以及调试困难等因素还是算了) 21 | 1. 表示层脚本(JS) 22 | 1. require.js 23 | 2. jquery 24 | 1. 业务层 25 | 1. Get 26 | 3. post 27 | 3. 资源获取url 28 | 1. 持久层 29 | 1. 框架 30 | 1. Mysql 31 | 1. MongoDB 32 | 1. 数据库参考 33 | 1. 设计参考 34 | 1. 持久层驱动下载 35 | 1. 单元测试注意事项 36 | 37 | ## 路由器 38 | > 路由器是整个网站对外的灵魂,如果路由做的不好URL会非常恶心。 39 | 所以这部分设计成第一个要说的内容。 40 | 41 | > 路由分两种一种是手动路由为了通过tul调度固定的功能,另外一点就是资源 42 | 的获取,通过url的分析来模仿静态页的方式来获取资源(类似get) 43 | 44 | > 自动路由,主要使用OOP的COMMAND模式来实现。所有功能使用post, 45 | 统一入口,方便权限管理,安全管理,跨域管理。 46 | 47 | ### 手动路由 48 | 49 | ```go 50 | package main 51 | 52 | import ( 53 | "log" 54 | "net/http" 55 | ) 56 | 57 | func main() { 58 | RouterBinding() // 路由绑定函数 59 | err := http.ListenAndServe(":9090", nil) //设置监听的端口 60 | if err != nil { 61 | log.Fatal("ListenAndServe: ", err) 62 | } 63 | } 64 | 65 | ``` 66 | 在httpserver运行之前先绑定路由 67 | 68 | #### 手动路由的绑定 69 | 1. 静态文件 70 | ```go 71 | http.Handle("/pages/", http.StripPrefix("/pages/", http.FileServer(http.Dir("./pages")))) 72 | ``` 73 | 1. 固定函数与资源获取 74 | 75 | 他们都是一样的 76 | ```go 77 | http.HandleFunc("/images/", fileUpload.DownloadPictureAction) 78 | ``` 79 | 80 | 81 | ### 自动路由 82 | > TODO:坑 83 | 84 | 85 | ## 页面加载 86 | 1. 纯静态页(HTML) 87 | > 直接交给路由就行了。自动就访问那个文件夹了。其他功能再补充吧。 88 | 主要好处前后分离,能上CDN就是通讯次数多了。不过通过优化改善之类的都还ok啦。 89 | 90 | 2. 模板页面的加载 91 | 92 | ```go 93 | commonPage, err := template.ParseFiles("pages/common/head.gtpl", //加载模板 94 | "pages/common/navbar.gtpl", "pages/common/tail.gtpl") 95 | if err != nil { 96 | panic(err.Error()) 97 | } 98 | navArgs := map[string]string{"Home": "home", "User": "yupengfei"}//复杂的参数开始往里塞 99 | 100 | knowledgePage, err := template.ParseFiles("pages/knowledge/knowledge.gtpl") 101 | knowledgeArgs := map[string]interface{}{"Head": "This is a test title", 102 | "Author": "kun.wang", "PublishDatetime": "2014-09-14", 103 | "Content": template.HTML("

为什么要用语义呢?

")}//不是不好,只是做字符串分析会影响工程效率 104 | commonPage.ExecuteTemplate(w, "header", nil)// render 开始 105 | commonPage.ExecuteTemplate(w, "navbar", navArgs) 106 | knowledgePage.ExecuteTemplate(w, "knowledge", knowledgeArgs) 107 | commonPage.ExecuteTemplate(w, "tail", nil) 108 | ``` 109 | 110 | 仅提供关键代码。 111 | 其他的自行打开脑洞吧。 112 | > 1. 其他的都还挺好,就是页面渲染用服务器是不是有点太奢侈了。 113 | > 2. 然后就是一堆参数来回塞入,进去 114 | > 3. 最后终于开始渲染了 115 | > 4. 总结:虽然减少的通讯次数,但是没办法上CDN蛋疼,另外,模板的mapping蛋疼。 116 | 117 | ## 表示层脚本 118 | 119 | 表示层脚本做的比较困难也不是很好学。 120 | 但是一旦搞定了,代码的复用性会有非常可观的提升。 121 | >就普通情况而言JS开发效率是非常高的灵活度高,并且使用的是客户端的cpu 122 | 性能好,免费资源多,学习的人也多,好招聘。(济南除外) 123 | 124 | 125 | ### require.js 126 | 127 | 1. 加载 128 | 129 | ```js 130 | 131 | ``` 132 | 整个网页之留这么一个加载脚本的入口(每个页面最好只有一个js文件) 133 | 134 | 【好处】 135 | 136 | 1. js是延迟加载。不会出现网页卡死的情况 137 | 2. 最大化使用缓存。(HTTP 304) 138 | 139 | 【坏处】 140 | 141 | 1. 学习比较难 142 | 2. 网站更新始终有缓存没更新的浏览器。造成错误(所以有些情况客户自己就知道多刷新几次了,已经成用户习惯了) 143 | 144 | 【参数解释】 145 | 146 | 1. `data-main` 业务逻辑入口,载入当前字符串.js这个文件 147 | 2. `language` 不解释 148 | 3. `defer async` 字面意思 149 | 4. `src` r.js就是require.js的意思。代码到处都能搞到。 150 | 151 | 2. 页面Business 152 | 1. 加载依赖文件 153 | ```js 154 | require.baseUrl = "/" 155 | require.config({ 156 | baseUrl: require.baseUrl, 157 | paths: { 158 | "jquery": "js/jquery-1.10.2.min", 159 | "domready" : "reqmod/domReady", 160 | "pm" : "reqmod/pmodal", 161 | "cookie":"reqmod/cookie", 162 | "user":"reqmod/user", 163 | "bootstrap": "reqmod/bootstrap.min", 164 | "nav":"reqmod/nav" 165 | }, 166 | shim: { 167 | 'bootstrap': { 168 | deps: ['jquery'] 169 | } 170 | } 171 | }); 172 | ``` 173 | 直接copy全搞定。 174 | 175 | 1. 执行页面business 176 | > 执行里面做的最多的就是dom跟事件绑定而已。加载各种js库直接引用。 177 | 代码美观,开发效率,执行效率都是非常棒的。 178 | 179 | ```js 180 | require(['nav','domready', 'jquery', 'user','pm'], function (nav,doc, $, user,pm){ 181 | //binding event is ok! 182 | doc(function () { 183 | pm.load();//加载各种插件HTML模板之类的都ok 184 | $('#btn_login')[0].onclick = function(){user.login();}//button 事件绑定 185 | 186 | }); 187 | }); 188 | ``` 189 | 1. `require` 这个函数里面第一个参数是上面声明的里面的key 190 | 1. `function` 中的参数跟左边的对应,如果没有操作符,或者知识依赖于`$`(JQuery) 那么只在第一个参数中声明就ok了。**注意顺序是对应的** 191 | 1. `doc` dom ready API 是等待dom加载完成之后执行的函数 192 | 193 | 【总结】 194 | 195 | 1. 有了这个库之后页面只需要一个js文件,再也不乱了。 196 | 1. 有了这个库之后页面事件绑定只需要id(或者说DOM能找到就ok) 197 | 198 | 1. 页面MODEL 199 | ```js 200 | define(['jquery','reqmod/cookie','user','bootstrap'],function ($,cookie,user){ 201 | var nav_load = function () { 202 | $.get('/nav.html', function(result){ 203 | var newNode = document.createElement("div"); 204 | newNode.innerHTML = result; 205 | $('body')[0].insertBefore(newNode,$('body')[0].firstChild); 206 | //document.body.innerHTML = result + document.body.innerHTML; 207 | $('#btn_login')[0].onclick = function(){user.login();} 208 | $('#btn_reg')[0].onclick = function(){window.location='/register.html'} 209 | $.post('/login_check',{},function(data){ 210 | if(data==0){ 211 | Form_login.style.display="" 212 | } 213 | else{ 214 | form_userInfo.style.display="" 215 | } 216 | }) 217 | }); 218 | 219 | } 220 | 221 | return { 222 | load :nav_load 223 | }; 224 | }); 225 | ``` 226 | 这个人require很像,但是函数叫`define` 227 | 参数全是一样的 228 | 但是 229 | 230 | 【注意】 231 | > 这里引用的路径(单引号里面的依赖)一定要跟页面主business文件中有path配置,不然就要写网站绝对路径。T.T吃了不止一次亏。 232 | 233 | 【函数的定义】 234 | 235 | ```js 236 | var nav_load = function () {} 237 | ``` 238 | 只接受var匿名函数定义。 239 | 240 | 【最后的return】 241 | 242 | 注意其实就是个微型路由。假定你又很多调试方案,来回测试的时候使用不同的业务直接修改路由就行了。很方便。 243 | 244 | ### JQuery 245 | > TODO: 坑 246 | 247 | ## 业务层 248 | 1. GET分析 249 | > TODO: 坑 250 | 251 | 1. Post分析 252 | ```go 253 | func XXXAction(w http.ResponseWriter, r *http.Request) { 254 | r.parseForm() //有这个才能获取参数 255 | r.Form["Email"] // 获取Email 参数(String) 256 | } 257 | ``` 258 | 然后做业务就行了。 259 | 260 | 1. 资源入口函数资源require分析(url分析固定写法) 261 | ```go 262 | func Foo(w http.ResponseWriter, r *http.Request) { 263 | queryFile := strings.Split(r.URL.Path, "/") 264 | queryResource := queryFile[len(queryFile)-1] // 解析文件 265 | } 266 | ``` 267 | 完成字符串分割之后,按照需求来获取资源就可以了。 268 | ## 持久层 269 | ### 框架 270 | > 没映射不开心, 271 | 272 | 1. 我得兼容所有的系统,所以要设定专门的object做数据库的CRUD 273 | 2. OBJ GET SET ok~ 274 | 275 | ### Mysql 276 | > 在观察代码的时候有个方便的方法就是去掉异常处理的部分 if err XXXXX那些都去掉。就好看多了 277 | 278 | > 怎么说呢golang的err处理来回嵌套一次一次的,卧槽,让你迷糊都。之后会在utility 279 | 里面直接处理,会方便很多。 280 | 281 | > 其实不管什么语言的Mysql驱动都是从PRO\*C来的,所以会PRO\*\C之后, 282 | 啥都好说了就 283 | 284 | 1. Insert Delete Update 285 | ```go 286 | stmt, err := mysqlUtility.DBConn.Prepare("INSERT INTO credit (credit_code, user_code, credit_rank) VALUES (?, ?, ?)") 287 | if err != nil { 288 | pillarsLog.PillarsLogger.Print(err.Error()) 289 | return false, err 290 | } 291 | defer stmt.Close() 292 | _, err = stmt.Exec(credit.CreditCode, credit.UserCode, credit.CreditRank) 293 | if err != nil { 294 | return false, err 295 | } else { 296 | return true, err 297 | } 298 | ``` 299 | 这个SQL fetch做的还是算比较人道的。 300 | 1. Query 301 | ```go 302 | stmt, err := mysqlUtility.DBConn.Prepare(`SELECT commodity_code, commodity_name, description, picture, 303 | price, storage, count, status, 304 | insert_datetime, update_datetime FROM commodity WHERE commodity_code = ?`) 305 | if err != nil { 306 | return nil, err 307 | } 308 | defer stmt.Close() 309 | result, err := stmt.Query(commodityCode) 310 | if err != nil { 311 | return nil, err 312 | } 313 | defer result.Close() 314 | var commodity utility.Commodity 315 | if result.Next() { 316 | err = result.Scan(&(commodity.CommodityCode), &(commodity.CommodityName), &(commodity.Description), 317 | &(commodity.Picture), &(commodity.Price), &(commodity.Storage), &(commodity.Count), &(commodity.Status), 318 | &(commodity.InsertDatetime), &(commodity.UpdateDatetime)) 319 | if err != nil { 320 | pillarsLog.PillarsLogger.Print(err.Error()) 321 | return nil, err 322 | } 323 | } 324 | return &commodity, err 325 | ``` 326 | ### Mongodb 327 | ```go 328 | err := mongoUtility.PictureCollection.Find(bson.M{"picturecode":*pictureCode}).One(&picture) 329 | ``` 330 | 啥都不说了。都再MongoDB参考书上呢,API都一样。(BSON显式声明除外。) 331 | 332 | ##数据库设计参考 333 | 1. mysql数据库不能用id链接 334 | 1. mongodb index 代价很大,来个有意义的hash `_id` 比啥都强。 335 | 336 | ## 单元测试注意事项 337 | 1. 测试命令 go test -v (没有其他参数了!!!) `如果不带-v只显示结果,不显示调试过程,主要是调试开发的时候用` 338 | 1. 文件格式 xxx_test.go 但是建议改成 xxx_test0.go 或者喜欢改成别的也可以。 339 | 1. 由于测试先行的原则,在开发的时候一次测试也就一两个函数。 340 | 1. 这样相当于把其他测试注释掉 341 | 1. 测试的时候的配置文件要放到测试目录下面。别忘了。 342 | 1. 还有系统要生成的(只做追加的打开找不到文件就启动不了。)持久化数据。要touch(新建)好 343 | 1. 心态,错误太多一个一个来,要有个好心态。 344 | 1. 运气,妈妈问你为啥跪着看LiteIDE你就说。。。。。。 345 | 346 | ## 来吧LOG 347 | 1. 注意在调试中Log的不可缺失性。 348 | ```Golang 349 | //ignore import 350 | pillarsLog.PillarsLogger.Println() 351 | // 包括log时间,报错代码位置,以及报错内容,祝调试好运! 352 | ``` 353 | -------------------------------------------------------------------------------- /note/HTMLinsertBefore.md: -------------------------------------------------------------------------------- 1 | # HTML 头部插入的坑。 2 | 3 | 1. 最近的项目都是需要navbar的。全部需要动态什么的。 4 | 结果头部插入的时候就出现了很多坑。 5 | 6 | 7 | 如果直接+html页面很多编辑器的页面就不干了。 8 | 9 | 10 | 结果这能这样 11 | ```HTML 12 | var newNode = document.createElement("div"); 13 | newNode.innerHTML = result; 14 | $('body')[0].insertBefore(newNode,$('body')[0].firstChild); 15 | ``` 16 | 虽然不完美(多加了一个DIV) 17 | 但是还算能正常解决问题。 18 | -------------------------------------------------------------------------------- /note/HomeBrew.md: -------------------------------------------------------------------------------- 1 | 之前也是用MacPorts这个不是很好用啊。 2 | 首先是修改repo的问题没有搞定。 3 | 然后是安装死慢的问题。卧槽简直了。 4 | 后来还是发现HomeBrew比较靠谱。 5 | 因为他的安装位置固定,然后基本上都是编译好了的直接给你用了。非常方便! 6 | 官网 brew.sh 最下面有一个ruby 的脚本自动下载的哦。直接就安装了。 7 | 全部同意就ok了。只不过是修改几个文件夹的权限,需要密码。 8 | 之后brew install redis就能装软件了 9 | 10 | 卸载MacPorts: 11 | ```bash 12 | sudo port -f uninstall installed 13 | sudo rm -rf \ 14 | /opt/local \ 15 | /Applications/DarwinPorts \ 16 | /Applications/MacPorts \ 17 | /Library/LaunchDaemons/org.macports.* \ 18 | /Library/Receipts/DarwinPorts*.pkg \ 19 | /Library/Receipts/MacPorts*.pkg \ 20 | /Library/StartupItems/DarwinPortsStartup \ 21 | /Library/Tcl/darwinports1.0 \ 22 | /Library/Tcl/macports1.0 \ 23 | ~/.macports 24 | ``` 25 | -------------------------------------------------------------------------------- /note/MacAchieveEncoding.md: -------------------------------------------------------------------------------- 1 | #mac 下始终有windows文件乱码问题 2 | 解决方案: 3 | 使用The Unarchiver For Mac 4 | [下载](http://www.onlinedown.net/softdown/175693_2.htm) 5 | -------------------------------------------------------------------------------- /note/MetaRemap.md: -------------------------------------------------------------------------------- 1 | ubuntu Super键改Meta键: 2 | 3 | ``` 4 | xmodmap -e 'keycode 133 = Meta_L' 5 | ``` 6 | -------------------------------------------------------------------------------- /note/MyPHPEnv.md: -------------------------------------------------------------------------------- 1 | # 我的php环境配置 2 | 3 | ## 系统: mac 10.10.1 4 | 首先先通过coding.net 安装homebrew 5 | 6 | github在中国几乎用不了? 还是我网速慢,反正是clone不回来的。 7 | 直接放到coding.net上克隆回来之后。 8 | 下载代码回到本地 9 | 之后移动相同的目录结构到/usr/local中就ok了。 10 | 主要移动两个。一个是/bin/brew另外一个是Library这个文件夹就ok了。 11 | 12 | ### 小bug解决。基本上权限问题,要不就是缺少目录什么的,都好解决。 13 | 14 | ## 安装服务: 15 | ```bash 16 | brew install redis 17 | brew install memcache 18 | brew install automake 19 | pecl install redis 20 | pecl install memcache 21 | ``` 22 | 当然pecl 是php自动更新模块的程序,非常方便,我就专注于开发,我不想专注于环境。2333 23 | ## 服务启动: 24 | redis-server /usr/local/etc/redis.conf 25 | 26 | -------------------------------------------------------------------------------- /note/PHPExtensionWindows.md: -------------------------------------------------------------------------------- 1 | #安装php拓展在windows上 2 | 3 | ## 首先windows编译很麻烦所以只能找几个靠谱的地方找我的拓展 4 | 1. [memcache](http://pecl.php.net/package/memcache) 5 | 3. [igbinary](http://windows.php.net/downloads/pecl/releases/igbinary/1.1.1/) 6 | 2. [redis](http://windows.php.net/downloads/pecl/snaps/redis/) 7 | 8 | 9 | 下载之后还是老规矩放在该放的位置上然后修改php.ini就ok了。 10 | -------------------------------------------------------------------------------- /note/PythonEscape.md: -------------------------------------------------------------------------------- 1 | #Python 的escape处理 2 | escape这种转义是非常常见的,js里面函数是escape() 3 | python下是:在urllib里面叫 4 | quote/unquote 5 | -------------------------------------------------------------------------------- /note/RHELAddLocalRepo.md: -------------------------------------------------------------------------------- 1 | RHEL添加本地源(光盘) 2 | ```bash 3 | cat /etc/yum.repos.d/rhel-local.repo 4 | 5 | [rhel6.3-local] 6 | name=RHEL 6.3 local repository 7 | baseurl=file:///opt/yum/rhel6.3/ 8 | gpgcheck=1 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 10 | enabled=1 11 | ``` 12 | -------------------------------------------------------------------------------- /note/Readme.md: -------------------------------------------------------------------------------- 1 | # 我的笔记 2 | 在这个笔记文件中我主要记录一下我自己平时的操作笔记之类的。 3 | 也是会很欢乐的一个文件夹,当然也希望大家能给我提意见之类的。 4 | 如果你熟悉我,很容易就找到我的Email的。 5 | 6 | 当然我的笔记也是有搜索的,只要有Linux或者Mac的控制台就可以了。 7 | ``` bash 8 | grep -Fnr 'search key word' * 9 | ``` 10 | 搜索就这么简单! 11 | 12 | 然后这里也会成为我的Linux/Unix的学习笔记。 13 | -------------------------------------------------------------------------------- /note/SetMysqlPassword.md: -------------------------------------------------------------------------------- 1 | #修改mysql 密码 2 | 3 | ## 方法1 (我常用的方法) 4 | 比较简单 5 | ``` 6 | set password=password('1'); 7 | flush privileges; 8 | ``` 9 | 登陆的时候别忘了。 mysql -u root 10 | 带上用户名 11 | 此方法常用于新装不带密码的数据库。 12 | -------------------------------------------------------------------------------- /note/SetPasswordMongo.md: -------------------------------------------------------------------------------- 1 | #mongodb 密码设定 2 | ```bash 3 | use admin 4 | db.addUser('root','123456') 5 | db.system.users.find() 6 | #如果出现了你输入的账号就证明成功了 7 | ``` 8 | -------------------------------------------------------------------------------- /note/SublimeLicense.md: -------------------------------------------------------------------------------- 1 | ----- BEGIN LICENSE ----- 2 | Andrew Weber 3 | Single User License 4 | EA7E-855605 5 | 813A03DD 5E4AD9E6 6C0EEB94 BC99798F 6 | 942194A6 02396E98 E62C9979 4BB979FE 7 | 91424C9D A45400BF F6747D88 2FB88078 8 | 90F5CC94 1CDC92DC 8457107A F151657B 9 | 1D22E383 A997F016 42397640 33F41CFC 10 | E1D0AE85 A0BBD039 0E9C8D55 E1B89D5D 11 | 5CDB7036 E56DE1C0 EFCC0840 650CD3A6 12 | B98FC99C 8FAC73EE D2B95564 DF450523 13 | ------ END LICENSE ------ 14 | -------------------------------------------------------------------------------- /note/ToolBoxConfig.md: -------------------------------------------------------------------------------- 1 | #ToolBox刚开始的使用注意事项 2 | 3 | 刚开始Run起来之后不要着急使用。 4 | 需要`docker-machine config default` 5 | 配置一下你的环境 6 | 然后需要设定env 7 | `docker-machine env default` 8 | 然后会输出很多需要设定的环境变量。 9 | 执行命令就行了 10 | -------------------------------------------------------------------------------- /note/VirtualboxTray.md: -------------------------------------------------------------------------------- 1 | VirtualBox tray 2 | 3 | Virtual box 变成托盘图标。非常方便 4 | 5 | VBoxHeadlessTray43Setup.exe 6 | 7 | 这是文件名 8 | 9 | http://www.92wiki.com/hdwiki/index.php?doc-view-393 10 | 11 | 官方网站 12 | 13 | http://www.toptensoftware.com/VBoxHeadlessTray/ 14 | -------------------------------------------------------------------------------- /note/WgetJdk.md: -------------------------------------------------------------------------------- 1 | 服务器上下载JDK最快的方法: 2 | [link](http://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead) 3 | 4 | wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz 5 | 6 | 在网页上点完同意之后就能看见最新版的下载链接了。非常方便。 7 | -------------------------------------------------------------------------------- /note/aboutGIT.md: -------------------------------------------------------------------------------- 1 | 记住密码: 2 | git config --global credential.helper store 3 | -------------------------------------------------------------------------------- /note/baiduyunLocateError.md: -------------------------------------------------------------------------------- 1 | 主要是没设置的问题 2 | 3 | ## 我的系统是:ubuntu 14.04 4 | ```bash 5 | export LC_ALL=en_US.UTF-8 6 | export LANG=en_US.UTF-8 7 | export LANGUAGE=en_US.UTF-8 8 | ``` 9 | -------------------------------------------------------------------------------- /note/bootstrap弹出插件.md: -------------------------------------------------------------------------------- 1 | # 很多时候需要数据弹窗。 2 | [bootstrap弹窗插件地址](http://getbootstrap.com/javascript/#modals) 3 | -------------------------------------------------------------------------------- /note/brewMysqlInstallLog.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | A "/etc/my.cnf" from another install may interfere with a Homebrew-built 3 | server starting up correctly. 4 | 5 | To connect: 6 | mysql -uroot 7 | 8 | To have launchd start mysql at login: 9 | ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents 10 | Then to load mysql now: 11 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist 12 | Or, if you don't want/need launchctl, you can just run: 13 | mysql.server start 14 | ==> /usr/local/Cellar/mysql/5.6.22/bin/mysql_install_db --verbose --user=developer --basedir=/us 15 | ==> Summary 16 | 🍺 /usr/local/Cellar/mysql/5.6.22: 9666 files, 339M 17 | ``` 18 | -------------------------------------------------------------------------------- /note/butterFly_termial.md: -------------------------------------------------------------------------------- 1 | http://paradoxxxzero.github.io/2014/02/28/butterfly.html 2 | http://paradoxxxzero.github.io/2014/03/21/butterfly-with-ssl-auth.html 3 | 4 | 安装的时候注意ssl的devel libffi-dev就行了。 5 | 瞅瞅错误基本上就能编译过去了。 6 | 7 | ```sh 8 | $ sudo butterfly.server.py --generate-certs --host="192.168.0.1" # Generate the root certificate for running on local network 9 | $ sudo butterfly.server.py --generate-user-pkcs=foo # Generate PKCS#12 auth file for user foo 10 | ``` 11 | cd /etc/butterfly/ssl/ 12 | butterfly_ca.crt这个是要 import到浏览器里面的 13 | foo.p12这个哈。也是要import到浏览器里面的 14 | 之后访问host的那个ip地址就能用https 安全使用控制台了。 15 | 16 | ```sh 17 | $ sudo butterfly.server.py --host="192.168.0.1" # Run the server 18 | ``` 19 | 这是运行啦~~~ 20 | -------------------------------------------------------------------------------- /note/dockerChangeStoragePosition.md: -------------------------------------------------------------------------------- 1 | # docker 修改默认aufs存储位置 2 | 3 | 在配置文件: 4 | /etc/defaults/docker 中 5 | 添加 6 | 7 | ``` 8 | DOCKER_OPTS="-g /data/docker" 9 | ``` 10 | 11 | 其实就是docker daemon 中有个-g 用起来就好了 12 | -------------------------------------------------------------------------------- /note/dockerPostgresql.md: -------------------------------------------------------------------------------- 1 | RUN: 2 | docker run -d -v /tmp:/tmp/dshare -v /tmp/pgdata:/psqldata -e PGDATA=/psqldata --name psqldb -e POSTGRES_PASSWORD=postgres postgres 3 | 4 | docker run -d -v /tmp:/tmp/dshare -v /tmp/pgdata:/psqldata -e PGDATA=/psqldata --name psqldb -e POSTGRES_PASSWORD=postgres postgres 5 | -------------------------------------------------------------------------------- /note/dockerReg.md: -------------------------------------------------------------------------------- 1 | RUN: 2 | docker run -dt -p 80:5000 --name reg -v /Users/Li-jianying/dockerREG/:/tmp/registry registry 3 | 4 | -------------------------------------------------------------------------------- /note/dockerRegV2.md: -------------------------------------------------------------------------------- 1 | 准备Cert 2 | 3 | ``` 4 | mkdir -p certs && openssl req \ 5 | -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \ 6 | -x509 -days 365 -out certs/domain.crt 7 | ``` 8 | 9 | 启动Image 10 | 11 | ``` 12 | docker run -it -d --name reg -p 5000:5000 --restart=always -v /opt/certs:/certs \ 13 | -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \ 14 | -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \ 15 | -v /opt/reg:/var/lib/registry registry:2.2.1 16 | ``` 17 | -------------------------------------------------------------------------------- /note/etcd.md: -------------------------------------------------------------------------------- 1 | # ETCD 的学的使用与学习过程 2 | 3 | ## 基础方面文档: 4 | [admin-guide](https://coreos.com/etcd/docs/latest/admin_guide.html) 5 | 这个是一定要看的重点看etcdctl命令怎么用的,熟悉里面的也没啥用,还不如直接试用一下命令就行了 6 | 7 | [cluster-guide](https://coreos.com/etcd/docs/latest/clustering.html) 8 | 9 | 前面启动三个节点的命令比较重要,其实关键在initial 里面先配置几个节点试试就行。 10 | 11 | ## 动态节点添加 12 | 13 | ``` 14 | 1. 在etcdctl 里面 etcdctl member add [name] [peerurl] 15 | 2. 在添加的目标节点里面启动就行了。就这么简单。。。。输入完上面的命令之后会有提示环境变量怎么搞的,非常方便, 16 | 当然我推荐的方式是直接使用命令行,毕竟涉及的东西越少越好,命令可以参考之前的cluster guide里面启动命令。 17 | 需要修改的地方就是initial cluster参数,添加新的服务器就行,和最后的New改成exist就行了。 18 | ``` 19 | 20 | ## 安全问题 21 | 22 | 23 | ## 如何使用 24 | 25 | 26 | ## 备份与灾难恢复。 27 | -------------------------------------------------------------------------------- /note/golangProjectOnIdea.md: -------------------------------------------------------------------------------- 1 | #配置golangproject在IDEA中 2 | 1. 不要在意打开IDE时候的goroot 跟gopath错误 3 | 2. 选择sdk File->Project structure 然后选择golang 的sdk 4 | 3. 选择要运行的文件,在config里面有一个parameter 输入GOPATH 5 | 1. 把项目放到src目录下面。GOPATH是src的父目录(约定而已) 6 | -------------------------------------------------------------------------------- /note/golangUnitTest.md: -------------------------------------------------------------------------------- 1 | #golang中单元测试的坑。 2 | 1. go test 后面是不加目录跟参数的 3 | 如果需要的话可以加个go test -v 4 | 2. 配置文件全部都需要copy位置。不然就会报错。 5 | 因为没有办法更换run root 6 | -------------------------------------------------------------------------------- /note/golang中的坑.md: -------------------------------------------------------------------------------- 1 | #golang中的坑 2 | 3 | ## 类型转换。 4 | 1. golang中的类型转换全都是通过类似C语言这种的atoi itoa这种的 5 | 1. session中的坑的解决办法 6 | ```go 7 | strconv.Itoa(int(userSession.Get("loginTime").(int)))+"
" 8 | ``` 9 | (import strconv) 10 | -------------------------------------------------------------------------------- /note/iterm2的坑.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/note/iterm2的坑.md -------------------------------------------------------------------------------- /note/jsDownloadFile.md: -------------------------------------------------------------------------------- 1 | #js生成文件并下载 2 | 3 | 有些时候需要浏览器自己根据情况生成文件并且下载。 4 | 直接调用下面方法就ok了。 5 | 6 | ```js 7 | function downloadFile(fileName, content){ 8 | var aLink = document.createElement('a'); 9 | var blob = new Blob([content]); 10 | var evt = document.createEvent("HTMLEvents"); 11 | evt.initEvent("click", false, false);//initEvent 不加后两个参数在FF下会报错, 感谢 Barret Lee 的反馈 12 | aLink.download = fileName; 13 | aLink.href = URL.createObjectURL(blob); 14 | aLink.dispatchEvent(evt); 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /note/json.toolunicodeescape.md: -------------------------------------------------------------------------------- 1 | json tool 虽然好用,但是他有一个遇到中文就变unicode的问题 2 | 然后我们修改一下源代码 3 | ``` 4 | 34 json.dump(obj, outfile, sort_keys=True, 5 | 35 indent=4, separators=(',', ': '), ensure_ascii=False) 6 | ``` 7 | 最后的ensure_ascii是关键 8 | -------------------------------------------------------------------------------- /note/killall.md: -------------------------------------------------------------------------------- 1 | apt-get install psmisc 2 | -------------------------------------------------------------------------------- /note/liteIDE改装.md: -------------------------------------------------------------------------------- 1 | #LiteIDE改装 2 | 最近一直都在使用liteIDE做开发。公司的项目很紧张,但是在这个周末。还是偷偷的对liteIDE小不爽的地方进行了一些小的改造。 3 | 4 | ## IDE上的run按钮就是运行当前的go文件。 5 | 1. 首先我们项目运行只是运行统一或者少数的入口点每次点开固定的文档才能run真的是够了。 6 | 另外一个主要的原因在于liteIDE没有project管理支持。 7 | 2. 而且这个IDE貌似没有出很长时间一般的RCP平台都是有插件开发的。但是这没有插件开发(貌似是有。而且是用python写的) 8 | 但是,没找到文档(截至 2015年1月19日)也是醉了。 9 | 10 | ## 关键入口点还是我在google Code上找到的一个文档。 11 | 在配置中的LiteBuild里面有一个gosrc.xml 这个配置文件能修改buttion调用的命令。 12 | 好吧就只能用这个做自己脚本的入口了。 13 | ```xml 14 | 15 | ``` 16 | `cmd` `args` 就是它了。 17 | ## 展开无限的联想 18 | 首先用这个做了一个系统的统一入口点,我的主要问题在于项目选择上面。 19 | 因为我项目不多,同时也就做两个项目所以直接就在脚本里面写好项目选择 20 | 就可以了。类似这样。 21 | ``` sh 22 | echo "项目选择器" 23 | sh ~/h/run.sh 24 | ``` 25 | 直接去run项目里面的run.sh 26 | 就ok了。 27 | ## 坑 28 | ```sh 29 | echo 'XXX项目启动脚本' 30 | export C=$(cd `dirname $0`; pwd) 31 | cd $C 32 | go run httpServer.go router.go pageload.go 33 | ``` 34 | 别忘了cd进去你的项目文件目录。不然,我也不知道是那里。反正找不到脚本。 35 | 然后你就run不了了。 36 | 37 | # Golang坑爹的Test 38 | 1. 39 | -------------------------------------------------------------------------------- /note/mongodbUse_id.md: -------------------------------------------------------------------------------- 1 | 使用有意义的 _id 在golang里面需要这样: 2 | type test struct { 3 | Id int `json:"id" bson:"_id"` 4 | } 5 | -------------------------------------------------------------------------------- /note/puttySmallKeyboard.md: -------------------------------------------------------------------------------- 1 | 打开putty的配置 勾选Terminal-->Features下面的“Disable application keypad mode”即可。 2 | -------------------------------------------------------------------------------- /note/puttyblue.md: -------------------------------------------------------------------------------- 1 | 打开putty,选择保存的一个session,或者已经打开某一个session。如果是打开了某一个session,则右键单击putty上边的边框,选择 "change settings...” ,然后选择"windows“ ---> "colours" ---> "select a colour to adjust" ---> 选择要调整的颜色,我这里选择的是"ANSI Blue" ---> "Modify",然后调整自己想要的颜色。 2 | 我这里把原来的0 0 187 改成了85 85 255 (你懂的) 3 | -------------------------------------------------------------------------------- /note/pythonSimpleHTTPSERVER.md: -------------------------------------------------------------------------------- 1 | python -m SimpleHTTPServer 2 | -------------------------------------------------------------------------------- /note/saveGitPassword.md: -------------------------------------------------------------------------------- 1 | git config --global credential.helper store 2 | -------------------------------------------------------------------------------- /note/ubuntuChangeRepo.sh: -------------------------------------------------------------------------------- 1 | sed -i 's/us.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list 2 | -------------------------------------------------------------------------------- /note/viEscpaeDelays.md: -------------------------------------------------------------------------------- 1 | http://www.johnhawthorn.com/2012/09/vi-escape-delays/ 2 | -------------------------------------------------------------------------------- /note/取消sshPublicKeyKnowHost认证.md: -------------------------------------------------------------------------------- 1 | ## 因为CoreOS每次启动之后都会更换public key 2 | 3 | 操作: 4 | File:~/.ssh/config 5 | ``` 6 | StrictHostKeyChecking no 7 | UserKnownHostsFile /dev/null 8 | ``` -------------------------------------------------------------------------------- /note/科大lugDNS.md: -------------------------------------------------------------------------------- 1 | 202.38.93.153,202.141.162.123,202.141.176.93,防污染,支持tcp -------------------------------------------------------------------------------- /picture/MacTheme/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/MacTheme/1.jpg -------------------------------------------------------------------------------- /picture/MacTheme/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/MacTheme/2.jpg -------------------------------------------------------------------------------- /picture/MacTheme/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/MacTheme/3.jpg -------------------------------------------------------------------------------- /picture/MacTheme/4 (4).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/MacTheme/4 (4).jpg -------------------------------------------------------------------------------- /picture/lwqq/l1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l1.jpg -------------------------------------------------------------------------------- /picture/lwqq/l2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l2.jpg -------------------------------------------------------------------------------- /picture/lwqq/l3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l3.jpg -------------------------------------------------------------------------------- /picture/lwqq/l4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l4.jpg -------------------------------------------------------------------------------- /picture/lwqq/l5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l5.jpg -------------------------------------------------------------------------------- /picture/lwqq/l6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l6.jpg -------------------------------------------------------------------------------- /picture/lwqq/l7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/lwqq/l7.jpg -------------------------------------------------------------------------------- /picture/wqq/w1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w1.png -------------------------------------------------------------------------------- /picture/wqq/w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w2.png -------------------------------------------------------------------------------- /picture/wqq/w3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w3.png -------------------------------------------------------------------------------- /picture/wqq/w4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w4.png -------------------------------------------------------------------------------- /picture/wqq/w5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w5.png -------------------------------------------------------------------------------- /picture/wqq/w6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w6.png -------------------------------------------------------------------------------- /picture/wqq/w7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w7.png -------------------------------------------------------------------------------- /picture/wqq/w8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/picture/wqq/w8.png -------------------------------------------------------------------------------- /prob/LFS journey.md: -------------------------------------------------------------------------------- 1 | #LFS编译过程必备辅助手册 2 | 3 | ## 前言 4 | LFS(Linux from scratch)是从源代码开始编译Linux操作系统。如果需要深度定制Linux操作系统或者需要 5 | 更加深入学习Linux的学习者可以从这里开始您的旅途。这份意义的深渊不必多说。 6 | 同时也希望您能加入我们一起开始这段旅程[→加入我们←](http://ubtamator.github.io/) 7 | 8 | 从7月初开始我们团队里面两个人为了更加深入的学习Linux方面的知识。也为了瞻仰LFS大神们的光辉。 9 | 开始了LFS的旅程,因为LFS官方文档写的虽然非常具体,但是多多少少对于一些Linux新手来说造成很多困扰。 10 | 11 | 因此我们团队做完LFS之后写了这篇**辅助**性质的说明,对新手遇到问题的时候提供帮助。 12 | ### 进行LFS旅程的前提条件 13 | 1. 比较熟悉Linux操作 14 | 1. 有一定Linux开发基础 15 | 1. 在LFS之前有过从源码编译软件的经验。 16 | 1. 有一定的英文基本功,除了看手册之外,有的时候抛出错误的时候应该有google查找并解决错误的能力。 17 | 18 | ### 文档使用方法: 19 | 1. 首先对本辅助文档完整的浏览一遍,这样有助于理解LFS的整个过程做什么 20 | 1. 然后扫一遍LFS官方文档的目录,这样至少知道好每个章节的目的。 21 | 1. 当你进行到LFS某一步时,遇到问题后可以对应上本辅助手册的具体问题的解决方案 22 | 23 | ### LFS全过程概括 24 | 1. 对磁盘跟用户的准备 25 | 2. 建立temp系统 26 | 3. 编译LFS系统 27 | 4. 最后调整 28 | 29 | ### LFS 编译完成的成果 30 | LFS在编译完成的最后除了Linux基础内核目录结构(bin etc lib proc dev等等这些)还有一个tools这个目录(过程概括中的2),它的存在是为了编译LFS整个系统的。所以在第五章这一部分中,就是利用ubuntu或是centos主机系统的编译环境(称之为HOST)来编译出tools这个目录下的编译环境。 31 | 32 | **`提示`**:其实制作LFS所有用到工具链接,就是在ubuntu或centos下编译出一个新的交叉编译器(就是/tools目录下的所有工具),而这个新的交叉编译器在编译出来后,就不会依赖于现有操作系统编译器和库文件(ubuntu or centos),此时我们就可以利用这个全新的交叉编译工具(/tools目录下的所有工具)制造属于我们自己的Linux了,利用这新的工具,从源码开始编译出所有我们需要的软件和库,最后编译Linux内核,设置bash脚本,启动脚本,tmpfs文件系统需要的配置文件,整个LFS的过程就结束了。 33 | 34 | ##A: Linux发行版本的选择 35 | 1. CentOS 6.3 (虚拟机双硬盘) 36 | 2. Ubuntu 14.04 with GCC4.4(64bit) (笔记本电脑+双硬盘+LFS系统构建在SSD硬盘上) 37 | 3. 在以上两种Linux发行版上分别进行编译运行,且最终都取得成功。 38 | 4. 使用LFS官网上LFS7.5的源码进行编译制作 39 | 40 | ##B:前四章的内容:硬盘分区、用户准备篇 41 | 主机所用操作系统的准备工作: (ubuntu14.04 64位下需要安装的软件) 42 | > 1.在ubunt下安装bison(ubuntu下默认没有安装) 43 | ``` 44 | sudo apt-get install bison 45 | #LFS 手册要求 46 | ``` 47 | 2.不能用gcc4.8,需要换成gcc4.4(ubuntu14.04默认gcc4.8) 48 | ``` 49 | sudo apt-get install gcc-4.4 g++-4.4 50 | sudo rm `which gcc` 51 | sudo rm `which g++` 52 | sudo ln -sv /usr/bin/gcc-4.4 /usr/bin/gcc 53 | sudo ln -sv /usr/bin/g++-4.4 /usr/bin/g++ 54 | ``` 55 | **这里CentOS没有什么特别要说的。主要因为全部都用默认的,就可以了。各种依赖C6-Media就可以解决** 56 | 3.到LFS官网上下载LFS7.5的所有源码: 57 | [ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/](ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/) 58 | 59 | ####1.磁盘分区准备 60 | 1. plan: 准备一个10到20GB的分区,这一步请谨慎操作 61 | 1. action: 创建分区(表)并格式化 62 | `创建分区表请使用fdisk , 如果需要图形界面下的请使用GPartion如果这两种工具都不会请到windows下分区(无需格式化)` 63 | ``` 64 | #格式化分区 65 | sudo mkfs -v -t ext4 /dev/sdaX #这里的X是填上自己的分区号 66 | ``` 67 | PS:因为现在计算机的内存都比较大,所以可以不需要swap分区。(第一次进行LFS,一个根(/)分区就够了,等以后有经验了,在进行多分区的操作) 68 | 69 | ####2.用户准备 70 | 71 | 直接参考手册上的来就行了。 72 | 小建议:`PS1='[\[\e[32m\]#\##\[\e[31m\]\u@\[\e[36m\]\h \w]\$\[\e[m\]' PS1修改成这个变量看着能舒服点。` 73 | 74 | 75 | `注意`:每次开机,或是重启后,在进入lfs用户前,都要对 LFS变量进行检查,查看LFS=/mnt/lfs变量是否存在,然后对lfs使用的分区进行挂载 76 | ### `前四章的小结:` 77 | >1. 这一部分没有什么难点,准备硬盘分区是因为要让LFS作为独立的硬盘来启动。新建分区、格式化分区、准备lfs用户是Linux操作的基础素质。 78 | **`注意`** :为了下面的编译过程能更快,可以在输入make命令时在后面加入-j4,使用4个进程进行同时编译,在多核处理器上编译的速度有明显提升 79 | 80 | 81 | --- 82 | ####`开始进入编译代码的环境`(每次开机或重启动后需要进行下面步骤进入lfs用户环境) 83 | >1. 首先导入LFS变量 84 | ``` 85 | export LFS=/mnt/lfs 86 | #建议放到/etc/profile下方便一直用 87 | ``` 88 | 2. 然后挂载LFS的分区 89 | ``` 90 | sudo mount -v -t ext4 /dev/sdaX $LFS #X为你的LFS硬盘分区号 91 | ``` 92 | 3. 最后就可以切换到lfs用户了 93 | ``` 94 | su - lfs #注意中间这个 - 符号是一定要的,代表为lfs用户启动一个login shell 95 | ``` 96 | `补充`:通常我们在开机后,启动的第一个shell称之为login shell,当进入GUI界面后,不需要输入密码启动的shell称之为non-login shell。这两种shell是有区别的。大家都知道shell的运行是需要环境变量的支持的。配置这些环境变量的文件就是配置shell工作环境的文件。两种shell在读取配置文件时有很大的不同,下面是总结它们分别读取哪些配置文件: 97 | 1. login shell 启动--->读取/etc/porfile文件--->读取~/.bash_profile文件 98 | 2. no-login shell 启动--->读取~/.bashrc文件 99 | 3. ```exec env -i /bin/bash```命令会开启一个全新的non-login shell。 100 | 101 | **`注意`**:每次重新开机或重启后都需要进行下面的步骤,切换到lfs用户,因为对于新手来说,不可能一天就编译完lfs的所有源,可以把以上步骤保存到一个文件中,每次重启系统进行LFS之前,参照以上步骤进入到LFS编译环境。 102 | 103 | ##C: 第五章的内容:编译得到\$LFS/tools/目录下面的工具包 104 | - `第一步`,编译出一个全新的与主机系统无关的工具链接。(这些工具链包含了:compiler(就是我们常用的gcc,g++),assembler(就是把汇编程序变成a.obj文件的工具),linker(就是把很多*.obj文件和库文件链接成可运行文件a.out的工具),还有各类库文件(为后面编译其它的软件提供基础设施),当然还有大量的其它工具) 105 | - `第二步`,得用第一步编译出来的工具,编译其它的工具(这里可以看出,在制作LFS的过程中,编译的先后顺序是非常生要的,因为有了鸡,才能下蛋) 106 | - `注意1`:上面两步编译出来的工具都会安装到 \$LFS/tools目录下面(也就是/mnt/lfs/tools目录下面)。LFS手册中把这个称之为临时的文件系统,就是因为\$LFS/tools这个目录在第6章结束时就会被删除,因为$LFS/tools已经使用完了,没有利用价值了。 107 | - `注意 2`:参照LFS手册上的指令进行编译,基本不会遇到错误,因为编译代码的步骤就是老三样:```configure && make && make install```,但是有一点,一定要注意,所有的安装包一打要打补丁,因为LFS手册没有强调打补丁的过程,所以自己如果发现这个源码包有补丁文件,一定要记得打上。 108 | - `注意 3`:因为需要编译的软件太多,到最后你可能不会愿意自已每个单词都输入到命令行进行编译,所以通常会直接复制LFS手册中的命令。但是复制时,请一定注意先把指令复制到一个空的文件编辑器中,然后检查一下,复制过来的内容是否正确,因为从PDF文件复制到文本中的内容,格式会发生很大的变化。这一点在你尝试的过程中就会发现了。然后在文本编译器或是vim中进行编辑后,在复制到lfs用户的命令行中。 109 | 110 | - `注意4`:在编译perl时,按照官方文档打补丁会出现readonly的错误,下面是是正确的操作命令 111 | ``` 112 | cd /mnt/lfs/sources 113 | tar xvf perl-5.16.2 114 | cd perl-5.16.2/hints 115 | cp linux.sh linux.sh.org 116 | cd .. 117 | patch -Np1 -i ../perl-5.16.2-libc-1.patch 118 | cd hints 119 | diff linux.sh linux.sh.org #输出打补丁情况,则为正常打补丁,编译过程参考手册 120 | ``` 121 | - `注意5`:手册上的configure的位置一定刚要注意有三种情况,第一种是在源代码目录之外进行configure,第二种是在源代码目录里面进行configure,第三种(特殊情况)是libstdc++是在gcc源码目录的子目录里面进行configure。所以在执行命令之前一定刚要看好执行命令的前提条件,不妨思考一下LFS的笔者为什么这么写。 122 | - `温馨提示`: 第一次编译GCC时可能会遇到环境问题,不要气馁,失败是正常的(我失败了10次以上)不过我们可以保证LFS手册上的命令质量是非常高的。经过亲身测试绝对没有错误。 123 | 124 | ####进入第六章前的准备 125 | 由于第六章所有的操作都是在root用户下进行的,所以要把第五章编译好的\$LFS/tools目录改为root用户所有,命令如下:(下面的命令,请用root身份运行) 126 | ``` 127 | export LFS=/mnt/lfs 128 | chown -R root:root $LFS/tools 129 | ``` 130 | 131 | ##D: 开启第六章,构建真正的LFS系统 132 | 从第六章开始我们就正式开始编译LFS系统了,大概几十个模块只要跟着脚本走一般都不会遇到问题。 133 | 只是有几点需要注意。 134 | 135 | 136 | >1. 这个是需要正常运行的操作系统所以所有的patch补丁包一定都要打上。 137 | 1. perl的patch包需要参考网上的一些文章来解决read only 的问题。(GOOGLE问题的第一个链接就是答案) 138 | 1. 最开始的chroot是需要用root权限来实行的。 139 | 1. dev下的设备挂载是要用lfs用户的最高权限来执行mount(也就是说需要给lfs用户添加到sudoers里面) 140 | 1. 有的时候你需要终止你自己的工作。等其他时间继续编译lfs,你需要重新挂载dev目录 和chroot 141 | 1. 在编译内核的时候你需要生成.config文件如果这个文件你自己调整的话始终都非非常费劲的对于内核新手来说最好的方案就是找个发型版本(eg.ubuntu 14.04)复制/boot里面的内核配置文件,不然会出现很多内核驱动不支持的现象。比如说网卡 142 | 1. 在编译完了之后有很多脚本需要你进行执行的。 143 | ** 但是一定要注意,脚本的选择比较多。选择合适你的脚本,另外脚本挺长,有的需要翻页。** 144 | 1. /etc/sysconfig/console 这个脚本不需要建立。 145 | 1. 在设定grub的脚本的时候一定要注意你自己bootlfs时候的参数是多少(比如说新建虚拟机之后你几块硬盘几号分区什么的。) 146 | -------------------------------------------------------------------------------- /prob/LinuxHeaderInstall.md: -------------------------------------------------------------------------------- 1 | Linux header 安装 2 | ============================ 3 | 4 | 参考文章 5 | ----------------------- 6 | http://www.2cto.com/os/201308/238749.html 7 | 8 | 用于解决问题 9 | ----------------------- 10 | 安装VMtool时候 What is the location of the directory of C header files that match your running 11 | kernel? 提示需要安装Linux kernel header 12 | 13 | 问题解决方法 14 | ------------------------- 15 | ```shell 16 | sudo apt-get update 17 | sudo apt-get install build-essential linux-headers-$(uname -r) 18 | #CentOS 下 包的名字叫 kernel-headers 19 | ``` 20 | 第一行更新软件源 21 | 22 | 第二行 build-essential 安装编译需要的编译器 23 | 24 | linux-headers-$(uname -r) 自动选择对应内核版本的header包。 25 | 26 | -------------------------------------------------------------------------------- /prob/Linux分区.md: -------------------------------------------------------------------------------- 1 | # 1.关于Linux的分区 2 | 3 | 标签(空格分隔): 未分类 4 | 5 | --- 6 | 7 | ## 在Linux中什么是挂载点? 8 | 9 | - 挂载点实际上就是linux中的磁盘文件系统的入口目录. 10 | - 类似于windows中的用来访问不同分区的C:、D:、E:等盘符. 11 | - 其实windows也支持将一个磁盘分区挂在一个文件夹下面. 12 | - 只是我们C:、D:这样的盘符操作用惯了,一般没有将分区挂到文件夹。 13 | 14 | ``` 15 | 以上阐述借鉴度娘,以下阐述出于自己总结 16 | ``` 17 | 咱们可以吧Linux想象成一辆汽车 : 18 | 发动机就是内核,其余的各种各种围绕着它进行生产和拼装,组成了一辆伟大的四个轮子. 19 | 那么,可以理解为"组装"这个动作,就是Linux世界中将你硬盘上的分区去挂载(组装)到某一个目录下. 20 | 21 | --- 22 | 23 | **言归正传安装Linux中如何分区:** 24 | 咱们小白一开始愣头愣脑的下载好某个Linux的发行版后: 25 | 假设您正确的制作了启动U盘,\ 26 | 假设您正确的引导了U盘,\ 27 | 假设您也正常的进行到磁盘分区的界面了(当然我建议您第一次安装的时候使用中文界面,会少跳很多坑.) 28 | 29 | 当您来到分区页面的时候,我想不管是啥发行版,绝大多数的分区页面大致都是下图(1-1)这样的: 30 | 31 | ![CentOS 6的第一步分区引导][1] 32 | 33 | 34 | 图:1-1 35 | 36 | 咱们来翻译一下: 37 | ``` 38 | Use All Space 使用全部的空间 39 | Replace Existing Linux System 替换现有的Linux系统 40 | Shrink Current System 缩减当前的系统空间 41 | Use Free Space 使用未使用的空间 42 | Create Custom Layout 自定义分区 43 | ``` 44 | 一共5个,1~4不用看,咱们直接选5"Create Custom Layout"然后直接下一步,之后你会看到图1-2. 45 | 46 | ![此处输入图片的描述][2] 47 | 48 | 49 | 图1-2 50 | 51 | 上图的环境是一个虚拟机,玩过虚拟机的朋友大概都知道,一般都分了一个sda,那如果碰到要给服务器装,那么你做了几个VD这里就会显示几个sda*. 52 | 要注意的是,我们是用U盘安装的那么U盘同样会被识别进来,那么很可能出现的情况就是,sda是U盘,sdb是硬盘,大家要注意一下. 53 | 54 | 接下来就是重要的手动分区啦再这之前,先给对Linux分区毫无概念的兄弟一个基础资料[(请点击我)][3]: 55 | 56 | 57 | 接下来点击Create出现新的窗口(图1-3): 58 | ![创建标准分区][4] 59 | 图1-4 60 | ``` 61 | Standard Partition 标准的分区模式 62 | RAID Partition 磁盘阵列分区,这里是软件磁盘阵列 63 | LVM Physical Volume LVM物理卷,这是LVM的分区模式 64 | ``` 65 | 选择第一个创建一个标准的分区. 66 | ![设置挂载点][5] 67 | 上图(图1-5)就是小白们不太明白的地方了吧,回过去想想挂载点的概念你应该会明白的. 68 | ##假设今天有同事过生日,而你负责分蛋糕,但是呢每个同事的胃口各有大小,有的人甚至都不能多吃奶油,这样你就要考虑如何分配这块大蛋糕(硬盘)给每个肠胃条件不同的同事(例如:"同事boot","同事/","同事swap","同事home")进行合理分配. 69 | 70 | 这样解释的话,应该明白了吧,下面说说常规分法: 71 | 72 | 1. 虚拟机下:/boot=200MB swap=你物理机内存的两倍 /=剩余所有 73 | 2. 服务器环境:/boot=400MB swap=如果是好服务器其实可以不分的.. /=剩余所有 74 | 75 | 以上这些都不是绝对的,比如说我有时候安装系统,我就直接/+swap....不要喷我. 76 | 77 | 78 | 79 | 80 | ##**2.使用 GParted 为你的Linux分区** 81 | 在使用Linux的过程中,随着软件的安装和数据的膨胀,有时候会发现划分给Linux分区需要进行调整. 82 | 如果直接使用分区命令fdisk调整分区大小,往往意味着分区数据的丢失. 83 | LVM技术可以避免分区数据丢失,但在使用中有许多限制. 84 | 本文介绍一种使用gparted进行Linux分区调整的方法,它比较适合个人计算机中的硬盘分区调整,同时也可避免数据丢失. 85 | 86 | 如果是用虚拟机要引导ISO请参考以下文章:http://jingyan.baidu.com/article/f0e83a25f1fc9922e591012e.html 87 | 88 | ###**虚拟机下对GParted_ISO的引导以及分区流程** 89 | 首先,咱们通过livecd的方式引导GParted: 90 | 通过vm的设置挂载GParted的ISO来启动已经安装好的linux后启动界面如下图2-1: 91 | ![GParted引导][6] 92 | 通过方向键定位到 GParted Live(Default settings)回车进入. 93 | 之后一系列黑屏+字母(不要管它). 94 | 接着会出现如下界面(图2-2): 95 | ![一路回车][7] 96 | 有人要看不懂了(对,一开始我也看不懂,小弟我1级英语都没过!),但是你要的只是回车只要回车就可以,一路回车最终你会看到(图2-3): 97 | ![主界面][8] 98 | 守得云开见月明~~~类似于DG的东西呈现在你眼前,这下熟悉了吧~ 99 | 上图中,大家看到因为是虚拟机硬盘,我除了分了boot和swap之外其余容量全都给了根,为了便于做教程我特地割了6~7个G出来作为"unallocated"(啥?问我怎么割的?看图2-4): 100 | ![分割][9] 101 | 懂了吧,接下来是给这个割出来的空间创建新分区(图2-5): 102 | ![合并][10] 103 | 做完之后新分区就出来了(图2-6): 104 | ![最后][11] 105 | 最后出现了sda4新的分区,当然要注意的是这个sda4在linux下是没有作用的,需要去挂载这个分区,我们在之后会提到"在linux中如何挂载硬盘分区"挂载的就是这个sda4 106 | 107 | 108 | ##**3.在linux中如何挂载硬盘分区** 109 | 110 | 111 | [1]: http://hiphotos.baidu.com/exp/pic/item/966aca0735fae6cd25c6f8c80eb30f2443a70fed.jpg 112 | [2]: http://hiphotos.baidu.com/exp/pic/item/9e7ce6dcd100baa1f24c14124610b912c9fc2ef3.jpg 113 | [3]: http://www.cnblogs.com/kzloser/articles/2673771.html 114 | [4]: http://hiphotos.baidu.com/exp/pic/item/0db52fadcbef7609a44bca362fdda3cc7dd99e9c.jpg 115 | [5]: http://hiphotos.baidu.com/exp/pic/item/b8405490f603738d28da5f8bb21bb051f919ec4c.jpg 116 | [6]: http://img1.ph.126.net/02bOyioWYQq_C5Tx7B_5kw==/6608261695516619317.jpg 117 | [7]: http://img2.ph.126.net/aaHsj9QW-Xb7_78ZZMP02Q==/1337569089429442568.jpg 118 | [8]: http://img0.ph.126.net/0kk_EoYTW_hI0pzYmntjvw==/2669790154200977454.jpg 119 | [9]: http://img1.ph.126.net/TLmXfGQY4bIslgP_Il_XzA==/1140536605732506364.jpg 120 | [10]: http://img2.ph.126.net/ajm4rD-HFJViFdBsJH8O6w==/57139420373174084.jpg 121 | [11]: http://img2.ph.126.net/pxbM3oOPbx98iPekpufmCw==/4807029652365046394.jpg 122 | -------------------------------------------------------------------------------- /prob/Linux虚拟机网络配置.md: -------------------------------------------------------------------------------- 1 | Linux虚拟机网卡配置 2 | ======================== 3 | 4 | 写在前面 5 | -------------------------- 6 | 本文再网上有很多参考 7 | 本文也转载自很多文章节选一些有用的段落来做参考 8 | 9 | 虚拟机3种有用的网卡配置模式 10 | ------------------------------ 11 | ### Bridged(桥接)方式 12 | 用这种方式,虚拟系统的IP可设置成与本机系统在同一网段,虚拟机相当于网络内的一台独立的机器,与本机共同插在一个集线器上,网络内其他机器可访问虚拟机,虚拟机也可访问网络内其他机器,当然与本机系统的双向访问也不成问题. 13 | ### NAT(网络地址转换)方式 14 | 这种方式也可以实现本机系统与虚拟系统的双向访问.但网络内其他机器不能访问虚拟机,虚拟系统可通过本机系统用NAT协议访问网络内其他机器. 15 | ### host-only方式 16 | 这种方式只能进行虚拟机和主机之间的网络通信,既网络内其他机器不能访问虚拟系统,虚拟系统也不能访问其他机器. 17 | ### 小结 18 | 桥接方式主要是克隆物理机器的网络环境,可以让虚拟机放在真实网络里面做service。 19 | 20 | NAT方式主要是虚拟机用来上网用的。 21 | 22 | Host-only 主要是通过虚拟机与物理机做一个私有网络来做网络连接。 23 | 24 | 25 | 26 | Linux网络设置 27 | ---------------------- 28 | 再ubuntu 14.04中 网卡的配置文件在 /net/network/interfaces 这里 29 | 再RH系列(RHEL CentOS Fedora)中配置文件在 /net/networks这里 30 | 31 | 最常用配置: 32 | 33 | ``` 34 | auto eth1 35 | iface eth1 inet dhcp 36 | ``` 37 | 38 | 让系统自动配置 39 | 至于设定ip地址什么的还是百度一下特定情况比较靠谱 40 | 一般情况下虚拟机默认DHCP 得到ip地址就够用了。 41 | 42 | Linux网络配置其他情况 43 | ---------------------------- 44 | ### 命令临时配置网络 45 | 参考: http://www.cnblogs.com/bo083/archive/2012/11/23/2785172.html 46 | ### 文件配置里面再上文也有。 47 | 不过想要自己手动配置还是需要先了解很多网络概念 48 | 例如网卡的编号eth 网关 子网掩码 路由 等等。 -------------------------------------------------------------------------------- /prob/MacTheme.md: -------------------------------------------------------------------------------- 1 | 2 | Ubuntu 14.04 下的MAC OS X 主题安装 3 | ==================== 4 | 5 | 安装 MAC OS X 主题会帮助你的 Ubuntu 14.04 看起来更像MAC OS X。在这里我们介绍的Macbuntu安装包包含了GTK 主题,这些主题是专门为ubuntu unity定制的。图标主题可以为ubuntu 14.04使用,包括登陆界面引导启动的背景,登陆用户,甚至包括了lightdm 使用webkit的登陆界面。这个安装包是nobslab在bluedxca93的帮助下从gnome-look.org网站上开发的。 6 | 7 | 最终效果图: 8 | ![demo](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-os-x-theme.jpg) 9 | 10 | `files:` 11 | 12 | ![files](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-os-x-theme-desktop.jpg) 13 | 14 | 15 | `music` 16 | 17 | ![music](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-os-x-theme-music.jpg) 18 | 19 | ## 第一步:下载壁纸 20 | 21 | `预览图:` 22 | 23 | ![preview](http://smashingweb.info/wp-content/uploads/2014/04/mac-os-x-wallpapers-for-ubuntu-1404.jpg) 24 | 25 | 第一步要做的事仅仅是下载Mac OS X 的壁纸,下载连接在 [这里](http://drive.noobslab.com/data/Mac-13.10/MBuntu-Wallpapers.zip)这个压缩包的大小有39.2MB。 26 | `解压之后右键点击桌面->修改背景图片->选择下载的背景` 27 | ## 安装主题修改工具 28 | 为了修改GTK主题,图标,系统主题,光标,字体我们需要安装unity tweak。要安装unity tweak在ubuntu14.04上通过使用如下命令: 29 | 30 | ```shell 31 | sudo apt-get install unity-tweak-tool 32 | ``` 33 | 当然你也可以通过安装ubuntu-tweak来实现主题更换 34 | ```shell 35 | sudo add-apt-repository ppa:tualatrix/ppa 36 | sudo apt-get update 37 | sudo apt-get install ubuntu-tweak 38 | ``` 39 | 40 | `效果图:` 41 | 42 | ![](http://smashingweb.info/wp-content/uploads/2014/04/Unity_tweak_tool_1.jpeg) 43 | 44 | ##在ubuntu14.04上安装Mac OS X主题 45 | 为了修改上文所说的内容。我们需要打开终端运行如下命令: 46 | ```bash 47 | sudo add-apt-repository ppa:noobslab/themes 48 | sudo apt-get update 49 | sudo apt-get install mac-ithemes-v3 50 | sudo apt-get install mac-icons-v3 51 | ``` 52 | 现在打开刚才安装的工具来选择主题,在GTK主题上选择MBuntu。再本地tab上选择Mbuntu-osx在光标tab上选择Mac-cursors. 53 | 54 | `如图所示` 55 | 56 | ![](http://smashingweb.info/wp-content/uploads/2014/04/select-mac-theme-ubuntu-1404.jpg) 57 | ![](http://smashingweb.info/wp-content/uploads/2014/04/select-mac-icons-ubuntu-1404.jpg) 58 | ![](http://smashingweb.info/wp-content/uploads/2014/04/select-mac-cursors-ubuntu-1404.jpg) 59 | 60 | 现在unity桌面看起来就像Mac了。你已经有了mac的图标,mac的窗口样式,mac的鼠标指针样式。 61 | 62 | ## 安装类似Mac OS X样式的DOCK在ubuntu14.04上 63 | 64 | Docky是再UBUNTU平台上一个非常轻量级的类似Mac OS X 的dock。 它拥有mac一样的鼠标浮动效果。想要安装需要在终端上运行如下代码: 65 | ```shell 66 | sudo add-apt-repository ppa:docky-core/ppa 67 | sudo apt-get update 68 | sudo apt-get install docky 69 | ``` 70 | ### 安装Mac doc主题: 71 | 下载 [Mac 主题](http://drive.noobslab.com/data/Mac-14.04/Mac-OS-Lion%28Docky%29.tar)从unity启动器上运行docky。你就能看到docky运行再你的屏幕底端了,点击第一个docky配置按钮,选择`3D mode`点击下载主题按钮在上面选择Buyi-idock主题,现在你将会获得Mac OS X很像的dock了。 72 | 73 | `配置图:` 74 | 75 | ![](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-osx-dock.jpg) 76 | 77 | `效果图:` 78 | 79 | ![](http://smashingweb.info/wp-content/uploads/2014/04/docky-theme-ubuntu-1404.jpg) 80 | 81 | ##隐藏unity 启动器 82 | 再外观->行为中可以关闭启动器, 83 | ![](http://smashingweb.info/wp-content/uploads/2014/04/mac-hide-launcher.jpg) 84 | 85 | ## 替换左上角的Ubuntu桌面为Mac OS X 86 | 想要修改成为Mac OS X执行下面命令 87 | ```shell 88 | cd && wget -O Mac.po http://drive.noobslab.com/data/Mac-14.04/change-name-on-panel/mac.po 89 | cd /usr/share/locale/en/LC_MESSAGES; sudo msgfmt -o unity.mo ~/Mac.po;rm ~/Mac.po;cd 90 | ``` 91 | 92 | 想要改回来执行下面命令 93 | 94 | ```shell 95 | cd && wget -O Ubuntu.po http://drive.noobslab.com/data/Mac-14.04/change-name-on-panel/ubuntu.po 96 | cd /usr/share/locale/en/LC_MESSAGES; sudo msgfmt -o unity.mo ~/Ubuntu.po;rm ~/Ubuntu.po;cd 97 | ``` 98 | 99 | `效果图:` 100 | 101 | ![](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-logo.jpg) 102 | 103 | ##替换延迟滚动条为正常滚动条 104 | 想要修改成为正常执行下面命令 105 | ```shell 106 | gsettings set com.canonical.desktop.interface scrollbar-mode normal 107 | ``` 108 | 109 | 想要改回来执行下面命令 110 | 111 | ```shell 112 | gsettings reset com.canonical.desktop.interface scrollbar-mode 113 | ``` 114 | 115 | ## 替换启动屏幕图片 116 | ![](http://smashingweb.info/wp-content/uploads/2014/04/mac-boot-splash-1-4-11.png) 117 | 在这个小章节里面将会为ubuntu 14.04修改启动图片,包括载入动画跟苹果LOGO 118 | 命令如下 119 | ```shell 120 | sudo add-apt-repository ppa:noobslab/themes 121 | sudo apt-get update 122 | sudo apt-get install mbuntu-bscreen-v3 123 | ``` 124 | 想要修改回来: 125 | ```shell 126 | sudo apt-get remove mbuntu-bscreen-v3 127 | ``` 128 | 129 | ##修改Ubuntu14.04的登陆画面成为Mac OS X的样式 130 | ![](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-osx-login.jpg) 131 | 安装: 132 | ```shell 133 | sudo add-apt-repository ppa:noobslab/themes 134 | sudo apt-get update 135 | sudo apt-get install mbuntu-lightdm-v3 136 | ``` 137 | 修改回来: 138 | ```shell 139 | sudo apt-get remove mbuntu-lightdm-v3 140 | ``` 141 | 142 | ##去掉ubuntu 14.04锁屏的图标 143 | ![](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-lock-screen.jpg) 144 | 去掉logo: 145 | ```shell 146 | sudo xhost +SI:localuser:lightdm 147 | sudo su lightdm -s /bin/bash 148 | gsettings set com.canonical.unity-greeter draw-grid false;exit 149 | sudo mv /usr/share/unity-greeter/logo.png /usr/share/unity-greeter/logo.png.backup 150 | ``` 151 | 如果想改回来: 152 | ```shell 153 | sudo xhost +SI:localuser:lightdm 154 | sudo su lightdm -s /bin/bash 155 | gsettings set com.canonical.unity-greeter draw-grid true;exit 156 | sudo mv /usr/share/unity-greeter/logo.png.backup /usr/share/unity-greeter/logo.png 157 | ``` 158 | 159 | ##ubuntu14.04安装Mac字体 160 | 下载与安装字体: 161 | ```shell 162 | wget -O mac-fonts.zip http://drive.noobslab.com/data/Mac-14.04/macfonts.zip 163 | sudo unzip mac-fonts.zip -d /usr/share/fonts; rm mac-fonts.zip 164 | sudo fc-cache -f -v 165 | ``` 166 | 配置: 167 | 启动tweak tool在字体选择上选择苹果系列的字体或者lucida Mac 字体,然后根据你的屏幕来调整字体。 168 | ![](http://smashingweb.info/wp-content/uploads/2014/04/ubuntu-1404-mac-osx-fonts.jpg) 169 | 170 | ##小伙伴们的测试结果 171 | ![](../picture/MacTheme/1.jpg) 172 | ![](../picture/MacTheme/2.jpg) 173 | ![](../picture/MacTheme/3.jpg) 174 | ![](../picture/MacTheme/4.jpg) 175 | ##更多帮助登陆[ubtamator](http://ubtamator.github.io/) 176 | ##寻找小伙伴,群:55958311 177 | 178 | > 翻译:PHILO 179 | 180 | > 内容调整:PHILO 181 | 182 | > 原文地址:http://smashingweb.info/mac-os-x-theme-for-ubuntu-14-04-macbuntu-transformation-pack/#userconsent# 183 | -------------------------------------------------------------------------------- /prob/PHPweb开发学习路线.md: -------------------------------------------------------------------------------- 1 | # PHPweb开发学习路线 2 | 3 | 本文适用人群:不是网站开发新手。懂得基本http通讯。 4 | 5 | 文档目的:帮助需要的人快速入门php快速完成自己的需求。 6 | 7 | 本文设定世界观: 8 | 9 | 1. 学习的语言没有好坏之分,只有特征是否适合你使用。 10 | 1. 学习一门编程语言只是为了实现自己的想法而不是为了语言而学。当然如果您学习的只是为了人前炫技, 11 | 那么请您右转直走。红叉不送。 12 | ##如果您是开发新手: 13 | 14 | 1. 那么请先熟悉一下开发环境,先安装环境,按照一般的环境配置教程搞出hello world! 15 | 1. 然后从程序的基本原理出发,先从熟悉变量的定义,修改开始熟悉。 16 | 1. 然后熟悉逻辑顺序,循环分支,判断熟悉一下。 17 | 1. 然后是函数,对象的熟悉, 18 | 19 | **注意:** 20 | 21 | 1. 只需要熟悉基本算法就可以了。 22 | 1. 功能性的API可以在需求中自己慢慢熟悉。 23 | 1. 多写几个case之后,就可以开始下面的学习路线了。 24 | 25 | 26 | ##大体学习路线: 27 | 28 | 1. 首先需要对http通讯要有一个长足的了解。 29 | 1. 从原理上理解mvc 30 | 1. 之后你再web开发上需要什么你就到php里面找什么去。 31 | 32 | ## 为啥要加前两点? 33 | 34 | 加上前两点之后就可以把php的学习从被动变成主动,并且对学习其他编程语言 35 | web分布式等等灵活的建站方法一网打尽。 36 | 37 | ## 更加具体的好处: 38 | 39 | 如果刚开始的时候确实能理解网站服务器的运行方式跟基本通讯是怎么做到的。 40 | 那么学习php就跟查资料差不多了。我们只需要根据我们想要的东西到网上查询 41 | 到书上看,或者看视频你获取直接经验,都可以以带着问题跟目的的方式去学PHP 42 | 这样就可以很快的切入实战了。 43 | 44 | # 以下部分知识我个人的粗浅理解,仅供参考 45 | 46 | ## 当一个浏览器requre一个业务ajax post连接的时候发生的一系列的事情: 47 | 48 | 1. 首先访问DNS服务器,负责对request的连接位置进行服务器定位。(数据包中的**remote address**) 49 | 比如说有一些网站有很多个服务器,现在DNS服务器可以根据你不同线路访问来的reques进行分流。 50 | 比如说你request里面的位置信息(IP)地址是联通的,那么DNS服务器会返回该网站联通网络的服务器。 51 | 以做到更好的上网体验。不仅仅是选择网络往往CDN分布式资源下载这种服务会根据你的地区和网络选择服务器来获取资源。 52 | 1. 通过DNS得到具体哪个服务器的地址,以及服务器上的地址位置之后,就可以开始进行表单输入(**request method**:POST)了。(**request URL**) 53 | 1. 网络通讯可以正式开始了。 54 | 1. 通讯的时候双方都是有一组headers来标记通讯的内容。 55 | 1. 遵循你来我往的无状态连接(短链接只连接一次的无状态连接) 56 | 1. 浏览器向服务器发送的数据包内容(关键部分) 57 | 1. accept 下所有的内容都是关于告诉服务器我能接受什么样的返回格式 58 | 1. UserAgent 浏览器版本定义 59 | 1. Query string parameter 表单内所有需要传输给服务器的数据 60 | 1. Cookie 你懂得 61 | 62 | 1. 服务器向浏览器返回的数据包内容解析: 63 | 1. Set-Cookiei 通知浏览器保存cookie 64 | 1. Content-Encoding 返回的编码格式 65 | 1. 之后就是response的内容了。当然是没有限制的,图片文字都可以,大小不限,大小不限的意思就是http下载了。 66 | 1. 通讯结束后有一个通讯状态的code 就是传说中的200 为成功, 大名鼎鼎的404都是来自这的。 67 | 68 | 69 | -------------------------------------------------------------------------------- /prob/qqOnLinux.md: -------------------------------------------------------------------------------- 1 | # Linux系统下QQ使用方法 2 | # AUTH:服部半藏 EDIT:PHILO 3 | QQ作为常用的即时通讯工具,在我们的生活中扮演了很重要的角色。但是QQ在windows,MAC OSX和移动设备上使用起来很方便,但是在Linux上的表现却不尽如人意。下面就介绍几种常用的方法。 4 | ## Web QQ 5 | WEB QQ(Web QQ腾讯公司推出的使用网页方式上QQ的服务,特点是无需下载和安装QQ软件,只要能打开Web QQ的网站就可以登录QQ与好友保持联系。具有Web产品固有的便利性,同时在Web上最大限度的保持了客户端软件的操作习惯。更丰富的好友动态、更开阔的聊天模式、更实时的资讯查看、还有休闲音乐伴随,Web QQ将为我们提供一个愉快的网络起点。2009年9月15日正式上线。) 6 | 7 | ### [webqq 传送门](http://web2.qq.com/) 8 | 9 | ### 使用方法 10 | + 打开浏览器,输入webqq,点击搜索 11 | 12 | ![w1](../picture/wqq/w1.png) 13 | 14 | + 找到“我的QQ – 能在网页上直接聊QQ”单击进入 15 | 16 | ![w2](../picture/wqq/w2.png) 17 | 18 | + 打开后显示如下界面(在这里要提示一下smart QQ是在原版QQ上做的改善,只保留了常用的几个功能,更像是手机QQ,而原版web QQ则偏重于娱乐,里面可以添加各种小应用,更像是一个操作系统,以个人喜好而定) 19 | 20 | ![w3](../picture/wqq/w3.png) 21 | 22 | + 我们先选择原版web QQ,单击后进入一个类似于windows桌面的界面,里面有一些预设的小应用,当然也可以自己添加。 23 | 24 | ![w4](../picture/wqq/w4.png) 25 | 26 | + 点击左边栏的QQ图标,会弹出登陆框,这时输入用户名密码,点击登录即可。 27 | 28 | ![w5](../picture/wqq/w5.png) 29 | 30 | + 登陆后的界面如图所示 31 | 32 | ![w6](../picture/wqq/w6.png) 33 | 34 | + 点击smart QQ后会弹出如下界面,直接登陆即可 35 | 36 | ![w7](../picture/wqq/w7.png) 37 | 38 | + 陆后界面如下,非常类似于手机QQ 39 | 40 | ![w8](../picture/wqq/w8.png) 41 | 42 | 43 | ## Lwqq安装及使用方法 44 | 45 | ### 安装篇: 46 | 47 | + 在左边栏找到软件中心并单击打开 48 | 49 | ![lw1](../picture/lwqq/l1.jpg) 50 | 51 | 52 | + 搜索软件pidgin Internet message并安装 53 | 54 | ![lw2](../picture/lwqq/l2.jpg) 55 | 56 | 57 | + 依次输入下面三条命令 58 | 59 | ```bash 60 | sudo add-apt-repository ppa:lainme/pidgin-lwqq 61 | sudo apt-get update 62 | sudo apt-get install pidgin-lwqq 63 | #end of install 64 | ``` 65 | 66 | 67 | ### 使用篇 68 | + 首先在侧边栏找到pidgin并单击打开 69 | 70 | ![lw3](../picture/lwqq/l3.jpg) 71 | 72 | + 看到欢迎界面后单击“add”按钮添加账号 73 | 74 | ![lw4](../picture/lwqq/l4.jpg) 75 | 76 | 77 | + 在Protocol下拉菜单里找到WebQQ并单击 78 | 79 | ![lw5](../picture/lwqq/l5.jpg) 80 | 81 | + 输入用户名和密码单击”add“即可登录 82 | 83 | ![lw6](../picture/lwqq/l6.jpg) 84 | 85 | 86 | + 登陆后效果图 87 | 88 | ![lw7](../picture/lwqq/l7.jpg) 89 | 90 | 91 | 92 | ## 至于wineqq 当然会介绍啦 93 | [下载地址](http://www.longene.org/forum/viewtopic.php?t=4700) 94 | 95 | ### 优点: 界面漂亮 96 | ### 缺点: 兼容性插件 64bit需要装32比他的库 , 不稳定。 97 | 98 | ## 注意: 进入网页下载后一定要看安装说明。 99 | 100 | ``` 101 | 首先安装wineQQ2013地址(http://pan.baidu.com/s/1c0y7Ros) 102 | 如果是32位操作系统,第一次使用时输入命令 103 | sudo bash /opt/longene/qq/qq.sh 104 | 然后即可运行,以后运行时按windows键,输入QQ,看到QQ的图标单击即可 105 | 106 | 107 | 108 | 对于64位操作系统,由于缺少32位库,因此操作相对麻烦 109 | 依次执行命令 110 | sudo apt-get install lib32ncurses5 111 | sudo apt-get install lib32z1 112 | sudo apt-get install lib32bz2-1.0 113 | sudo apt-get install libgtk2.0-0:i386 114 | 执行完之后就可以像32位系统一样操作了,第一次使用时输入命令 115 | sudo bash /opt/longene/qq/qq.sh 116 | 然后即可运行,以后运行时按windows键,输入QQ,看到QQ的图标单击即可 117 | ``` 118 | 119 | 120 | 121 | ## Android QQ 122 | loading... 123 | 124 | -------------------------------------------------------------------------------- /prob/test.py: -------------------------------------------------------------------------------- 1 | #encoding:utf-8 2 | import json 3 | import urllib 4 | import urllib2 5 | import sys 6 | import yaml 7 | import os 8 | # 依赖解决: pip install pyyaml 9 | case = yaml.load(file(sys.argv[1])) #从控制台输入配置文件 10 | 11 | DevCode="273c5cd2d4cce23c32dc5655685aff4c" # ajax通用安全参数接入,不推荐Cookie操作因为每次ajax都会传送Cookie。流量很高。 12 | ReqToken="" 13 | AccessToken="" 14 | Gindex=0 15 | baseurl = 'http://127.0.0.1:9090' 16 | 17 | # post ajax post helper 18 | def post(url,value): 19 | print "post to :",baseurl+url 20 | data = urllib.urlencode(value) 21 | req = urllib2.Request(baseurl+url, data) 22 | response = urllib2.urlopen(req) 23 | the_page = response.read() 24 | return the_page 25 | 26 | # check_error 针对ajax返回结果判断服务器有没有报错 27 | def check_error(resp): 28 | if json.loads(resp)['status']['code'] != '200': 29 | print resp 30 | print 'response error' 31 | return 1 32 | return 0 33 | 34 | # inittoken_customer customer 类型token 初始化,其实是帮助登录的 35 | def inittoken_customer(): 36 | resp = post("XXXXXXXXXXXXXXXXXXXX",{ 37 | 'XXXXXXXXXXXX':"ea66f04", 38 | 'XXXXXXXXX':"c7465f402bb3f02a585f57c634d579fc" 39 | }) 40 | if check_error(resp) != 0 : 41 | return 42 | ReqToken = json.loads(resp)["data"][0]['request_token'] 43 | return ReqToken 44 | 45 | # inittoken_shop 跟上面类似是商家端 46 | def inittoken_shop(): 47 | resp = post("XXXXXXXXXXXXXXXXXXXX",{ 48 | 'XXXXXXXXXXXXXXXXXXXX':"f8ccab8", 49 | 'XXXXXXXXXXXXXXXXXXXX':"273c5cdbd4cce2cc32dc5655685a6f4c" 50 | }) 51 | if check_error(resp) != 0 : 52 | return 53 | ReqToken = json.loads(resp)["data"][0]['request_token'] 54 | return ReqToken 55 | 56 | # login_customer 客户登录 57 | def login_customer(): 58 | resp = post("XXXXXXXXXXXXXXXXXXXX",{ 59 | 'XXXXXXXXXXXXXXXXXXXX':ReqToken, 60 | 'username':"XXXXXXXXXXXXXXXXXXXX@nou.com.cn", 61 | 'password':"123", 62 | 'code':DevCode 63 | }) 64 | if check_error(resp) != 0 : 65 | return 66 | return json.loads(resp)["data"][0]['access_token'] 67 | 68 | # login_customer 商家登录 69 | def login_shop(): 70 | resp = post("XXXXXXXXXXXXXXXXXXXX",{ 71 | 'XXXXXXXXXXXXXXXXXXXX':ReqToken, 72 | 'username':"XXXXXXXXXXXXXXXXXXXX@gmail.com", 73 | 'password':"123", 74 | 'code':DevCode 75 | }) 76 | if check_error(resp) != 0 : 77 | return 78 | return json.loads(resp)["data"][0]['access_token'] 79 | 80 | # get_token_time 查看token剩余有效时间 81 | def get_token_time(token): 82 | resp = post("XXXXXXXXXXXXXXXXXXXX",{ 83 | 'XXXXXXXXXXXXXXXXXXXX':token, 84 | }) 85 | return resp 86 | 87 | # printJSON 格式化JSON输出 88 | def printJSON(src): 89 | print json.dumps(json.loads(src),indent=2) 90 | 91 | 92 | ## 开始主要测试业务 93 | 94 | # init token 95 | 96 | baseurl = case['server'] # 登录 97 | if case['login']=='customer': 98 | ReqToken = inittoken_customer() 99 | AccessToken = login_customer() 100 | else: 101 | ReqToken = inittoken_shop() 102 | AccessToken = login_shop() 103 | 104 | # 执行yaml中的test case 105 | for testcase in case['case']: 106 | if testcase['data'] == 'null': 107 | testcase['data'] = dict() 108 | testcase['data']['access_token']=AccessToken 109 | testcase['data']['request_token']=ReqToken 110 | testcase['data']['code']=DevCode 111 | printJSON(post(testcase['src'],testcase['data'])) 112 | -------------------------------------------------------------------------------- /pythondev/.vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible " be iMproved, required 2 | filetype off " required 3 | 4 | " set the runtime path to include Vundle and initialize 5 | set rtp+=~/.vim/bundle/Vundle.vim 6 | call vundle#begin() 7 | " alternatively, pass a path where Vundle should install plugins 8 | "call vundle#begin('~/some/path/here') 9 | 10 | " let Vundle manage Vundle, required 11 | Plugin 'gmarik/Vundle.vim' 12 | Plugin 'Shougo/neocomplete.vim' 13 | Plugin 'majutsushi/tagbar.git' 14 | Plugin 'scrooloose/nerdtree.git' 15 | Plugin 'wincent/command-t' 16 | Plugin 'Lokaltog/vim-powerline' 17 | " Plugin 'hdima/python-syntax' 18 | call vundle#end() " required 19 | filetype plugin indent on " required 20 | set shiftwidth=4 21 | set wrap 22 | " To ignore plugin indent changes, instead use: 23 | "filetype plugin on 24 | " 25 | " Brief help 26 | " :PluginList - lists configured plugins 27 | " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate 28 | " :PluginSearch foo - searches for foo; append `!` to refresh local cache 29 | " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal 30 | " 31 | " see :h vundle for more details or wiki for FAQ 32 | " Put your non-Plugin stuff after this line 33 | " 34 | 35 | " 代码高亮用的 36 | syntax enable 37 | filetype plugin on 38 | set number 39 | 40 | " 颜色配置 41 | colorscheme molokai 42 | 43 | " 标签映射 44 | execute "set =\ei" 45 | execute "set =\eo" 46 | execute "set =\ep" 47 | execute "set =\eu" 48 | execute "set =\el" 49 | execute "set =\en" 50 | execute "set =\ey" 51 | execute "set =\ec" 52 | 53 | nmap :TagbarToggle 54 | imap :TagbarTogglei 55 | nmap :NERDTreeToggle 56 | imap :NERDTreeToggle 57 | nmap :q 58 | nmap :tabn 59 | imap :tabn 60 | nmap :tabp 61 | imap :tabp 62 | nmap :undo 63 | nmap :w 64 | imap :w 65 | imap :pc 66 | nmap :pc 67 | nmap :w:PymodeLint 68 | imap :w:PymodeLint 69 | 70 | " find reference用的是新开窗口 new是上下分,vnew是左右分 71 | let g:pymode_rope_goto_definition_cmd = 'e' 72 | let g:pymode_rope_goto_definition_bind = '' 73 | 74 | set backspace=indent,eol,start " 让backspace能正常工作的配置 75 | 76 | " 这是对PowerLine的设置 77 | set encoding=utf-8 78 | set laststatus=2 79 | let g:Powerline_symbols='unicode' 80 | 81 | " tab设置 82 | set ts=4 83 | set expandtab 84 | -------------------------------------------------------------------------------- /pythondev/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7.10 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev 5 | RUN apt-get install -y rubygems vim-nox locales xfonts-utils fontconfig ctags ruby-dev 6 | RUN mkdir -p ~/.vim/bundle && git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 7 | RUN curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/pythondev/.vimrc -o ~/.vimrc 8 | RUN curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/.bashrc -o ~/.bashrc 9 | RUN mkdir ~/.vim/colors/ && curl -Ssl https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim -o ~/.vim/colors/molokai.vim 10 | RUN vim "+PluginInstall" "+qall" 11 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen "en_US.UTF-8" 12 | RUN mkdir ~/.font/ && cd ~/.font/ && git clone https://github.com/eugeii/consolas-powerline-vim.git && cd consolas-powerline-vim/ && cp *.ttf .. && cd .. && rm -rf consolas-powerline-vim/ && mkfontscale && mkfontdir && fc-cache -vf 13 | RUN cd ~/.vim/bundle/command-t/ruby/command-t && ruby extconf.rb && make 14 | RUN cd ~ && git clone git://github.com/klen/python-mode.git &&cd python-mode && cp -R * ~/.vim && cd ~ && rm -rf python-mode 15 | RUN git clone http://github.com/vim/vim && cd vim && ./configure --enable-pythoninterp=yes --enable-rubyinterp=yes --enable-luainterp=yes && make && make install && cd .. && rm -rf vim 16 | 17 | -------------------------------------------------------------------------------- /rsakey/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcTvSn5METOJUKXRr+Sa92eL2PRZlHb5tdKMublwgvHWaYNxJyXrxCARmBCy8VAo6rb/OeTsyuMWjZ7fVpxKc32ZkcBoIRL7YNkAonO8nHMSLvWUSKkwo7wfWubJhBQtDjvJ40WIcECrFkssFxbcl9YuUeZjdclmcylBkfwzdHJl7c3NtOjtCosN1RUDQZZJEJzKpSNcYtX/D1fPY9MovDWAeQ+xcLb6Gy5rnCTfyGgZDowyDpFNNe+j0a9G1zjlEww3GvOD/UUIf7hDaji+HjO8/sLfHjfAWWULStoEl/aUoofs93QVQFxCPOeYnZR/QL8MkfXQmwme7Nv7xBeqrt Li-jianying@lijianyings-MacBook-Pro.local 2 | -------------------------------------------------------------------------------- /rsakey/id_rsa.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/rsakey/id_rsa.zip -------------------------------------------------------------------------------- /rsakey/ppk.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijianying10/FixLinux/ba62087503e21c21e9dff89f74a03a7a24e2e3d1/rsakey/ppk.zip -------------------------------------------------------------------------------- /script/caidanhezidev: -------------------------------------------------------------------------------- 1 | tmux new -d -n 'vim' -s '菜单盒子开发' 2 | tmux new-window -n 'runner' -t 菜单盒子开发:2 3 | tmux new-window -n 'tester' -t 菜单盒子开发:3 4 | tmux new-window -n 'loger' -t 菜单盒子开发:4 5 | tmux new-window -n 'db' -t 菜单盒子开发:5 6 | tmux attach -t 菜单盒子开发 7 | -------------------------------------------------------------------------------- /script/cleandocker: -------------------------------------------------------------------------------- 1 | docker kill $(docker ps -qa); docker rm $(docker ps -qa); 2 | -------------------------------------------------------------------------------- /script/db.sh: -------------------------------------------------------------------------------- 1 | docker run -dt --name cmysql -e MYSQL_ROOT_PASSWORD=1 -p 3306:3306 mysql:5.6 2 | docker run -dt --name credis -p 6379:6379 redis 3 | -------------------------------------------------------------------------------- /script/e: -------------------------------------------------------------------------------- 1 | docker exec -it $1 /bin/bash 2 | -------------------------------------------------------------------------------- /script/env.sh: -------------------------------------------------------------------------------- 1 | curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/.vimrc -o ~/.vimrc 2 | curl -Ssl https://raw.githubusercontent.com/lijianying10/FixLinux/master/dotfile/.bashrc -o ~/.bashrc 3 | cat > ~/.gitconfig << EOF 4 | [push] 5 | default = simple 6 | [credential] 7 | helper = store 8 | [user] 9 | name = 李建赢 10 | email = lijianying12@gmail.com 11 | EOF 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /script/freem: -------------------------------------------------------------------------------- 1 | free -h | awk 'NR==2{print $3}' 2 | -------------------------------------------------------------------------------- /script/k: -------------------------------------------------------------------------------- 1 | docker run -it --name kkk -d -p 445:22 -v /usr/local/bin/docker:/usr/local/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -e 'PUBKEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcTvSn5METOJUKXRr+Sa92eL2PRZlHb5tdKMublwgvHWaYNxJyXrxCARmBCy8VAo6rb/OeTsyuMWjZ7fVpxKc32ZkcBoIRL7YNkAonO8nHMSLvWUSKkwo7wfWubJhBQtDjvJ40WIcECrFkssFxbcl9YuUeZjdclmcylBkfwzdHJl7c3NtOjtCosN1RUDQZZJEJzKpSNcYtX/D1fPY9MovDWAeQ+xcLb6Gy5rnCTfyGgZDowyDpFNNe+j0a9G1zjlEww3GvOD/UUIf7hDaji+HjO8/sLfHjfAWWULStoEl/aUoofs93QVQFxCPOeYnZR/QL8MkfXQmwme7Nv7xBeqrt Li-jianying@lijianyings-MacBook-Pro.local' kkk:kk1 2 | -------------------------------------------------------------------------------- /script/xdev: -------------------------------------------------------------------------------- 1 | tmux new -d -n 'vim' -s $1 2 | tmux new-window -n 'runner' -t $1:2 3 | tmux new-window -n 'tester' -t $1:3 4 | tmux new-window -n 'loger' -t $1:4 5 | tmux new-window -n 'db' -t $1:5 6 | tmux attach -t $1 7 | -------------------------------------------------------------------------------- /st2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | COPY st2ctl st2.conf supervisord.conf docker-entrypoint.sh / 3 | RUN apt-get update && apt-get install -y build-essential wget gnupg-curl curl sudo apache2-utils vim apt-utils supervisor && os=ubuntu dist=xenial curl -s https://packagecloud.io/install/repositories/StackStorm/stable/script.deb.sh | sudo bash && apt-get update && apt-get install -y st2 && apt-key adv --fetch-keys http://nginx.org/keys/nginx_signing.key && echo 'deb http://nginx.org/packages/ubuntu/ xenial nginx' >> /etc/apt/sources.list.d/nginx.list && apt-get update && apt-get install -y st2web nginx && rm /etc/nginx/conf.d/default.conf && cp /usr/share/doc/st2/conf/nginx/st2.conf /etc/nginx/conf.d/ && curl -o /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl && chmod +x /bin/kubectl && wget https://github.com/krallin/tini/releases/download/v0.14.0/tini-amd64 -O /bin/tini && chmod +x /bin/tini && mv /st2.conf /etc/st2/ && mv supervisord.conf /etc/supervisor/supervisord.conf && mv /st2ctl /usr/bin/st2ctl && chmod +x /usr/bin/st2ctl && curl -SsL https://bootstrap.pypa.io/get-pip.py | python && pip install && wget https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz && tar xf docker-17.05.0-ce.tgz && mv docker/docker /bin/docker && rm -rf docker docker-17.05.0-ce.tgz 4 | ENTRYPOINT ["/bin/tini", "--"] 5 | CMD bash /docker-entrypoint.sh 6 | -------------------------------------------------------------------------------- /st2/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | echo generate ssh key 2 | ssh-keygen -f /root/.ssh/id_rsa -P "" && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys 3 | 4 | echo generate user 5 | printf "%s\n" "${USER_NAME:?Need to set USER_NAME non-empty}" 6 | printf "%s\n" "${USER_PASSWORD:?Need to set USER_PASSWORD non-empty}" 7 | echo $USER_PASSWORD | sudo htpasswd -i /etc/st2/htpasswd $USER_NAME 8 | 9 | echo generate cert 10 | sudo mkdir -p /etc/ssl/st2 11 | sudo openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/st2/st2.key -out /etc/ssl/st2/st2.crt \ 12 | -days 365 -nodes -subj "/C=US/ST=California/L=Palo Alto/O=StackStorm/OU=Information \ 13 | Technology/CN=$(hostname)" 14 | 15 | printf "%s\n" "${CONN_RMQ:?Need to set CONN_RMQ non-empty}" 16 | printf "%s\n" "${MONGO_HOST:?Need to set MONGO_HOST non-empty}" 17 | printf "%s\n" "${MONGO_DB:?Need to set MONGO_DB non-empty}" 18 | printf "%s\n" "${MONGO_PORT:?Need to set MONGO_PORT non-empty}" 19 | cat >> /etc/st2/st2.conf </dev/null | grep -q upstart) && 99 | [ -f /etc/init/${svcname}.conf ]; then 100 | # init is running, and is upstart and service config is available 101 | # ! upstart running detection is a MUST, since upstart can be just 102 | # ! installed on a platform but not used (ex: docker container, centos). 103 | /sbin/initctl $action $svcname 104 | elif command -v service > /dev/null 2>&1; then 105 | supervisorctl $action $svcname 106 | elif [ -x /etc/init.d/${1} ]; then 107 | /etc/init.d/$svcname $action 108 | else 109 | echo -e "\e[31mError: Unknown service manager, we ONLY support systemd, upstart and sysv! \e[0m\n" 110 | exit 1 111 | fi 112 | } 113 | 114 | # Next candidate for removal 115 | # after we implement native `service st2component reopen` (nginx example) for each component 116 | function reopen_component_log_files() { 117 | COM=${1} 118 | 119 | PID=`ps ax | grep -v grep | grep -v st2ctl | grep "${COM}" | awk '{print $1}'` 120 | if [[ ! -z ${PID} ]]; then 121 | for p in ${PID}; do 122 | echo "Sending SIGUSR1 to ${COM} PID: ${p}" 123 | kill -USR1 ${p} 124 | done 125 | else 126 | echo "${COM} is not running" 127 | return 1 128 | fi 129 | } 130 | 131 | function register_content() { 132 | ALLOWED_REGISTER_FLAGS='--register-all --register-actions --register-aliases --register-runners --register-policies --register-rules --register-sensors --register-triggers --register-configs --register-setup-virtualenvs --register-fail-on-failure --register-no-fail-on-failure --verbose' 133 | DEFAULT_REGISTER_FLAGS='--register-runners --register-actions --register-aliases --register-sensors --register-triggers --register-configs --register-rules' 134 | 135 | SUDO_FLAGS='--register-setup-virtualenvs' 136 | flags="${@}" 137 | 138 | if [ ! -z ${1} ]; then 139 | for flag in ${flags}; do 140 | if [[ " ${SUDO_FLAGS} " == *" $flag "* && "$(id -u)" != "0" ]]; then 141 | echo -e "\e[31mError: \"sudo\" required for: ${flag} \e[0m\n" 142 | exit 1 143 | fi 144 | if [[ " ${ALLOWED_REGISTER_FLAGS} " != *" $flag "* ]]; then # argument not allowed 145 | echo -e "\e[31mError: Invalid flag provided: ${flag} \e[0m\n" 146 | print_usage 147 | exit 1 148 | fi 149 | done 150 | fi 151 | 152 | if [ -z ${1} ]; then 153 | REGISTER_FLAGS=${DEFAULT_REGISTER_FLAGS} 154 | elif [ ${1} == '--verbose' ] && [ -z ${2} ]; then 155 | REGISTER_FLAGS="$DEFAULT_REGISTER_FLAGS ${1}" 156 | else 157 | REGISTER_FLAGS=${flags} 158 | fi 159 | 160 | echo "Registering content...[flags = --config-file ${STANCONF} ${REGISTER_FLAGS}]" 161 | st2-register-content --config-file ${STANCONF} ${REGISTER_FLAGS} 162 | } 163 | 164 | function clean_db() { 165 | echo "Dropping st2 Database..." 166 | mongo st2 --eval "db.dropDatabase();" 167 | } 168 | 169 | function clean_logs() { 170 | echo "Cleaning st2 Logs..." 171 | rm -Rf /var/log/st2/* 172 | } 173 | 174 | function getpids() { 175 | echo "##### st2 components status #####" 176 | COMPONENTS=${COMPONENTS/mistral/mistral-server mistral-api} 177 | 178 | for COM in ${COMPONENTS}; do 179 | PID=`ps ax | grep -v grep | grep -v st2ctl | grep "${COM}" | awk '{print $1}'` 180 | 181 | if [[ ! -z ${PID} ]]; then 182 | for p in ${PID}; do 183 | echo "${COM} PID: ${p}" 184 | done 185 | else 186 | echo "${COM} is not running." 187 | fi 188 | done 189 | } 190 | 191 | 192 | case ${1} in 193 | start) 194 | must_be_root 195 | st2start 196 | getpids 197 | ;; 198 | stop) 199 | must_be_root 200 | st2stop 201 | ;; 202 | restart) 203 | must_be_root 204 | st2stop 205 | sleep 1 206 | st2start 207 | getpids 208 | ;; 209 | restart-component) 210 | must_be_root 211 | validate_in_components ${2} 212 | service_manager ${2} restart 213 | ;; 214 | reopen-log-files) 215 | must_be_root 216 | validate_in_components ${2} 217 | if reopen_component_log_files ${2}; then 218 | sleep 1 219 | getpids 220 | fi 221 | ;; 222 | reload) 223 | register_content ${@:2} 224 | exit_code=$? 225 | getpids 226 | # Note: We want to preserve st2-register-content "fail on failure" behavior 227 | # and propagate the correct exit code and exit with non zero on failure 228 | exit ${exit_code} 229 | ;; 230 | clean) 231 | must_be_root 232 | echo "This will drop the database and delete all logs. Are you sure [y/n]?" 233 | read verify 234 | if [[ "$verify" == "y" ]]; then 235 | st2stop 236 | clean_db 237 | clean_logs 238 | register_content ${@:2} 239 | st2start 240 | getpids 241 | else 242 | exit 243 | fi 244 | ;; 245 | status) 246 | getpids 247 | ;; 248 | *) 249 | print_usage 250 | exit 1 251 | ;; 252 | esac 253 | -------------------------------------------------------------------------------- /st2/supervisord.conf: -------------------------------------------------------------------------------- 1 | ; supervisor config file 2 | 3 | [unix_http_server] 4 | file=/var/run/supervisor.sock ; (the path to the socket file) 5 | chmod=0700 ; sockef file mode (default 0700) 6 | 7 | [inet_http_server] 8 | port = 127.0.0.1:9001 9 | 10 | [supervisord] 11 | logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) 12 | pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 13 | childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) 14 | nodaemon=true 15 | 16 | [supervisorctl] 17 | serverurl=http://127.0.0.1:9001 18 | ; the below section must remain in the config file for RPC 19 | ; (supervisorctl/web interface) to work, additional interfaces may be 20 | ; added by defining them in separate rpcinterface: sections 21 | [rpcinterface:supervisor] 22 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 23 | 24 | ; The [include] section can just contain the "files" setting. This 25 | ; setting can list multiple files (separated by whitespace or 26 | ; newlines). It can also contain wildcards. The filenames are 27 | ; interpreted as relative to this file. Included files *cannot* 28 | ; include files themselves. 29 | 30 | [include] 31 | files = /etc/supervisor/conf.d/*.conf 32 | 33 | [program:st2actionrunner] 34 | command=/opt/stackstorm/st2/bin/st2actionrunner --config-file /etc/st2/st2.conf 35 | redirect_stderr = true 36 | stdout_logfile_maxbytes = 200MB 37 | stdout_logfile_backups = 20 38 | stdout_logfile = /var/log/st2actionrunner.log 39 | stderr_logfile = /var/log/st2actionrunner.log 40 | user=root 41 | numprocs=10 42 | process_name=st2actionrunner%(process_num)s 43 | autorestart=true 44 | startsecs=10 45 | stopwaitsecs = 60 46 | killasgroup=true 47 | 48 | [program:st2api] 49 | command=/opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2api/gunicorn_config.py -k eventlet -b 127.0.0.1:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 50 | redirect_stderr = true 51 | stdout_logfile_maxbytes = 200MB 52 | stdout_logfile_backups = 20 53 | stdout_logfile = /var/log/st2api.log 54 | stderr_logfile = /var/log/st2api.log 55 | user=root 56 | numprocs=1 57 | autorestart=true 58 | startsecs=5 59 | stopwaitsecs = 60 60 | killasgroup=true 61 | 62 | [program:st2auth] 63 | command=/opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2auth/gunicorn_config.py -k eventlet -b 127.0.0.1:9100 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 64 | redirect_stderr = true 65 | stdout_logfile_maxbytes = 200MB 66 | stdout_logfile_backups = 20 67 | stdout_logfile = /var/log/st2auth.log 68 | stderr_logfile = /var/log/st2auth.log 69 | user=root 70 | numprocs=1 71 | autorestart=true 72 | startsecs=10 73 | stopwaitsecs = 60 74 | killasgroup=true 75 | 76 | [program:st2garbagecollector] 77 | command=/opt/stackstorm/st2/bin/st2garbagecollector --config-file /etc/st2/st2.conf 78 | redirect_stderr = true 79 | stdout_logfile_maxbytes = 200MB 80 | stdout_logfile_backups = 20 81 | stdout_logfile = /var/log/st2garbagecollector.log 82 | stderr_logfile = /var/log/st2garbagecollector.log 83 | user=root 84 | numprocs=1 85 | autorestart=true 86 | startsecs=10 87 | stopwaitsecs = 60 88 | killasgroup=true 89 | 90 | [program:st2notifier] 91 | command=/opt/stackstorm/st2/bin/st2notifier --config-file /etc/st2/st2.conf 92 | redirect_stderr = true 93 | stdout_logfile_maxbytes = 200MB 94 | stdout_logfile_backups = 20 95 | stdout_logfile = /var/log/st2notifier.log 96 | stderr_logfile = /var/log/st2notifier.log 97 | user=root 98 | numprocs=1 99 | autorestart=true 100 | startsecs=10 101 | stopwaitsecs = 60 102 | killasgroup=true 103 | 104 | [program:st2resultstracker] 105 | command=/opt/stackstorm/st2/bin/st2resultstracker --config-file /etc/st2/st2.conf 106 | redirect_stderr = true 107 | stdout_logfile_maxbytes = 200MB 108 | stdout_logfile_backups = 20 109 | stdout_logfile = /var/log/st2resultstracker.log 110 | stderr_logfile = /var/log/st2resultstracker.log 111 | user=root 112 | numprocs=1 113 | autorestart=true 114 | startsecs=10 115 | stopwaitsecs = 60 116 | killasgroup=true 117 | 118 | [program:st2sensorcontainer] 119 | command=/opt/stackstorm/st2/bin/st2sensorcontainer --config-file /etc/st2/st2.conf 120 | redirect_stderr = true 121 | stdout_logfile_maxbytes = 200MB 122 | stdout_logfile_backups = 20 123 | stdout_logfile = /var/log/st2sensorcontainer.log 124 | stderr_logfile = /var/log/st2sensorcontainer.log 125 | user=root 126 | numprocs=1 127 | autorestart=true 128 | startsecs=10 129 | stopwaitsecs = 60 130 | killasgroup=true 131 | 132 | [program:st2rulesengine] 133 | command=/opt/stackstorm/st2/bin/st2rulesengine --config-file /etc/st2/st2.conf 134 | redirect_stderr = true 135 | stdout_logfile_maxbytes = 200MB 136 | stdout_logfile_backups = 20 137 | stdout_logfile = /var/log/st2rulesengine.log 138 | stderr_logfile = /var/log/st2rulesengine.log 139 | user=root 140 | numprocs=1 141 | autorestart=true 142 | startsecs=10 143 | stopwaitsecs = 60 144 | killasgroup=true 145 | 146 | [program:st2stream] 147 | command=/opt/stackstorm/st2/bin/gunicorn_pecan /opt/stackstorm/st2/lib/python2.7/site-packages/st2stream/gunicorn_config.py -k eventlet -b 127.0.0.1:9102 --workers 1 --threads 10 --graceful-timeout 10 --timeout 30 148 | redirect_stderr = true 149 | stdout_logfile_maxbytes = 200MB 150 | stdout_logfile_backups = 20 151 | stdout_logfile = /var/log/st2stream.log 152 | stderr_logfile = /var/log/st2stream.log 153 | user=root 154 | numprocs=1 155 | autorestart=true 156 | startsecs=10 157 | stopwaitsecs = 60 158 | killasgroup=true 159 | 160 | [program:nginx] 161 | command=/usr/sbin/nginx -g 'daemon off;' 162 | redirect_stderr = true 163 | stdout_logfile_maxbytes = 200MB 164 | stdout_logfile_backups = 20 165 | stdout_logfile = /var/log/nginx.log 166 | stderr_logfile = /var/log/nginx.log 167 | user=root 168 | numprocs=1 169 | autorestart=true 170 | startsecs=10 171 | stopwaitsecs = 60 172 | killasgroup=true 173 | 174 | --------------------------------------------------------------------------------