Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-g
option.
extern crate futures; | |
extern crate futures_cpupool; | |
extern crate rand; | |
use futures::{Future, Sink, Stream}; | |
/// Sleep for a random time between 0 and 1 second. | |
fn sleep_random() { | |
let sleep_time_ms = rand::random::<u8>() as f64 / 255.0 * 1000.0; | |
std::thread::sleep(std::time::Duration::from_millis(sleep_time_ms as u64)); |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-g
option.
Prerequisites : the letsencrypt CLI tool
This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.
You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge
.
Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.
I redirect all HTTP requests on HTTPS, so my nginx config looks like :
server {
CONFIG = { | |
'Arial Black' : 'ENG', | |
'Arial' : 'ENG', | |
'Calibri' : 'ENG', | |
'Cambria' : 'ENG', | |
'Candara' : 'ENG', | |
'Comic Sans MS' : 'ENG', | |
'Constantia' : 'ENG', | |
'Corbel' : 'ENG', | |
'Georgia' : 'ENG', |
var amqp = require('amqplib/callback_api'); | |
// if the connection is closed or fails to be established at all, we will reconnect | |
var amqpConn = null; | |
function start() { | |
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) { | |
if (err) { | |
console.error("[AMQP]", err.message); | |
return setTimeout(start, 1000); | |
} |
/* http://redd.it/2zna5q | |
* Fibonacci example: | |
* (1) (2) + | |
* 0:0 | |
* 1:1 | |
* 20 | |
*/ | |
#define _BSD_SOURCE // MAP_ANONYMOUS | |
#include <stdio.h> | |
#include <stdlib.h> |
Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.
In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ nano ~/.zshrc
path=('/path/to/depot_tools' $path)
#define NOMINMAX // Otherwise the min/max will be defined as macros on VS | |
#include <algorithm> | |
#include <array> | |
#include <atomic> | |
#include <cctype> | |
#include <chrono> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <cstring> |