Skip to content

Instantly share code, notes, and snippets.

View HamzaMateen's full-sized avatar
🎯
Focusing

Hamza Mateen HamzaMateen

🎯
Focusing
View GitHub Profile
@HamzaMateen
HamzaMateen / calc.rs
Created February 19, 2024 12:00
🔥Task: Create a simple calculator using enums and pattern matching Steps Create an enum called Operation with variants Add, Subtract, Multiply, and Divide. Each variant should hold two f64 values. Create a function called calculate that takes an Operation enum as an argument and returns an f64 result. Implement the calculate function using patte…
use std::io::stdin;
use std::result::Result;
enum Operation {
Add(f64, f64),
Sub(f64, f64),
Mult(f64, f64),
Div(f64, f64),
Invalid,
}
@HamzaMateen
HamzaMateen / task1.rs
Created February 15, 2024 20:43
Rust Task - Implement a basic program that uses ownership concepts
fn main() {
let string1 = String::from("Hamza");
let string2 = String::from("Mateen");
let concatenated_string = concatenate_strings(&string1[0..5], &string2[0..6]);
println!("{}", concatenated_string);
}
Always make sure to have latest kernel header files installed! $ sudo apt install kernel-headers-$(uname -r)
PART 1:
" esc in insert & visual mode
inoremap kj <esc>
vnoremap kj <esc>
" esc in command mode
cnoremap kj <C-C>
" Note: In command mode mappings to esc run the command for some odd
" historical vi compatibility reason. We use the alternate method of
" existing which is Ctrl-C