Skip to content

Instantly share code, notes, and snippets.

@imxiaohui
imxiaohui / hashset_union.rs
Last active May 10, 2018 06:09 — forked from rust-play/playground.rs
how to update a hashset with intersection or union
#![allow(unused)]
fn main() {
use std::collections::HashSet;
let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
// Can be seen as `a - b`.
for x in a.difference(&b) {
println!("{}", x); // Print 1
}
@rust-play
rust-play / playground.rs
Created May 10, 2018 05:56
Code shared from the Rust Playground
#![allow(unused)]
fn main() {
use std::collections::HashSet;
let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
// Can be seen as `a - b`.
for x in a.difference(&b) {
println!("{}", x); // Print 1
}
@rust-play
rust-play / playground.rs
Created May 9, 2018 10:24
Code shared from the Rust Playground
use std::collections::{HashMap, HashSet};
fn build_graph(classes: Vec<Vec<String>>) -> Vec<HashSet<usize>> {
let mut animal_to_classes = HashMap::new();
let mut graph = vec![HashSet::new(); classes.len()];
for (i, cls) in classes.iter().enumerate() {
for animal in cls.iter() {
let set = animal_to_classes.entry(animal).or_insert(HashSet::new());
set.insert(i);
}
@WillKoehrsen
WillKoehrsen / submit_assignment.py
Created March 10, 2018 20:26
Automation of Assignment Submisison
# selenium for web driving
import selenium
from selenium import webdriver
# time for pausing between navigation
import time
# Datetime for recording time of submission
import datetime
@heroheman
heroheman / spacemacs-cheatsheet.md
Last active August 25, 2025 15:09
Spacemacs Cheatsheet - A cheat sheet for my most common shortcuts in Spacemacs

General

Shortcut Description
SPC f e d Open Configuration
SPC f e R Reload Configuration
SPC SPC Search Emacs
SPC h SPC Search Spacemacs Layer
SPC f s Save Buffer
SPC q q Quit Emacs w/ Prompt
SPC q Q Quit Emacs w/o Prompt
@justsml
justsml / fetch-api-examples.md
Last active April 22, 2025 13:44
JavaScript Fetch API Examples
@mbinna
mbinna / effective_modern_cmake.md
Last active October 28, 2025 09:48
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@jrmuizel
jrmuizel / PopularCrates.md
Created April 21, 2017 19:59
Popular crates

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?