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
;;; packages.el --- martinmariano layer packages file for Spacemacs. | |
;; | |
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors | |
;; | |
;; Author: <martin@Adam> | |
;; URL: https://github.com/syl20bnr/spacemacs | |
;; | |
;; This file is not part of GNU Emacs. | |
;; | |
;;; License: GPLv3 |
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
#!/usr/bin/zsh -f | |
set -eo pipefail | |
IFS=$'\n\t' | |
# --------------------------------------------------------------------------------------------------- | |
# Generates docset for the desired rust crate, and installs it to work with Zeal (offline doc tool). | |
# Optionally accepts an image link to add an icon. | |
# | |
# Author: Martin Mariano | |
# |
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
/// Valida CPF | |
/// Espera um `&str` no formato: "52998224725" | |
pub fn validate_cpf(cpf: &str) -> bool { | |
let all_digits_repeated = [cpf.chars().nth(0).unwrap()] | |
.repeat(11) | |
.into_iter() | |
.collect::<String>(); | |
if cpf.len() != 11 || cpf == &*all_digits_repeated { | |
return false; |
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
// A different version of chapter 8-01 on futex. | |
//! https://github.com/m-ou-se/rust-atomics-and-locks/blob/main/examples/ch8-01-futex.rs | |
//! | |
//! This version demonstrates how we can create an anonymous | |
//! memory-backed file (through memfd_create syscall), map it into the | |
//! program's memory (through mmap, memmap2 crate) and store a futex | |
//! on it. The futex is awakened later after the thread resumes from sleep. | |
//! | |
//! Futexes can be useful for having a finely grained concurrency | |
//! control on memory. |