Covers different areas of programming and the best practices/components explained.
A crate that contains a trait StructOpt. Allows a structure Opt to be converted
| use hyper::{Client, Server, Request, Response, Body}; | |
| use anyhow::*; | |
| use std::net::SocketAddr; | |
| use hyper::service::{make_service_fn, service_fn}; | |
| use std::sync::{Arc, RwLock}; | |
| fn mutate_request(req: &mut Request<Body>) -> Result<()> { | |
| for key in &["content-length", "transfer-encoding", "accept-encoding", "content-encoding"] { | |
| req.headers_mut().remove(*key); | |
| } |
Covers different areas of programming and the best practices/components explained.
A crate that contains a trait StructOpt. Allows a structure Opt to be converted
This is the second article in a series of articles around Rusts new async/await
feature. The first article about interfaces can be found
here.
In this part of the series we want to a look at a mechanism which behaves very
different in Rust than in all other languages which feature async/await
support. This mechanism is Cancellation.
| # Location of the image which will contain the new ext4 partition | |
| DROPBOXFILE="$HOME"/.dropbox.img | |
| # Current location of my Dropbox folder | |
| DROPBOXHOME="$HOME"/Dropbox | |
| # Where we will copy the folder to. If you have little space, you could make this | |
| # a folder on a USB drive | |
| DROPBOXBACKUP="$HOME"/old_Dropbox |
| all: | |
| clang -g -O2 -Wall -Wextra net.c send.c -o send | |
| clang -g -O2 -Wall -Wextra net.c receive.c -o receive | |
| clang -g -O2 -Wall -Wextra net.c proxy-naive.c -o proxy-naive | |
| clang -g -O2 -Wall -Wextra net.c proxy-splice.c -o proxy-splice |
Flamegraphing in Rust can now be done with a new cargo subcommand. Please check this out before embarking on the legacy journey below:
https://github.com/flamegraph-rs/flamegraph
perf, using Brendan Gregg's guide:
http://www.brendangregg.com/perf.html#Prerequisitesflamegraph from repo:| /* Burn some CPU time then segfault */ | |
| int main() | |
| { | |
| volatile int i; | |
| for (i=0; i>=0; i++) | |
| ; | |
| *(volatile char*)0; | |
| return 0; | |
| } |
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" |
For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.
After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft