edit /etc/sysconfig/network-scripts/ifcfg-eth0
it will looks like
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes| * Change the column property | |
| ALTER TABLE table_name MODIFY COLUMN column_name VARCHAR(50); | |
| * Create table from exist table | |
| CREATE TABLE table_name LIKE exist_table; //empty table with same structure | |
| CREATE TABLE table_name AS SELECT * FROM exist_table; //copy the whole table | |
| * Estimate rough row number of a database | |
| SELECT TABLE_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=table_schema; // this is only an estimate,not the exact one!!!!! |
| #!/bin/bash -x | |
| # To count row number of each table in a schema | |
| # Example: echo 127.0.0.1 root rootpassword rootdatabase | ./count_database.sh 2>/dev/null | |
| while read host username password schema; | |
| do | |
| mysql -h$host -u$username -p$password -Ne "select table_name from information_schema.tables where table_schema='${schema}'"| | |
| while read table; | |
| do |
| #Batch move | |
| ls | head -n 50 | xargs -i mv {} mvdir/ | |
| #Batch files replace | |
| sed -i "s/older/newser/g" `grep -li older *` |
| // use shell command | |
| import subprocess | |
| output = subprocess.check_output('dir', shell=True) | |
| print(output) |
| ref = 'https://docs.python.org/3/library/functools.html' | |
| @lru_cache(maxsize=None) | |
| def fib(n): | |
| if n < 2: | |
| return n | |
| return fib(n-1) + fib(n-2) |
| #!/usr/bin/env python | |
| """ | |
| Very simple HTTP server in python. | |
| Usage:: | |
| ./dummy-web-server.py [<port>] | |
| Send a GET request:: | |
| curl http://localhost |
| #!/bin/bash | |
| while : | |
| do | |
| address=`ifconfig bond0 | grep inet | grep -v inet6|awk '{print $2}'` | |
| echo $address | |
| ip route | grep cali | grep -v src | while read -r line ; | |
| do | |
| ip route replace $line src $address |
| 8.2.3. HTTP log format | |
| ---------------------- | |
| The HTTP format is the most complete and the best suited for HTTP proxies. It | |
| is enabled by when "option httplog" is specified in the frontend. It provides | |
| the same level of information as the TCP format with additional features which | |
| are specific to the HTTP protocol. Just like the TCP format, the log is usually | |
| emitted at the end of the session, unless "option logasap" is specified, which | |
| generally only makes sense for download sites. A session which matches the | |
| "monitor" rules will never logged. It is also possible not to log sessions for |
edit /etc/sysconfig/network-scripts/ifcfg-eth0
it will looks like
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes| package main | |
| import ( | |
| "net/http" | |
| "github.com/prometheus/client_golang/prometheus/promhttp" | |
| ) | |
| func main() { | |
| http.Handle("/metrics", promhttp.Handler()) |