(), http.StatusInternalServerError) return}defer conn.Close()
It should be noted that, after hijack, if you want to reply data in the HTTP format, you have to perform the operation on your own. There is no way to use the methods provided by net/HTTP. responsewriter. Fortunately, the FMT package of Go provides the fprint/fprintf function, so the operation is still simple.
Another point is that this HTTP tunnel allows additional data to be carried in
CopyCode The Code is as follows: Function fprint (){
// Hide the content that does not need to be printed.
Document. getelementbyid ("divoperate"). style. Display = "NONE ";
Document. All. webbrowser. execwb (7,1 );
Document. getelementbyid ("divoperate"). style. Display = "Block ";
}
// -->
Print
set title
the content to be printe
on the screen.12063 34-rw-r -- 1 root 33545 Dec 30/etc/httpd/conf/httpd. conf
The following table lists common parameters and usage methods for searching and displaying file information.
Option usage description-Exec command: Find and execute the command-Fprint file: print the complete file name.-Fprint0 file: print the complete file name, including an empty file.-Fprintf file format: format of the printed file-OK command: Execute the command for th
is created in the second loop memory I=1。。。。。。。。。。。。。。Memory Nineth Cycles in memory created I=9Print (i)2.Redis ——— Hash ( hash)Monitor traffic data for www.baidu.com per sessionStructure: Hash(hash)N1 ——— K1 = v1N2 ——— K11 = v11Key valueServer 100G Local computer 10GDic.keys () # get all3. File operationf = open (' File.log ')#f. Read () # will be reading the day into memoryFor line in F: # __inter__ method for triggering FPrint (line) # Generator
Your environment is as follows:[[EMAILNBSP;PROTECTED]NBSP;~]#NBSP;LLNBSP;/DEV/MAPPER/*CRW-RW----1rootroot10, 58Oct2407:59/dev/mapper/controllrwxrwxrwx1rootroot NBSP;NBSP;NBSP;NBSP;7NBSP;OCTNBSP;26NBSP;09:19NBSP;/DEV/MAPPER/DGNBSP;-GT;NBSP, .... /dm-0lrwxrwxrwx1rootroot7oct2609:19 NBSP;/DEV/MAPPER/OCRNBSP;-GT;NBSP, .... /DM-1[[EMAILNBSP;PROTECTED]NBSP;~]#NBSP;LLNBSP;/DEV/DM-*BRW-RW----1gridasmadmin253 , NBSP;0NBSP;OCTNBSP;26NBSP;09:43NBSP;/DEV/DM-0BRW-RW----1gridasmadmin253,1 oct2609:43/dev/dm-1[
{printf ("%s\n", $i)}}}11. Print 5 to 26 linesAwk-f: ' Nr>=5nrAwk ' Bengin{print ' Document}{print} ' f Ilename13. Interlaced removalAwk ' {if (nr%2==1) {print}} ' F Ilename14. Total number of rows with more than 5 printed fieldsAwk-f: ' Begin{num=0;} {if (nf>=5) {num++;}} END {print num;} ' f Ilename15. Write an awk script to count the various types of files in/dev#!/bin/awk-fbegin{Ff=0Dd=0Bb=0Cc=0Pp=0Ss=0Ll=0}{if ($ ~/^-/){ff++}if ($ ~/^p/){pp++}if ($ ~/^b/){bb++}if ($ ~/^/){Cc++}if ($ ~/^d/){
;} fprint F (stderr, "error looking for Inum%d\n", (int) inode_to_find); exit (1);} ino_t Get_inode (char *fname) {struct stat info; if (stat (fname, info) = =-1 ) {fprintf (stderr, " Cannot stat "); Perror (fname); Exit (1);} return Info.st_ino;} The function is to list the current directory.testioctl.c#include #include #include #include Main () { struct winsize size; if (Isatty (stdout_fileno) = = 0) exit (1), if (IOCTL (Stdout_fi
The GOFMT function uses Go/token,go/parser to format the code, and the actual work is:
1 Sequential Import Package
2 Beautify Go Code
Haha, this is to say that the GO program can be self (Go program) to beautify and run (bootstrap), this feeling is too good, use is go/xxx bag
Here are a few key functions:
Token. Newfileset (): Create Fset structure
Parser. Parsefile (): Parse The Go code (this is how the last mode can be resolved to what extent)
Ast. Sortimports (): Sort the Import Package
Pri
(response, Err. Error (), HTTP. Statusinternalservererror) return}defer Conn. Close ()
One thing to note is that after hijack, if you want to reply to the HTTP protocol format data, it is necessary to operate, there is no way to use net/http. Responsewriter provides the method. Fortunately, Go's FMT package provides the fprint/fprintf function, so it's also easy to operate.
Another point is that this HTTP tunnel allows additional data to be carrie
("Listenandserve error:", err.) Error ())}}func Logintask (w http. Responsewriter, req *http. Request) {//Gets the parameter Time.sleep (time.millisecond*300) req that the client passed by Get/post. Parseform () fmt. Fprint (W, "Hello word!")}
C#
public class Myhandlermiddleware {//must has constructor with this Signature, otherwise exception at run time public myhandlermiddleware (requestdelegate next) {// This is a HTTP Handler, so no
This is a created
article in which the information may have evolved or changed.
Go internal implementation of the HTTP protocol, the following code is a concise implementation of a webserver,
It's a wonderful opportunity to dig deeper.
Package MainImport ("FMT""Net/http")Type Hello struct{}Func (H Hello) servehttp (W http. Responsewriter,R *http. Request) {Fmt. Fprint (W, "hello!")}Func Main () {var h Hellohttp. Listenandserve ("localhost:40
This is a creation in
Article, where the information may have evolved or changed.
A simple Golang implementation of private chat, determined by server-side 22 matchesServer-Side Chat_server.go
Package Mainimport ("FMT" "io" "Log" "NET") const LISTENADDR = "localhost:4000" Func Main () {L, err: = Net. Listen ("TCP", LISTENADDR) if err! = Nil {log. Fatal (Err)} for {c, err: = L.accept () if err! = Nil {log. Fatal (ERR)}//go io. Copy (c, c) go Match (c)}}var partner = make (chan io. Readwritecloser
*" | xargs file$ Find.-name "yao *" | xargs echo "">/tmp/core. log$ Find.-name "yao *" | xargs chmod o-w
========================================================== ====================
Find-name CMDL * search for files starting with CMDL in the current directoryFind-name extension L * fprint file searches for files starting with extension L in the current directory, and outputs the results to the file.Find-name ap *-o-name may * search for files star
strong.
12345
func Main () {var b bytes. Bufferfmt.fprint (b,"Hello World") fmt. Println (B.string ())}
The above is an example of using an interface, we first look at the fmt.Fprint implementation of the function.
1234567
func Fprint (w io.) Writer, a ... Interface {})int, err error) {p: = Newprinter () p.doprint (a) n, err = W.write (p.buf) p.free () Return}
This is a creation in
Article, where the information may have evolved or changed.
Due to go default TLS. Config{servername:host, insecureskipverify: false},
Func testhtmlemail (t *testing. T) {opt: = emailoptions{user: "", Password: ", to: []string{" ""},from: "", Addr: "Smtp.xxx.com:25",}au Th: = Newloginauth (opt. User, opt. Password) pic, err: = Ioutil. ReadFile (' C:\Pictures\example.png ') if err! = Nil {T.Log (err)}dest: = Make ([]byte, Base64. Stdencoding.encodedlen (len (pic))) base64.
strings involved in functions
Fprint
Writes the printf to a file
Printf
Output a formatted string
sprintf
Prints into a string
snprintf
Prints into a string checking the length
vfprintf
Prints the A VA_ARG structure to a file
vprintf
Prints the VA_ARG structure to stdout
vsprintf
Prints the va_arg to a string
= ' Jia ', c= ' dong ')) result I love Jia DongPrint (' {0} love {a} {b} '. Format (' Jia ', a= ' Wu ', b= ' dong ') result Jia Love Wu Dong #综合使用, positional parameters must be before the keyword parameter(3) by subscript:p=[' Jiadong ', 18]Print (' {0},{0} '. Format (p)) results [' Jiadong ', 18],[' Jiadong ',] #两0之间可以有逗号, or no commaPrint (' {0[0]},{0[1]} '. Format (p)) Results jiadong,187 Format qualifier: (Syntax is {} with: #)A Fill and align:(1) Padding is used in conjunction with alignme
() standard inputs such as #用这个方法就可以获得 ' a '4, Python has data storage combination list tuple dictionary three stylesList can be deleted and changed to search index slicesTuples do not support modification but can index slicesA dictionary is a key value stored only by key to find values5, the processing of documentsThe way the file is opened R means read-only w indicates write (if the original file has content will be emptied) a means append (append content after the original file)Read the file
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.