原创 Are you trying to connect to a TLS-enabled daemon without TLS?

剛安裝完docker後執行docker pull ubuntu 時報錯:[root@comk ~]# docker pull ubuntuPost http:///var/run/docker.sock/v1.19/p_w_picpaths

原创 shell 實現統計一個網段的IP和mac對應關係並保存到文件mac.txt

#!/bin/bash #function: Count the relationship between ip and mac in a C subnet #created by comk at Mar.12.2016 quitScrip

原创 python3 猜數字遊戲

x=10    #the number you set to gess i=1 n=6 while(i<=6):     print("@_@:")     print(n)     print(" times left")     y =

原创 python3 實現對比conf 文件差異

用法: ./conf.py  nginx1.conf  nginx2.conf > diff.html conf.py #!/usr/bin/python import difflib import sys ####   Usage: 

原创 python xlsxwriter 寫excel表哥數據

代碼:# -*- coding:utf-8 -*-__author__='comk'import xlsxwriterdata_dict={                "1":[u"張三",150,120,100],          

原创 python3   安裝mysql-client 報錯 mysql_config not found (py3 centos7)

centos7 pip3安裝mysql-client時報錯“mysql_config not found ”  459  yum -y install libmysqlclient-dev  460  yum -y install libm

原创 ubuntu 16.04 LTS upgrade後報錯snapd

報錯:dpkg: error processing package ubuntu-core-launcher (--configure): dependency problems - leaving unconfiguredNo appor

原创 python輸出%

python中格式化字符 %% ,可以輸出%,如下:>>> print '%.2f%%' % (2.322)2.32%>>> print '%d%%' % 2323%

原创 python爬取百思不得姐視頻

聲明:本文只用來學習python ,切勿用於非法用途#coding:utf-8from  Tkinter import *from ScrolledText import ScrolledText   ##scrollbarimport r

原创 python執行shell命令的幾種方式

最近有個需求就是頁面上執行shell命令,第一種 就是os.system,代碼如下:os.system('cat /proc/cpuinfo')但是發現頁面上打印的命令執行結果 0或者1,當然不滿足需求了。嘗試第二種方案 os.popen(

原创 python sorted 和 lambda結合排序 例子

dict = [{'id':'4','name':'b'},{'id':'6','name':'c'},{'id':'3','name':'a'},{'id':'1','name':'g'},{'id':'8','name':'f'}]di

原创 python 插入排序 與 冒泡排序

# encoding: utf:8 l = [5, 6, 9, 11, 34, 66, 6, 8, 7] def twoPointSearch(l):     for i in range(len(l)):         min_in

原创 列表鏈接是賦值,如果要不影響原來的可以用切片賦值

例子1:In [17]: nums = range(10)In [18]: nums_temp = numsIn [20]: nums_temp[0] = "comk"In [21]: numsOut[21]: ['comk', 1, 2,

原创 shell CPU 利用率 內存利用率

#!/bin/bash cpu_usage_idle=`top -b -n 1 | grep Cpu | awk '{print $5}' | cut -f 1 -d "."` let cpu_usage=100-$cpu_usage_id

原创 python beautifulsoup bs4爬蟲 爬取糗事百科

聲明:僅用於學習語法,請勿用於非法用途import urllib.requestimport refrom bs4 import BeautifulSoup# -*- coding:utf-8 -*-url = 'http://www.qi