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 std::fs::File; | |
use std::io; | |
use std::io::Read; | |
fn main() { | |
let mut user_input = String::new(); | |
io::stdin().read_line(&mut user_input).expect("Failed to read line"); | |
let result = read_file(String::from(user_input.trim())); | |
match result { |
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
version: '3' | |
services: | |
ghost: | |
image: ghost:1-alpine | |
container_name: ghost-blog | |
restart: always | |
ports: | |
- 80:2368 | |
environment: | |
database__client: mysql |
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 std::collections::HashSet; | |
use git2::{Commit, Repository, Tree, TreeWalkMode, TreeWalkResult}; | |
use thiserror::Error; | |
fn main() -> Result<(), Error> { | |
let repository = Repository::open_from_env()?; | |
let odb = repository.odb()?; | |
let mut objects: HashSet<String> = HashSet::new(); |
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 std::sync::atomic::Ordering; | |
use std::sync::Arc; | |
use std::{cell::UnsafeCell, sync::atomic::AtomicBool}; | |
use std::{thread, usize}; | |
fn main() { | |
const N: usize = 100; | |
let data = Arc::new(Mutex::new(0)); | |
let mut handles = Vec::with_capacity(N); |
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 std::cell::RefCell; | |
use std::rc::Weak; | |
#[derive(Debug)] | |
pub struct Node<T> { | |
data: T, | |
// must be a RefCell because we want to store non Copy type `Vec` | |
// while allowing interior mutability (necessary for this cyclic type) | |
// this doesn't necessarily need to be weak, it is just for learning | |
// purposes |