使用KVM创建虚拟机的记录
关键命令:
sudo virt-install --name wza-vm3 --ram 2048 --disk path=/var/lib/libvirt/images/myubuntuvm4.qcow2,size=20 --vcpus 2 --os-type linux --os-variant ubuntu20.04 --network network=default,model=virtio --graphics none --console pty,target_type=serial --location http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ --extra-args "console=ttyS0"
论文阅读笔记-[SIGCOMM_17] The QUIC Transport Protocol- Design and Internet-Scale Deployment
摘要QUIC(Quick UDP Internet Connections),一种加密的,多路复用的,并且低延时的传输层协议,被设计用于提高 HTTPS 流量的传输效率以及快速的部署和持续的传输机 ...
论文阅读笔记-[Security_18] Off-Path TCP Exploit-How Wireless Routers Can Jeopardize Your Secret
摘要
作者发现了一种时序侧信道,其存在于各代半双工的 IEEE 802.11 或者 Wi-Fi 技术中。
这种设计上的错误很难被修补,不像其他漏洞。
可以应用于三大d ...
Modern C++ Learning(8)-Pointers
PointersPointer to Object of Type T
stores a memory address of an object of type T
can be used to inspect/observe/modify the target object
can be redirected to a different target (unlike references)
may also point to no object at all (be a Null Pointer)
Raw Pointers: T*
essentially an (unsigned) integer variable storing a memory address
size: 64 bits on 64 bit platforms
many raw pointers can point to the same address / object
lifetimes of pointer and taget (pointed-to) object are independent
...
Modern C++ Learning(7)-References
ReferencesCapabilities (& Limitations)non-const Referencesint i = 2;int& ri = i; // reference to i
ri and i refer to the same object / memory location:
cout << i <<'\n'; // 2cout << ri <<'\n'; // 2i = 5;cout << i <<'\n'; // 5cout << ri <<'\n'; // 5ri = 88;cout << i <<'\n'; // 88cout << ri <<'\n'; // 88
references cannot be “null” ...
Modern C++ Learning(6)-Strings (Basics)
Strings (Basics)std::string Manipulation
Literals‘a’ // char Literal“C string Literal”auto a = "seven of"; // type of a is char const[]auto b = a; // b refers to same object as aa += " nine"; // ❌ COMPILER ERROR: can't be modifiedauto c = "al" + "cove"; // ❌ COMPILER ERRORstd::string s = a; // a is copied into ss += " nine"; // ✔ (s is std::string)
“std ...
Modern C++ Learning(5)-Functions (Basics)
Functions (Basics)Return TypesFull Return Type Deduction C++14(deduction = compiler determines type automatically)
auto foo (int i, double d) { … return i;}// OK: return type: int
auto foo (int i, double d) { return i; // int … return d; // double} // ERROR: Inconsistent return types!
ParametersDefault Parametersdouble f (double a, double b = 1.5) { return (a * b);}int main () { cout << f(2); // 1 argument → 3.0 cout << f(2, 3); // 2 argumen ...
Modern C++ Learning(4)-Type System (Basics)
Type System (Basics)Type Aliasesusing NewType = OldType; C++11
typedef OldType NewType; C++98
using real = double;using ullim = std::numeric_limits<unsigned long>;using index_vector = std::vector<std::uint_least64_t>;
Prefer the more powerful (we’ll later see why) using over the outdated and ambiguous typedef!
Type Deduction: auto C++11auto variable = expression;
variable type deduced from right hand side of assignment
often more convenient, safer and future proof
also impo ...
Modern C++ Learning(3)-Control Flow (Basics)
Control Flow (Basics)Conditional Branchingif (statement; condition) { … } C++17useful for limiting the scope of temporary variables
int i = 0;std::cin >> i;if ( int x = 2*i; x > 10) { cout << x; }
Switching: Value-Based Branchingswitch (statement; variable) { … } C++17useful for limiting the scope of temporary variables
int i = 0;std::cin >> i;switch (int k = 2*i; k) { … }
Loop IterationRange-Based Loops C++11for (variable : range) { ... }
range = object ...
Modern C++ Learning(2)-Enumerations
EnumerationsScoped Enumerations C++11enum class name { enumerator1, enumerator2, ..., enumeratorN };
default: each enumerator is mapped to a whole number from 0 to N-1
enum class day { mon, tue, wed, thu, fri, sat, sun };day d = day::mon; d = day::tue; // RIGHT!d = wed; // WRONG! COMPILER ERROR: 'wed' only known in day's scope
enumerators confined to a named scope
cannot query properties of enumeration as in some other languages
Unscoped enumerationsenum name { enumerator ...