This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
FILTER="${FILTER:="."}" | |
TOOLCHAIN_BK="$(rustup toolchain list | rg default | awk '{print $1}')" | |
TOOLCHAIN_KIND_BK="$(echo "$TOOLCHAIN_BK" | rg -o '^(stable|nightly)')" | |
if [ "$TOOLCHAIN_KIND_BK" != "stable" ]; then | |
rustup install stable | |
rustup default stable | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# N.B. The only tool missing here that is mentioned in the document is `zenmap` | |
# purely because this image is intended to be run via a CLI and `zenmap` is a GUI | |
# to `nmap` i.e. one can play around with the tools by running: | |
# | |
# $ docker build --name bite_size_networking:latest . | |
# $ docker run --rm -d --name bsn_test bite_size_networking:latest | |
# $ docker exec -it bsn_test bash | |
# | |
# Alternatively, one can change the `ENTRYPOINT` to `["bash"]` and run: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ╌ ╍ ╎ ╏ | |
┌ ┍ ┎ ┏ ┐ ┑ ┒ ┓ | |
└ ┕ ┖ ┗ ┘ ┙ ┚ ┛ | |
├ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ | |
┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┏━━━┓ | |
┃ ┃ | |
┗━━━┛ | |
┏━┳━┳━┓ | |
┃ ┃ ┃ ┃ | |
┗━┻━┻━┛ | |
╭───╮ | |
│ │ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(allocator_api)] | |
use std::alloc::Allocator; | |
use std::alloc::Global; | |
use std::marker::PhantomData; | |
// Basicaly a Vec. | |
pub struct V<T, A: Allocator = Global> { | |
pub buf: Rv<T, A>, | |
pub len: usize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import time | |
API_KEY = "" | |
API_TOKEN = "" | |
table_id = "" | |
url = "https://api.trello.com/1/boards/{}/cards/closed/?key={}&token={}".format(table_id, API_KEY, API_TOKEN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::Rng; | |
use std::default::Default; | |
use std::{cell::RefCell, collections::HashMap, time::Duration}; | |
use tokio::{self, select, task, task_local, time::timeout}; | |
fn rand_gen_millis() -> (u64, u64) { | |
let mut rng = rand::thread_rng(); | |
let t1 = rng.gen_range(0..10); | |
let t2 = rng.gen_range(0..10); | |
(t1, t2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use tokio; | |
use tokio::{task, task_local}; | |
use std::cell::RefCell; | |
use std::collections::HashMap; | |
#[tokio::main] | |
async fn main() { | |
let handler = task::spawn(async { | |
task_local! { | |
pub static WRITER: RefCell<HashMap<String, i64>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rust Idiom: | |
// prefixing a variable with an underscore | |
// signals to others that the variable | |
// isn't going to be used, not that it is | |
// intentionally private or an updated | |
// variable. | |
main () { | |
let x = 12; | |
// _x reads as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NB. fix | |
// #[derive(Debug, Clone)] | |
#[derive(Debug)] | |
struct Context; | |
fn dupe_context(context: &Context) -> Context { | |
context.clone() | |
} | |
fn main() { |
NewerOlder