Browse Source

one-liners: added 'python' to 'Programming' section

- signed-off-by: trimstray <trimstray@gmail.com>
pull/62/head
trimstray 5 years ago
parent
commit
1620b1dad0
1 changed files with 43 additions and 0 deletions
  1. +43
    -0
      README.md

+ 43
- 0
README.md View File

@@ -2465,6 +2465,49 @@ _dname="google.com" ; curl -s "https://dns.google.com/resolve?name=${_dname}&typ


<a name="programming"><b>Programming</b></a> <a name="programming"><b>Programming</b></a>


##### Tool: [python](https://www.python.org/)

###### Static HTTP web server

```bash
# Python 3.x
python3 -m http.server 8000 --bind 127.0.0.1

# Python 2.x
python -m SimpleHTTPServer 8000
```

###### Static HTTP web server with SSL support

```bash
# Python 3.x
from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl


httpd = HTTPServer(('localhost', 4443), BaseHTTPRequestHandler)

httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="path/to/key.pem",
certfile='path/to/cert.pem', server_side=True)

httpd.serve_forever()

# Python 2.x
import BaseHTTPServer, SimpleHTTPServer
import ssl


httpd = BaseHTTPServer.HTTPServer(('localhost', 4443),
SimpleHTTPServer.SimpleHTTPRequestHandler)

httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="path/tp/key.pem",
certfile='path/to/cert.pem', server_side=True)

httpd.serve_forever()
```

##### Tool: [awk](http://www.grymoire.com/Unix/Awk.html) ##### Tool: [awk](http://www.grymoire.com/Unix/Awk.html)


###### Remove duplicate entries in a file without sorting ###### Remove duplicate entries in a file without sorting


Loading…
Cancel
Save