原创 shell腳本 查詢轉發接口、連接數據庫、發送http請求

shell查詢默認網卡,ip route和route -n的作用一樣,都可以查出 nc=$(ip route | grep default | awk '{print $5}') #查詢默認網卡 if [[ x${n

原创 python os庫總結

import os os.getcwd() 獲取python安裝目錄 os.chdir(‘D:\’) 修改python所在目錄 os.listdir(‘C:\’) 列舉當前目錄下所有的文件 os.mkdir(‘D:\gitw

原创 goland連接數據庫

連接數據庫 import "github.com/jinzhu/gorm" func initdb() { // 第一個參數:數據庫類型(mysql,postgres) // 第二個參數:數據庫連接,用戶名:密碼@pro

原创 mysqldump數據

python連接數據庫: 'mysql+pymysql://root:root@localhost:3306/abc'  #'數據庫類型+數據庫驅動名稱://用戶名:密碼@機器地址:端口號/數據庫名'   初始化數據庫:$ bin/xxx

原创 openvswitch流錶轉發vxlan報文

vxlan:虛擬可拓展局域網 產生條件:局域網3層架構都是有冗餘的,但要防止環路又不能使用STP(因爲數據中心的每一個鏈路都是核心帶寬,阻塞接口代價太大)3層可以用ospf和isis協議天然防環,因爲使用SPF算法 虛擬化技術產生

原创 go語言學習筆記4(文件,管道,map)

go文件 輸入流:從文件到go程序內存,讀文件的過程 輸出流:從go程序內存到文件,寫文件的過程 打開文件,返回文件指針和錯誤 file, err := os.Open("文件路徑") 關閉文件,返回錯誤信息,經常與de

原创 go語言學習筆記2

go時間和日期 2006/01/02 15:04:05這個時間是固定的 package main import "fmt" import "time" func main(){ now := time.Now()

原创 Up in the Air-9

Take a photo. He just waltzes(華爾茲) in and cuts in line? We reserve priority assistance(優先特權) for our Hilton Hon

原创 Up in the Air-14

Natalie’s anger. What happened to Alex? She had to leave town early to get to a meeting. That’s too bad. Wh

原创 netns命名空間使用

在linux系統中通過netns創建虛擬主機,作用同VM,相比於VM其優勢是隨時創建,隨時刪除,操作方便 增加虛擬網絡命名空間vm,vm是命名空間的名字,可以隨意起,就創建了一臺虛擬ns ip netns add vm 顯

原创 Up in the Air-8

Natalie’s first try. I gotta grab this. I’ll meet you at the car rental(租車). I was hoping I’d hear from you.

原创 iptables防火牆使用

iptables是基於內核的防火牆,內置filter,nat,mangle三張表 filter表:過濾數據包(input,output,forward) nat表:網絡地址轉換(prerouting,postrouting) m

原创 Up in the Air-12

pour out words I think it’s time we see each other (跟別人約會) He broke up with you over a text message. It’s kind of