Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Operate Remote Servers Using SSH

General Tips and Traps

  1. The permissions of the directory ~/.ssh and its subcontents on both the local machine and the remote server must be properly set in order for SSH login via public key to work. A good pratice is to set the permission of ~/.ssh to 700 (on both …

Seed Many RNGs in Rust

There are different ways to seed many RNGs (for parallel RNGs). Below summarizes 3 popular ways. Seeding RNGs using std::collections::hash_map::RandomState or rand::thread_rng is preferred.

Seed Using System Time

use std::time::{SystemTime, UNIX_EPOCH};
use rand::SmallRng;

fn main () {
    let seed = SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .unwrap()
        .as_nanos …

Manage Docker Images and Containers

  1. It is suggested that you use osquery or dockeree to query Docker images, containers, etc.

Remove Containers

Note that running containers will NOT be removed by default. This is what users want generally speaking. You can use the option -f to force removing running containers, but use it with caution …

Tips on Bytehound

Bytehound works with Rust stable (Rust nightly is not required) .

Installation

apt-get install gcc nodejs npm
npm install -g yarn
cargo build --release -p bytehound-preload
cargo build --release -p bytehound-cli

Or if you use icon,

icon bytehound -ic

Usage

Run your application with bytehound to collect memory usage data.

export …