added notes did more stuff
This commit is contained in:
parent
055e0d69ae
commit
6db7d9edf7
8
array_access/Cargo.toml
Normal file
8
array_access/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "array_access"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
18
array_access/src/main.rs
Normal file
18
array_access/src/main.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
use std::io;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let a = [1, 2, 3, 4, 5];
|
||||||
|
let mut index = String::new();
|
||||||
|
io::stdin()
|
||||||
|
.read_line(&mut index)
|
||||||
|
.expect("doh");
|
||||||
|
let index: usize = index
|
||||||
|
.trim()
|
||||||
|
.parse()
|
||||||
|
.expect("notta num");
|
||||||
|
|
||||||
|
let element = a[index];
|
||||||
|
|
||||||
|
println!("you gotta {element}");
|
||||||
|
|
||||||
|
}
|
83
notes
Normal file
83
notes
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
const is a thing
|
||||||
|
const convention is all upper with _
|
||||||
|
const evaluation info: https://doc.rust-lang.org/reference/const_eval.html
|
||||||
|
|
||||||
|
you can add arbitray scopes to modify local variables or for other purposes!
|
||||||
|
{
|
||||||
|
some random shit;
|
||||||
|
}
|
||||||
|
|
||||||
|
https://doc.rust-lang.org/book/ch03-02-data-types.html
|
||||||
|
|
||||||
|
scalars:
|
||||||
|
ints
|
||||||
|
floats
|
||||||
|
bools
|
||||||
|
chars
|
||||||
|
integer types:
|
||||||
|
8-bit i8 u8
|
||||||
|
16-bit i16 u16
|
||||||
|
32-bit i32 u32
|
||||||
|
64-bit i64 u64
|
||||||
|
128-bit i128 u128
|
||||||
|
arch isize usize
|
||||||
|
|
||||||
|
number literals
|
||||||
|
decimal 1_024
|
||||||
|
hex 0xff
|
||||||
|
oct 0o77
|
||||||
|
binary 0b1100_1011_0100_0001
|
||||||
|
byte b'E'
|
||||||
|
|
||||||
|
release builds have no overflow wrap checking
|
||||||
|
don't rely on this behavior
|
||||||
|
|
||||||
|
explicitly use
|
||||||
|
`wrapping_*` methods to do this
|
||||||
|
such as wrapping_add
|
||||||
|
Return the None value if there is overflow with the checked_* methods
|
||||||
|
Return the value and a boolean indicating whether there was overflow with the overflowing_* methods
|
||||||
|
|
||||||
|
wtf is this:
|
||||||
|
Saturate at the value’s minimum or maximum values with saturating_* methods
|
||||||
|
|
||||||
|
there are f32 and f64 floats. f64 is default cause they are about the same speed
|
||||||
|
|
||||||
|
normal math operators
|
||||||
|
int division is floor
|
||||||
|
remainder % exists
|
||||||
|
|
||||||
|
all operators:
|
||||||
|
https://doc.rust-lang.org/book/appendix-02-operators.html
|
||||||
|
|
||||||
|
|
||||||
|
type annotation:
|
||||||
|
|
||||||
|
let var: type = val;
|
||||||
|
|
||||||
|
Rust’s char type is four bytes in size and represents a Unicode Scalar Value
|
||||||
|
|
||||||
|
Compound types
|
||||||
|
|
||||||
|
primitive compound types:
|
||||||
|
tuples
|
||||||
|
arrays
|
||||||
|
|
||||||
|
Tuples:
|
||||||
|
fixed length combo of types
|
||||||
|
type is ()
|
||||||
|
|
||||||
|
pulling out the elements of a tuple into individual variables is called destructuring
|
||||||
|
|
||||||
|
Arrays:
|
||||||
|
fixed type fixed length
|
||||||
|
[]
|
||||||
|
|
||||||
|
init:
|
||||||
|
let a: [1, 2, 3];
|
||||||
|
let a: [3, 0]; // set every element to same value
|
||||||
|
reference:
|
||||||
|
let first = a[0];
|
||||||
|
they are allocated on stack
|
||||||
|
|
||||||
|
|
8
tuple1/Cargo.toml
Normal file
8
tuple1/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "tuple1"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
6
tuple1/src/main.rs
Normal file
6
tuple1/src/main.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn main() {
|
||||||
|
let x: (i32, f64, u8) = (500, 6.4, 1);
|
||||||
|
let _five_hundred = x.0;
|
||||||
|
let _six_point_four = x.1;
|
||||||
|
let _one = x.2;
|
||||||
|
}
|
23
win_oops
Normal file
23
win_oops
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
12/13/2022 05:09 AM <DIR> .
|
||||||
|
chrome-admin@V-WTEST-1-G580 C:\Users\chrome-admin>castore -ssl-dir C:/ProgramData/PuppetLabs/puppet/etc/ssl -token-type GOLO -bootstrap-token C:\token -caname "ChOps Puppet CA" -hostname v-wtest-1-g580.golo.chromi
|
||||||
|
um.org
|
||||||
|
[I2022-12-13T05:11:25.075236-08:00 7216 0 main.go:235] Creating client for: https://cert-factory.appspot.com
|
||||||
|
[I2022-12-13T05:11:25.075236-08:00 7216 0 main.go:267] ssldir is "C:/ProgramData/PuppetLabs/puppet/etc/ssl"
|
||||||
|
[I2022-12-13T05:11:26.591212-08:00 7216 0 main.go:430] created a cert request - task_id:"13ff16e2c9767d2ec976ff86125c6ab49156dd6d"
|
||||||
|
[I2022-12-13T05:11:31.707891-08:00 7216 0 main.go:451] got signed certs back for - task_id:"13ff16e2c9767d2ec976ff86125c6ab49156dd6d"
|
||||||
|
[I2022-12-13T05:11:31.871587-08:00 7216 0 main.go:506] done! Created certs and placed in "C:/ProgramData/PuppetLabs/puppet/etc/ssl/certs"
|
||||||
|
[I2022-12-13T05:11:31.871587-08:00 7216 0 main.go:193] castore took 6.8050602s to run
|
||||||
|
|
||||||
|
chrome-admin@V-WTEST-1-G580 C:\Users\chrome-admin>puppet agent -t
|
||||||
|
Info: Using environment 'production'
|
||||||
|
Error: certificate verify failed [certificate has expired for CN=puppet3-g.golo.chromium.org]
|
||||||
|
Info: Loading facts
|
||||||
|
The system cannot find the path specified.
|
||||||
|
Error: Could not retrieve catalog from remote server: certificate verify failed [certificate has expired for CN=puppet3-g.golo.chromium.org]
|
||||||
|
Warning: Not using cache on failed catalog
|
||||||
|
Error: Could not retrieve catalog; skipping run
|
||||||
|
Error: Could not send report: certificate verify failed [certificate has expired for CN=puppet3-g.golo.chromium.org]
|
||||||
|
|
||||||
|
chrome-admin@V-WTEST-1-G580 C:\Users\chrome-admin>puppet config print ssldir
|
||||||
|
C:/ProgramData/PuppetLabs/puppet/etc/ssl
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user