原创 主機可以ping通虛擬機,但telnet不通(不關防火牆)

查看防火牆允許被訪問的端口 firewall-cmd --list-port   開啓一個端口 firewall-cmd --zone=public --permanent --add-port=80/tcp #開啓80端口 fi

原创 修改linux 的最大打開文件數量

我的系統是Ubuntu 16.04.2 (cat  /etc/issue) 在/etc/security/目錄下,文件名爲limits.conf    格式爲    用戶 soft nofile number 用戶 hard nofil

原创 roundup_pow_of_two的實現

https://blog.csdn.net/mergerly/article/details/39007987

原创 python比較兩個文件的差異(使用difflib)

import sys import difflib def readfile(file1): try: fd=open(file1,"r") text=fd.read().splitlines

原创 pthread_cond_broadcast產生的驚羣效應和pthread_cond_signal比較

#include <iostream> #include <stdio.h> #include <queue> #include <unistd.h> #include <pthread.h> #include <stdlib.h> u

原创 對pthread_cond_wait的理解

目錄   pthread_cond_wait出現的目的 pthread_cond_wait實現之中爲什麼要加鎖和解鎖 代碼之中爲什麼要用while 函數原型 int pthread_cond_wait(pthread_cond_t *r

原创 shell 遍歷文件夾和冒號問題

#!/bin/bash file_url=`pwd`

原创 從pcap包裏提取文件

http://www.91ri.org/11958.html

原创 將列表去重

set() 函數創建一個無序不重複元素集,可進行關係測試,刪除重複數據,還可以計算交集、差集、並集等。 list_=[1,2,3,4,5,6,1,2,3,4] list_=list(set(list_))  

原创 vimplus快捷鍵

vimplus很好用的vim插件包https://github.com/chxuan/vimplus 本文內容來自於.vimplus/help.md 插件相關 快捷鍵 說明 , Leader Key <leader>n 打開/關閉代碼資源

原创 python os.path

首先看下__file__是什麼樣 print(__file__) 本機輸出爲:D:/pycharm/test1/test.py   可以看出__file__ 輸出爲當前文件的path   os.path.dirname(path) 1、

原创 python 獲取指定時間的時間戳

import time stamp=time.mktime(time.strptime('2016-11-24 14:00:21', '%Y-%m-%d %H:%M:%S')) print(int(stamp)) Python time

原创 python 裝飾器,普通裝飾函數修飾類函數

def Dec(func): #1 def wrapper(): print("hello") #3 func() #4 print("w

原创 根據進程名稱殺死進程

 原文鏈接 :https://my.oschina.net/u/3412738/blog/2246205 ps -ef | grep keyword | grep -v grep | awk '{print $2}' | xargs k

原创 python re模塊

具體細節參考:https://www.cnblogs.com/shenjianping/p/11647473.html   提取字符串中的數字列表的操作 import re strs="7班20歲3排5座" regex=re.compi