This tutorial is for Ubuntu & Squid3. Use AWS, Google cloud, Digital Ocean or any services with Ubuntu to follow this tutorial.
sudo apt-get update
sudo apt-get install squid3
sudo apt-get install apache2-utils
| #!/usr/bin/env python3 | |
| import http.server | |
| import socketserver | |
| PORT = 8000 | |
| Handler = http.server.SimpleHTTPRequestHandler | |
| Handler.extensions_map.update({ | |
| '.wasm': 'application/wasm', |
本文譯自 [Tokio internals: Understanding Rust's asynchronous I/O framework from the bottom up][tokio-internals]。
Thanks [David Simmons][david-simmons] for this awesome article!
[Tokio][tokio] 是 Rust 的開發框架,用於開發非同步 I/O 程式(asynchronous I/O,一種事件驅動的作法,可實現比傳統同步 I/O 更好的延伸性、效能與資源利用)。可惜的是,Tokio 過於精密的抽象設計,招致難以學習的惡名。即使我讀完教程後,依然不認為自己充分內化這些抽象層,以便推斷實際發生的事情。
| #![allow(unused_variables)] | |
| #![allow(unused_imports)] | |
| use std::env; | |
| use std::process; | |
| use std::thread; | |
| use std::io::{self, Read, Write, Error}; | |
| use std::net::TcpStream; | |
| use std::net::TcpListener; |
| <style> | |
| .axis { | |
| font-family: sans-serif; | |
| fill: #d35400; | |
| font-size: 12px; | |
| } | |
| .line { | |
| fill: none; |
| /** | |
| * = Recursive descent parser = | |
| * | |
| * MIT Style License | |
| * By Dmitry Soshnikov <dmitry.soshnikov@gmail.com> | |
| * | |
| * In this short lecture we'll cover the basic (non-predictive, backtracking) | |
| * recursive descent parsing algorithm. | |
| * | |
| * Recursive descent is an LL parser: scan from left to right, doing |
| $ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 |
| // Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
| $ git ls-files | xargs wc -l |
| #!/usr/bin/python | |
| # -*- coding: utf8 -*- | |
| # Simple RSA Implementation | |
| # Authored by Jeremy <jeremy5189(at)gmail.com> | |
| # Reference: http://www.ruanyifeng.com/blog/2013/07/rsa_algorithm_part_two.html | |
| from fractions import gcd | |
| import sys |