select table_schema, sum((data_length+index_length)/1024/1024) AS "Total size(table+index) Mb", sum(data_length/1024/1024) as "table size", sum(index_length/1024/1024) as "index size" from information_schema.tables group by table_schema;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| "encoding/hex" | |
| ) | |
| func main() { | |
| // "A" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "os/exec" | |
| ) | |
| func main() { | |
| cmd := exec.Command("aaa", "-za") | |
| output, err := cmd.CombinedOutput() |
upstream apachereadonly {
server 10.10.11.10:8011;
server 10.10.11.11:8011;
server 10.10.11.12:8011;
hash $remote_addr consistent;
}Please note the ip_hash of nginx only cares the first thress parts of client ip, so 10.0.0.1/24 all will go to the same backend server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| url = 'https://httpbin.org/get' | |
| proxies = { | |
| 'http': 'http://127.0.0.1:7890', | |
| 'https': 'http://127.0.0.1:7890', | |
| } | |
| r = requests.get(url, proxies=proxies) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "log" | |
| "net" | |
| ) | |
| // Get preferred outbound ip of this machine | |
| func GetOutboundIP() net.IP { | |
| conn, err := net.Dial("udp", "8.8.8.8:80") | |
| if err != nil { | |
| log.Fatal(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pymysql | |
| db = pymysql.connect(host="192.168.236.111", user="fakeuser", password="fakepassword",port=xxx, db="xxx") | |
| data = { | |
| "a": 1, | |
| "b": "2,3" | |
| } | |
| table_name="detail" | |
| column_string = ','.join(data.keys()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // simple go routine pool | |
| package main | |
| import ( | |
| "sync" | |
| ) | |
| func main() { | |
| var wg sync.WaitGroup |
NewerOlder