├── BloomFilter ├── README.md ├── bloomfilter.cpp ├── bloomfilter.h ├── map_test.cpp └── unorder_map_test.cpp ├── Docker ├── README.md ├── composeapp │ ├── Dockerfile │ ├── README.md │ ├── app.py │ ├── docker-compose.yml │ └── requirements.txt ├── jekyll │ ├── README.md │ ├── apache │ │ └── Dockerfile │ └── jekyll │ │ └── Dockerfile ├── jenkins │ ├── Dockerfile │ ├── README.md │ ├── dockerjenkins.sh │ ├── jenkins_multi_shell_step │ ├── jenkins_single_shell_step │ └── plugins.txt ├── sample │ ├── Dockerfile │ ├── README.md │ ├── nginx │ │ ├── global.conf │ │ └── nginx.conf │ └── website │ │ └── index.html ├── sinatra │ ├── README.md │ ├── redis │ │ └── Dockerfile │ ├── webapp │ │ ├── Dockerfile │ │ ├── bin │ │ │ └── webapp │ │ └── lib │ │ │ └── app.rb │ └── webapp_redis │ │ ├── Dockerfile │ │ ├── bin │ │ └── webapp │ │ └── lib │ │ └── app.rb └── tomcat │ ├── README.md │ ├── fetcher │ └── Dockerfile │ ├── tomcat8 │ └── Dockerfile │ └── tprov │ ├── .gitignore │ ├── Gemfile │ ├── Gemfile.lock │ ├── LICENSE │ ├── README.md │ ├── Rakefile │ ├── bin │ └── tprov │ ├── config.ru │ ├── lib │ ├── tprov.rb │ ├── tprov │ │ ├── app.rb │ │ ├── public │ │ │ ├── css │ │ │ │ ├── bootstrap-responsive.css │ │ │ │ ├── bootstrap-responsive.min.css │ │ │ │ ├── bootstrap.css │ │ │ │ ├── bootstrap.min.css │ │ │ │ └── flash.css │ │ │ ├── img │ │ │ │ ├── glyphicons-halflings-white.png │ │ │ │ └── glyphicons-halflings.png │ │ │ └── js │ │ │ │ ├── bootstrap.js │ │ │ │ ├── bootstrap.min.js │ │ │ │ └── jquery.js │ │ └── views │ │ │ ├── index.erb │ │ │ ├── instance_list.erb │ │ │ └── layout.erb │ └── version.rb │ ├── spec │ ├── spec_helper.rb │ └── tprov_spec.rb │ └── tprov.gemspec ├── Go ├── Session │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── init.go │ ├── memory_session.go │ ├── memory_session_mgr.go │ ├── redis_session.go │ ├── redis_session_mgr.go │ ├── session.go │ └── session_mgr.go └── log │ └── logagent1 │ ├── conf │ ├── conf.go │ └── conf.ini │ ├── go.mod │ ├── go.sum │ ├── kafka │ └── kafka.go │ ├── main.go │ ├── my_log │ └── taillog │ └── taillog.go ├── HuffmanDecompression ├── FileCompress.hpp ├── HuffmanTree.hpp ├── README.md ├── main.cpp └── testfile │ ├── 1.flv │ ├── test_file1 │ └── test_file2 ├── Qt └── QQchat │ ├── QQChat.zip │ └── README.md ├── README.md ├── STL └── SGI STL源码.zip ├── ZeroMQ ├── README.md ├── hwclient.c ├── hwserver.c ├── hwserver.cpp ├── interrupt1.c ├── interrupt2.c ├── msgqueue.c ├── mtrelay.c ├── mtserver.c ├── psenvpub.c ├── psenvsub.c ├── rrbroker.c ├── rrclient.c ├── rrworker.c ├── syncpub.c ├── syncsub.c ├── tasksink.c ├── taskvent.c ├── taskwork.c ├── version.c ├── wuclient.c ├── wuproxy.c └── wuserver.c ├── cJSON ├── README.md ├── comment_test.c │ ├── comment.json │ └── comment_test.c └── demo1 │ ├── cJSON.c │ ├── demo1.c │ └── demo1.json ├── cas_queue ├── README.md ├── queue_cas.cpp ├── queue_cas.h ├── queue_cas_test.cpp └── queue_stl.cpp ├── heartbeat ├── README.md ├── ngx_binary_protocol.c ├── ngx_binary_protocol.h ├── ngx_client.c ├── ngx_config.h ├── ngx_core.h ├── ngx_event_timer.c ├── ngx_event_timer.h ├── ngx_filed.c ├── ngx_filed.h ├── ngx_message.c ├── ngx_message.h ├── ngx_rbtree.c ├── ngx_rbtree.h ├── ngx_reactor.c ├── ngx_reactor.h ├── ngx_server.c ├── ngx_times.c └── ngx_times.h ├── iconv ├── CharsetConverter │ ├── CharsetConverter.cpp │ ├── CharsetConverter.h │ └── main.cpp ├── README.md ├── charset_converter.c └── utf8_to_utf16.c ├── jsoncpp ├── README.md ├── jsoncpp_demo01.c ├── jsoncpp_demo02.c └── jsoncpp_speed.cpp ├── muduo ├── README.md ├── examples │ ├── pingpong │ │ ├── CMakeLists.txt │ │ ├── bench.cc │ │ ├── client.cc │ │ └── server.cc │ ├── simple │ │ └── echo │ │ │ ├── echo.cc │ │ │ ├── echo.h │ │ │ └── main.cc │ ├── sudoku │ │ ├── CMakeLists.txt │ │ ├── batch.cc │ │ ├── loadtest.cc │ │ ├── percentile.h │ │ ├── pipeline.cc │ │ ├── server_basic.cc │ │ ├── server_hybrid.cc │ │ ├── server_multiloop.cc │ │ ├── server_prod.cc │ │ ├── server_threadpool.cc │ │ ├── stat.h │ │ ├── stat_unittest.cc │ │ ├── sudoku.cc │ │ └── sudoku.h │ ├── twisted │ │ └── finger │ │ │ ├── finger01.cc │ │ │ ├── finger02.cc │ │ │ ├── finger03.cc │ │ │ ├── finger04.cc │ │ │ ├── finger05.cc │ │ │ ├── finger06.cc │ │ │ └── finger07.cc │ └── zeromq │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── local_lat.cc │ │ └── remote_lat.cc └── muduo │ └── net │ ├── http │ ├── BUILD.bazel │ ├── CMakeLists.txt │ ├── HttpContext.cc │ ├── HttpContext.h │ ├── HttpRequest.h │ ├── HttpResponse.cc │ ├── HttpResponse.h │ ├── HttpServer.cc │ ├── HttpServer.h │ └── tests │ │ ├── HttpRequest_unittest.cc │ │ └── HttpServer_test.cc │ └── poller │ └── EPollPoller.cc ├── mysql └── order │ ├── create.sql │ └── populate.sql ├── openssl ├── hash │ ├── README.md │ ├── hash_test1.c │ └── hash_test2.c └── mem │ ├── README.md │ ├── mem_test1.c │ ├── mem_test2.c │ └── mem_test3.c ├── protobuf ├── im │ ├── CMakeLists.txt │ ├── IM.BaseDefine.pb.cc │ ├── IM.BaseDefine.pb.h │ ├── IM.BaseDefine.proto │ ├── IM.Login.pb.cc │ ├── IM.Login.pb.h │ ├── IM.Login.proto │ ├── IM.Message.pb.cc │ ├── IM.Message.pb.h │ ├── IM.Message.proto │ ├── ImPduBase.cc │ ├── ImPduBase.h │ ├── Lock.cc │ ├── Lock.h │ ├── UtilPdu.cc │ ├── UtilPdu.h │ ├── bad │ ├── bad.cpp │ ├── client.cc │ ├── client_im │ ├── create.sh │ ├── helloworld.proto │ ├── msg.pb.cc │ ├── msg.pb.h │ ├── msg.proto │ ├── ostype.h │ ├── pack_test │ ├── pack_test.cpp │ ├── rpc_client.cpp │ ├── rpc_server.cpp │ ├── server.cc │ ├── server_im │ ├── util.cc │ └── util.h ├── im_new │ ├── CMakeCache.txt │ ├── CMakeLists.txt │ ├── IM.BaseDefine.pb.cc │ ├── IM.BaseDefine.pb.h │ ├── IM.BaseDefine.proto │ ├── IM.Login.pb.cc │ ├── IM.Login.pb.h │ ├── IM.Login.proto │ ├── IM.Message.pb.cc │ ├── IM.Message.pb.h │ ├── IM.Message.proto │ ├── ImPduBase.cc │ ├── ImPduBase.h │ ├── Lock.cc │ ├── Lock.h │ ├── Makefile │ ├── UtilPdu.cc │ ├── UtilPdu.h │ ├── client.cc │ ├── client_im │ ├── cmake_install.cmake │ ├── create.sh │ ├── msg.pb.cc │ ├── msg.pb.h │ ├── msg.proto │ ├── ostype.h │ ├── server.cc │ ├── server_im │ ├── util.cc │ └── util.h └── person │ ├── IM.BaseDefine.pb.cc │ ├── IM.BaseDefine.pb.h │ ├── IM.Login.pb.cc │ ├── IM.Login.pb.h │ ├── README.md │ ├── code_test.cpp │ ├── pb_speed.cpp │ └── proto │ ├── IM.BaseDefine.proto │ ├── IM.Login.proto │ └── create.sh ├── server-client ├── mul_port_client_epoll.c └── reactor.c ├── syncHttp_and_asyncHttp ├── README.md ├── async_http.c └── sync_http.c ├── tinyxml2 ├── README.md ├── demo01.cpp ├── demo01.xml ├── demo02.cpp ├── demo03.cpp ├── demo04.cpp ├── demo05.cpp └── tinyxml2.cpp ├── udp_piece ├── README.md ├── circular_buffer.c ├── circular_buffer.h ├── udp-piece-client.c ├── udp-piece-server.c ├── udp-piece.c └── udp-piece.h └── zlib ├── README.md ├── deflate ├── DeflatingStream.cpp ├── DeflatingStream.h └── deflate.cpp ├── inflate ├── InflatingStream.cpp ├── InflatingStream.h └── inflate.cpp └── testfile ├── testfile1 ├── testfile2 └── testfile3 /BloomFilter/README.md: -------------------------------------------------------------------------------- 1 | # BloomFilter 2 | The C language implementation of Bloom Filter(布隆过滤器的C语言实现) 3 | 4 | * 讲解对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/106416470 5 | * 程序中包含4个文件: 6 | * bloomfilter.h:布隆过滤器的C语言实现(核心代码) 7 | * bloomfilter.cpp:布隆过滤器的测试代码 8 | * map_test.cpp:用来测试C++ STL库中的map的,其内部使用红黑树实现(用来与布隆过滤器对比的) 9 | * unorder_map_test.cpp:用来测试C++ STL库中的unorder_map的,其内部使用hashmap实现(用来与布隆过滤器对比的) 10 | -------------------------------------------------------------------------------- /BloomFilter/bloomfilter.cpp: -------------------------------------------------------------------------------- 1 | #include "bloomfilter.h" 2 | #include 3 | 4 | #define MAX_ITEMS 6000000 // 设置最大元素个数 5 | #define ADD_ITEMS 1000 // 添加测试元素 6 | #define P_ERROR 0.0001// 设置误差 7 | 8 | // 9 | int main(int argc, char** argv) 10 | { 11 | 12 | printf(" test bloomfilter\n"); 13 | 14 | // 1. 定义BaseBloomFilter 15 | static BaseBloomFilter stBloomFilter = {0}; 16 | 17 | // 2. 初始化stBloomFilter,调用时传入hash种子,存储容量,以及允许的误判率 18 | InitBloomFilter(&stBloomFilter, 0, MAX_ITEMS, P_ERROR); 19 | 20 | // 3. 向BloomFilter中新增数值 21 | char url[128] = {0}; 22 | for(int i = 0; i < ADD_ITEMS; i++){ 23 | sprintf(url, "https://blog.csdn.net/qq_41453285/%d.html", i); 24 | if(0 == BloomFilter_Add(&stBloomFilter, (const void*)url, strlen(url))){ 25 | // printf("add %s success", url); 26 | }else{ 27 | printf("add %s failed", url); 28 | } 29 | memset(url, 0, sizeof(url)); 30 | } 31 | 32 | // 4. check url exist or not 33 | char* str = "https://blog.csdn.net/qq_41453285/0.html"; 34 | if (0 == BloomFilter_Check(&stBloomFilter, (const void*)str, strlen(str)) ){ 35 | printf("https://blog.csdn.net/qq_41453285/0.html exist\n"); 36 | } 37 | 38 | char* str2 = "https://blog.csdn.net/qq_41453285/10001.html"; 39 | if (0 != BloomFilter_Check(&stBloomFilter, (const void*)str2, strlen(str2)) ){ 40 | printf("https://blog.csdn.net/qq_41453285/10001.html not exist\n"); 41 | } 42 | 43 | // 5. free bloomfilter 44 | FreeBloomFilter(&stBloomFilter); 45 | getchar(); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /BloomFilter/map_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAP_ITEMS 100000 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | std::map mp; 15 | 16 | timeval startTime, endTime; 17 | 18 | //1.插入MAP_ITEMS个元素到map中 19 | gettimeofday(&startTime, NULL); 20 | std::string key = "https://blog.csdn.net/qq_41453285"; 21 | for(int i = 0; i < MAP_ITEMS; ++i){ 22 | string sub_key = to_string(i); 23 | mp.insert(std::make_pair(key + sub_key, 1)); 24 | } 25 | 26 | gettimeofday(&endTime, NULL); 27 | long insert_time = (endTime.tv_sec - startTime.tv_sec)*1000 + (endTime.tv_usec-startTime.tv_usec)/1000; 28 | 29 | //2.在map中查找一个元素 30 | gettimeofday(&startTime, NULL); 31 | if( mp.find(key + "10000") == mp.end()) 32 | std::cout << "not found!" << std::endl; 33 | 34 | gettimeofday(&endTime, NULL); 35 | long find_time = endTime.tv_usec - startTime.tv_usec; 36 | 37 | //3.估算当前key的平均大小 38 | double key_size = key.size() + to_string(MAP_ITEMS).size()/2; 39 | 40 | //4.打印相关信息 41 | std::cout << "Number of members " << "key size " << "insert time(ms) " << "find time(us) " << std::endl; 42 | std::cout << left << setw(19) << MAP_ITEMS; 43 | std::cout << left << setw(10) << key_size; 44 | std::cout << left << setw(17) << insert_time; 45 | std::cout << left << setw(15) << find_time << std::endl; 46 | } 47 | -------------------------------------------------------------------------------- /BloomFilter/unorder_map_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define MAP_ITEMS 100000 9 | 10 | using namespace std; 11 | 12 | int main() 13 | { 14 | unordered_map unordermp; 15 | 16 | timeval startTime, endTime; 17 | 18 | //1.插入MAP_ITEMS个元素到map中 19 | gettimeofday(&startTime, NULL); 20 | std::string key = "https://blog.csdn.net/qq_41453285"; 21 | for(int i = 0; i < MAP_ITEMS; ++i){ 22 | string sub_key = to_string(i); 23 | unordermp.insert(std::make_pair(key + sub_key, 1)); 24 | } 25 | 26 | gettimeofday(&endTime, NULL); 27 | long insert_time = (endTime.tv_sec - startTime.tv_sec)*1000 + (endTime.tv_usec-startTime.tv_usec)/1000; 28 | 29 | //2.在map中查找一个元素 30 | gettimeofday(&startTime, NULL); 31 | if( unordermp.find(key + "10000") == unordermp.end()) 32 | std::cout << "not found!" << std::endl; 33 | 34 | gettimeofday(&endTime, NULL); 35 | long find_time = endTime.tv_usec - startTime.tv_usec; 36 | 37 | //3.估算当前key的平均大小 38 | double key_size = key.size() + to_string(MAP_ITEMS).size()/2; 39 | 40 | //4.打印相关信息 41 | std::cout << "Number of members " << "key size " << "insert time(ms) " << "find time(us) " << std::endl; 42 | std::cout << left << setw(19) << MAP_ITEMS; 43 | std::cout << left << setw(10) << key_size; 44 | std::cout << left << setw(17) << insert_time; 45 | std::cout << left << setw(15) << find_time << std::endl; 46 | } 47 | -------------------------------------------------------------------------------- /Docker/README.md: -------------------------------------------------------------------------------- 1 | 本目录下的文件为Docker博客的代码文件链接,请参阅:https://blog.csdn.net/qq_41453285/category_10195495.html 2 | -------------------------------------------------------------------------------- /Docker/composeapp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | LABEL maintainer="https://blog.csdn.net/qq_41453285/" 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | ADD . /composeapp 6 | 7 | WORKDIR /composeapp 8 | 9 | RUN pip install -r requirements.txt 10 | -------------------------------------------------------------------------------- /Docker/composeapp/README.md: -------------------------------------------------------------------------------- 1 | composeapp目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107619523 2 | -------------------------------------------------------------------------------- /Docker/composeapp/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask 2 | from redis import Redis 3 | import os 4 | 5 | app = Flask(__name__) 6 | redis = Redis(host="redis", port=6379) 7 | 8 | @app.route('/') 9 | def hello(): 10 | redis.incr('hits') 11 | return 'Hello Docker Book reader! I have been seen {0} times'.format(redis.get('hits')) 12 | 13 | if __name__ == "__main__": 14 | app.run(host="0.0.0.0", debug=True) 15 | -------------------------------------------------------------------------------- /Docker/composeapp/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | web: 4 | image: jamtur01/composeapp 5 | command: python app.py 6 | ports: 7 | - "5000:5000" 8 | volumes: 9 | - .:/composeapp 10 | links: 11 | - redis 12 | redis: 13 | image: redis 14 | -------------------------------------------------------------------------------- /Docker/composeapp/requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | redis 3 | -------------------------------------------------------------------------------- /Docker/jekyll/README.md: -------------------------------------------------------------------------------- 1 | jekyll目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107609836 2 | -------------------------------------------------------------------------------- /Docker/jekyll/apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | LABEL maintainer="https://blog.csdn.net/qq_41453285" 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | RUN apt-get -qq update 6 | RUN apt-get -qq install apache2 7 | 8 | VOLUME [ "/var/www/html" ] 9 | WORKDIR /var/www/html 10 | 11 | ENV APACHE_RUN_USER www-data 12 | ENV APACHE_RUN_GROUP www-data 13 | ENV APACHE_LOG_DIR /var/log/apache2 14 | ENV APACHE_PID_FILE /var/run/apache2.pid 15 | ENV APACHE_RUN_DIR /var/run/apache2 16 | ENV APACHE_LOCK_DIR /var/lock/apache2 17 | 18 | RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR 19 | 20 | EXPOSE 80 21 | 22 | ENTRYPOINT [ "/usr/sbin/apachectl" ] 23 | CMD ["-D", "FOREGROUND"] 24 | -------------------------------------------------------------------------------- /Docker/jekyll/jekyll/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | LABEL maintainer="https://blog.csdn.net/qq_41453285" 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | RUN apt-get -qq update 6 | RUN apt-get -qq install ruby ruby-dev libffi-dev build-essential nodejs 7 | RUN gem install --no-rdoc --no-ri jekyll -v 2.5.3 8 | 9 | VOLUME /data 10 | VOLUME /var/www/html 11 | WORKDIR /data 12 | 13 | ENTRYPOINT [ "jekyll", "build", "--destination=/var/www/html" ] 14 | -------------------------------------------------------------------------------- /Docker/jenkins/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jenkins/jenkins:lts 2 | MAINTAINER https://blog.csdn.net/qq_41453285 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | USER root 6 | RUN apt-get -qq update && apt-get install -qq sudo 7 | RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers 8 | RUN wget http://get.docker.com/builds/Linux/x86_64/docker-latest.tgz 9 | RUN tar -xvzf docker-latest.tgz 10 | RUN mv docker/* /usr/bin/ 11 | 12 | USER jenkins 13 | RUN /usr/local/bin/install-plugins.sh junit git git-client ssh-slaves greenballs chucknorris ws-cleanup 14 | -------------------------------------------------------------------------------- /Docker/jenkins/README.md: -------------------------------------------------------------------------------- 1 | jenkins目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107613066 2 | -------------------------------------------------------------------------------- /Docker/jenkins/dockerjenkins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # First, make sure that cgroups are mounted correctly. 4 | CGROUP=/sys/fs/cgroup 5 | 6 | [ -d $CGROUP ] || 7 | mkdir $CGROUP 8 | 9 | mountpoint -q $CGROUP || 10 | mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || { 11 | echo "Could not make a tmpfs mount. Did you use -privileged?" 12 | exit 1 13 | } 14 | 15 | # Mount the cgroup hierarchies exactly as they are in the parent system. 16 | for SUBSYS in $(cut -d: -f2 /proc/1/cgroup) 17 | do 18 | [ -d $CGROUP/$SUBSYS ] || mkdir $CGROUP/$SUBSYS 19 | mountpoint -q $CGROUP/$SUBSYS || 20 | mount -n -t cgroup -o $SUBSYS cgroup $CGROUP/$SUBSYS 21 | done 22 | 23 | # Now, close extraneous file descriptors. 24 | pushd /proc/self/fd 25 | for FD in * 26 | do 27 | case "$FD" in 28 | # Keep stdin/stdout/stderr 29 | [012]) 30 | ;; 31 | # Nuke everything else 32 | *) 33 | eval exec "$FD>&-" 34 | ;; 35 | esac 36 | done 37 | popd 38 | 39 | docker daemon & 40 | exec java -jar /opt/jenkins/jenkins.war 41 | -------------------------------------------------------------------------------- /Docker/jenkins/jenkins_multi_shell_step: -------------------------------------------------------------------------------- 1 | # Build the image to be used for this run. 2 | cd $OS && IMAGE=$(sudo docker build . | tail -1 | awk '{ print $NF }') 3 | 4 | # Build the directory to be mounted into Docker. 5 | 6 | MNT="$WORKSPACE/.." 7 | 8 | # Execute the build inside Docker. 9 | CONTAINER=$(sudo docker run -d -v "$MNT:/opt/project" $IMAGE /bin/bash -c "cd /opt/project/$OS && rake spec") 10 | 11 | # Attach to the container's streams so that we can see the output. 12 | sudo docker attach $CONTAINER 13 | 14 | # As soon as the process exits, get its return value. 15 | RC=$(sudo docker wait $CONTAINER) 16 | 17 | # Delete the container we've just used to free disk space. 18 | sudo docker rm $CONTAINER 19 | 20 | # Exit with the same value that the process exited with. 21 | exit $RC 22 | -------------------------------------------------------------------------------- /Docker/jenkins/jenkins_single_shell_step: -------------------------------------------------------------------------------- 1 | # Build the image to be used for this job. 2 | IMAGE=$(sudo docker build . | tail -1 | awk '{ print $NF }') 3 | 4 | # Build the directory to be mounted into Docker. 5 | MNT="$WORKSPACE/.." 6 | 7 | # Execute the build inside Docker. 8 | CONTAINER=$(sudo docker run -d -v $MNT:/opt/project/ $IMAGE /bin/bash -c 'cd /opt/project/workspace && rake spec') 9 | 10 | # Attach to the container so that we can see the output. 11 | sudo docker attach $CONTAINER 12 | 13 | # Get its exit code as soon as the container stops. 14 | RC=$(sudo docker wait $CONTAINER) 15 | 16 | # Delete the container we've just used. 17 | sudo docker rm $CONTAINER 18 | 19 | # Exit with the same value as that with which the process exited. 20 | exit $RC 21 | -------------------------------------------------------------------------------- /Docker/jenkins/plugins.txt: -------------------------------------------------------------------------------- 1 | structs 2 | ssh-credentials 3 | credentials 4 | junit 5 | script-security 6 | mailer 7 | workflow-scm-step 8 | workflow-step-api 9 | scm-api 10 | git 11 | matrix-project 12 | ssh-slaves 13 | chucknorris 14 | greenballs 15 | ws-cleanup 16 | git-client 17 | durable-task 18 | -------------------------------------------------------------------------------- /Docker/sample/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | LABEL maintainer="james@example.com" 3 | ENV REFRESHED_AT 2014-06-01 4 | 5 | RUN apt-get -qq update && apt-get -qq install nginx 6 | 7 | RUN mkdir -p /var/www/html/website 8 | ADD nginx/global.conf /etc/nginx/conf.d/ 9 | ADD nginx/nginx.conf /etc/nginx/ 10 | 11 | EXPOSE 80 12 | -------------------------------------------------------------------------------- /Docker/sample/README.md: -------------------------------------------------------------------------------- 1 | sample目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107397371 2 | -------------------------------------------------------------------------------- /Docker/sample/nginx/global.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 0.0.0.0:80; 3 | server_name _; 4 | 5 | root /var/www/html/website; 6 | index index.html index.htm; 7 | 8 | access_log /var/log/nginx/default_access.log; 9 | error_log /var/log/nginx/default_error.log; 10 | } 11 | -------------------------------------------------------------------------------- /Docker/sample/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /run/nginx.pid; 4 | daemon off; 5 | 6 | events { } 7 | 8 | http { 9 | sendfile on; 10 | tcp_nopush on; 11 | tcp_nodelay on; 12 | keepalive_timeout 65; 13 | types_hash_max_size 2048; 14 | include /etc/nginx/mime.types; 15 | default_type application/octet-stream; 16 | access_log /var/log/nginx/access.log; 17 | error_log /var/log/nginx/error.log; 18 | gzip on; 19 | gzip_disable "msie6"; 20 | include /etc/nginx/conf.d/*.conf; 21 | } 22 | -------------------------------------------------------------------------------- /Docker/sample/website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test website 4 | 5 | 6 | 7 | 8 | 9 |

This is a test website

10 | 11 | 12 | -------------------------------------------------------------------------------- /Docker/sinatra/README.md: -------------------------------------------------------------------------------- 1 | sinatra目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107448159 2 | -------------------------------------------------------------------------------- /Docker/sinatra/redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | MAINTAINER dongyusheng "1286550014@qq.com" 4 | 5 | ENV REFRESHED_AT 2020-07-19 6 | 7 | RUN apt-get -yqq update && apt-get -yqq install redis-server redis-tools 8 | 9 | EXPOSE 6379 10 | 11 | ENTRYPOINT ["/usr/bin/redis-server" ] 12 | CMD [] 13 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | MAINTAINER dongyusheng "1286550014@qq.com" 4 | 5 | ENV REFRESHED_AT 2020-07-19 6 | 7 | RUN apt-get -qq update && apt-get -qq install ruby ruby-dev build-essential redis-tools 8 | 9 | RUN gem install --no-rdoc --no-ri sinatra json redis 10 | 11 | RUN mkdir -p /opt/webapp 12 | 13 | EXPOSE 4567 14 | 15 | CMD [ "/opt/webapp/bin/webapp" ] 16 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp/bin/webapp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) 4 | 5 | require 'app' 6 | 7 | App.run! 8 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp/lib/app.rb: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "sinatra" 3 | require "json" 4 | 5 | class App < Sinatra::Application 6 | 7 | set :bind, '0.0.0.0' 8 | 9 | get '/' do 10 | "

DockerBook Test Sinatra app

" 11 | end 12 | 13 | post '/json/?' do 14 | params.to_json 15 | end 16 | 17 | end 18 | 19 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp_redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | MAINTAINER dongyusheng "1286550014@qq.com" 4 | 5 | ENV REFRESHED_AT 2020-07-19 6 | 7 | RUN apt-get -yqq update && apt-get -yqq install ruby ruby-dev build-essential redis-tools 8 | 9 | RUN gem install --no-rdoc --no-ri sinatra json redis 10 | 11 | RUN mkdir -p /opt/webapp 12 | 13 | EXPOSE 4567 14 | 15 | CMD [ "/opt/webapp/bin/webapp" ] 16 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp_redis/bin/webapp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) 4 | 5 | require 'app' 6 | 7 | App.run! 8 | 9 | -------------------------------------------------------------------------------- /Docker/sinatra/webapp_redis/lib/app.rb: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "sinatra" 3 | require "json" 4 | require "redis" 5 | 6 | class App < Sinatra::Application 7 | 8 | redis = Redis.new(:host => 'db', :port => '6379') 9 | 10 | set :bind, '0.0.0.0' 11 | 12 | get '/' do 13 | "

DockerBook Test Redis-enabled Sinatra app

" 14 | end 15 | 16 | get '/json' do 17 | params = redis.get "params" 18 | params.to_json 19 | end 20 | 21 | post '/json/?' do 22 | redis.set "params", [params].to_json 23 | params.to_json 24 | end 25 | end 26 | 27 | -------------------------------------------------------------------------------- /Docker/tomcat/README.md: -------------------------------------------------------------------------------- 1 | tomcat目录中文件所对应的CSDN链接为:https://blog.csdn.net/qq_41453285/article/details/107616080 2 | -------------------------------------------------------------------------------- /Docker/tomcat/fetcher/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | LABEL maintainer="https://blog.csdn.net/qq_41453285/" 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | RUN apt-get -qq update 6 | RUN apt-get -qq install wget 7 | 8 | VOLUME [ "/var/lib/tomcat8/webapps/" ] 9 | WORKDIR /var/lib/tomcat8/webapps/ 10 | 11 | ENTRYPOINT [ "wget" ] 12 | CMD [ "--help" ] 13 | 14 | -------------------------------------------------------------------------------- /Docker/tomcat/tomcat8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | LABEL maintainer="https://blog.csdn.net/qq_41453285/" 3 | ENV REFRESHED_AT 2020-07-27 4 | 5 | RUN apt-get -qq update 6 | RUN apt-get -qq install tomcat8 default-jdk 7 | 8 | ENV CATALINA_HOME /usr/share/tomcat8 9 | ENV CATALINA_BASE /var/lib/tomcat8 10 | ENV CATALINA_PID /var/run/tomcat8.pid 11 | ENV CATALINA_SH /usr/share/tomcat8/bin/catalina.sh 12 | ENV CATALINA_TMPDIR /tmp/tomcat8-tomcat8-tmp 13 | 14 | RUN mkdir -p $CATALINA_TMPDIR 15 | 16 | VOLUME [ "/var/lib/tomcat8/webapps/" ] 17 | 18 | EXPOSE 8080 19 | 20 | ENTRYPOINT [ "/usr/share/tomcat8/bin/catalina.sh", "run" ] 21 | 22 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/.gitignore: -------------------------------------------------------------------------------- 1 | pkg/* 2 | *.gem 3 | .bundle 4 | db/statum.db 5 | config/config.yml 6 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | gem "sinatra" 3 | gem "sinatra-static-assets" 4 | gem "emk-sinatra-url-for" 5 | gem "sinatra-flash" 6 | gem "sinatra-redirect-with-flash" 7 | #gem "docker-api", :require => "docker" 8 | gem "redis" 9 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | emk-sinatra-url-for (0.2.1) 5 | sinatra (>= 0.9.1.1) 6 | mustermann (1.0.3) 7 | rack (2.2.3) 8 | rack-protection (2.0.5) 9 | rack 10 | redis (4.1.1) 11 | sinatra (2.0.5) 12 | mustermann (~> 1.0) 13 | rack (~> 2.0) 14 | rack-protection (= 2.0.5) 15 | tilt (~> 2.0) 16 | sinatra-flash (0.3.0) 17 | sinatra (>= 1.0.0) 18 | sinatra-redirect-with-flash (0.2.1) 19 | sinatra (>= 1.0.0) 20 | sinatra-static-assets (1.0.4) 21 | sinatra (>= 1.1.0) 22 | tilt (2.0.9) 23 | 24 | PLATFORMS 25 | ruby 26 | 27 | DEPENDENCIES 28 | emk-sinatra-url-for 29 | redis 30 | sinatra 31 | sinatra-flash 32 | sinatra-redirect-with-flash 33 | sinatra-static-assets 34 | 35 | BUNDLED WITH 36 | 1.17.2 37 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 James Turnbull, james@lovedthanlost.net 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/README.md: -------------------------------------------------------------------------------- 1 | # TProv 2 | 3 | **TProv** or the Tomcat Provisioner is a 4 | [Sinatra](http://www.sinatrarb.com) app that demonstrates how to build 5 | a simple PAAS with Docker. It allows you to provision Tomcat 6 | applications running in Docker containers. 7 | 8 | ## Running standalone 9 | 10 | Simply run the ``bundle`` and then ``rackup`` commands. 11 | 12 | ## Bundling as a gem 13 | 14 | gem build tprov.gemspec 15 | sudo gem install tprov-0.0.1.gem 16 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/Rakefile: -------------------------------------------------------------------------------- 1 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib"))) 2 | 3 | require 'rubygems' 4 | require 'rspec/core/rake_task' 5 | require 'bundler/gem_tasks' 6 | require 'rubygems' 7 | require 'sinatra' 8 | require 'tprov' 9 | 10 | task :default => :help 11 | 12 | desc "Run specs" 13 | task :spec do 14 | RSpec::Core::RakeTask.new(:spec) do |t| 15 | t.pattern = './spec/**/*_spec.rb' 16 | end 17 | end 18 | 19 | desc "Run IRB console with app environment" 20 | task :console do 21 | puts "Loading development console..." 22 | system("irb -r ./lib/wprov.rb") 23 | end 24 | 25 | desc "Show help menu" 26 | task :help do 27 | puts "Available rake tasks: " 28 | puts "rake console - Run a IRB console with all enviroment loaded" 29 | puts "rake spec - Run specs and calculate coverage" 30 | end 31 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/bin/tprov: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) 4 | 5 | require "rubygems" 6 | require "optparse" 7 | require "tprov" 8 | require "version" 9 | 10 | options = {} 11 | 12 | optparse = OptionParser.new do |opts| 13 | # Set a banner, displayed at the top 14 | # of the help screen. 15 | opts.banner = "Usage: TProv [options] ..." 16 | 17 | opts.separator '' 18 | opts.separator "Configuration options:" 19 | 20 | opts.on_tail( "-v", "--version", "Show version") do 21 | puts "WProv version #{TProv::VERSION}" 22 | exit 23 | end 24 | 25 | opts.separator "" 26 | opts.separator "Common options:" 27 | 28 | opts.on_tail("-h", "--help", "Display this screen" ) do 29 | puts opts 30 | exit 31 | end 32 | end 33 | 34 | begin 35 | optparse.parse! 36 | TProv::Application.run! 37 | rescue OptionParser::InvalidArgument, OptionParser::InvalidOption, OptionParser::MissingArgument 38 | puts $!.to_s 39 | puts optparse 40 | exit 41 | end 42 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/config.ru: -------------------------------------------------------------------------------- 1 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib"))) 2 | 3 | require 'rubygems' 4 | require 'tprov' 5 | 6 | run TProv::Application 7 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/lib/tprov.rb: -------------------------------------------------------------------------------- 1 | require "version" 2 | require "tprov/app" 3 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/lib/tprov/public/css/flash.css: -------------------------------------------------------------------------------- 1 | .flash { 2 | padding: 8px 35px 8px 14px; 3 | margin-bottom: 18px; 4 | color: #c09853; 5 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); 6 | background-color: #fcf8e3; 7 | border: 1px solid #fbeed5; 8 | -webkit-border-radius: 4px; 9 | -moz-border-radius: 4px; 10 | border-radius: 4px; 11 | } 12 | 13 | .success { 14 | color: #468847; 15 | background-color: #dff0d8; 16 | border-color: #d6e9c6; 17 | } 18 | 19 | .error { 20 | color: #b94a48; 21 | background-color: #f2dede; 22 | border-color: #eed3d7; 23 | } 24 | -------------------------------------------------------------------------------- /Docker/tomcat/tprov/lib/tprov/public/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongyusheng/csdn-code/58ccbd4a8569f236f6b460888633cc72d9a806ff/Docker/tomcat/tprov/lib/tprov/public/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /Docker/tomcat/tprov/lib/tprov/public/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongyusheng/csdn-code/58ccbd4a8569f236f6b460888633cc72d9a806ff/Docker/tomcat/tprov/lib/tprov/public/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /Docker/tomcat/tprov/lib/tprov/views/index.erb: -------------------------------------------------------------------------------- 1 | 10 | 11 |

Add a new Tomcat Application

12 | 13 |
14 | 15 |
16 |