Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Ben-PH

  • Cornus, France
View GitHub Profile
@Ben-PH
Ben-PH / lib.rs
Created Aug 4, 2020
why is line 47 requiring 'static?
View lib.rs
use seed::{prelude::*, *};
use serde::{Deserialize, Serialize};
fn init(_: Url, orders: &mut impl Orders<Message>) -> Model {
log!("I N I T I A L I Z E");
// orders.subscribe(Message::UrlChanged);
// orders.send_msg(Message::GoToUrl(Url::new().set_path(&["login"])));
Model::default()
}
@Ben-PH
Ben-PH / strace.md
Last active Jun 6, 2020
Comaprison of C and Rust syscalls on startup/shutdown.
View strace.md

Abstract

For some situations, understanding system calls made during processes start-up and shut-down can be valuable. For example, consider a shell-scripts long-running hot loop that runs a very short-running process. Thus it is perhaps reasonable to hypothesise that a difference in system calls during process start-up/shut-down has a non-negligable impact on the run time of said hot-loop.

This write-up looks at how C and Rust programs differ in terms of system-calls for start-up/shutdown. It is not intended as a performance analysis and only looks at one target system.

At the end, we take a quick look at using statically linked libraries by building with # cargo build --target x86_64-unknown-linux-musl --release and removing even more syscalls by removing the main function

System

@Ben-PH
Ben-PH / TCPServer.c
Created Oct 7, 2019
The meat and bones of setting up a listen queueueueueue
View TCPServer.c
int wait_size = 5; // maximum number of waiting clients
if (listen(listen_sock, wait_size) < 0) {
printf("could not open socket for listening\n");
return 1;
}
@Ben-PH
Ben-PH / spacemacs-cheshe.md
Last active Aug 27, 2019 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet
View spacemacs-cheshe.md

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers