add systemd support; update docs

This commit is contained in:
rskntroot
2024-07-16 08:25:10 +00:00
parent c1299413a0
commit 94d945a24b
4 changed files with 207 additions and 5 deletions

View File

@@ -2,14 +2,21 @@
## Rskio
This site is meant to catalog my efforts. Through the years, I have "spun my wheels" in order to learn, get something working, or even try something interesting--only for it to be lost to time. You could boil this site down to my notes. However, I fully intend for it to be much more than that. This site exists for me and the possibilty something I did might help you too.
This site is meant to catalog my efforts. Over the years, I've "spun my wheels" to learn, get things working, or explore interesting ideas--only for them to be lost to time. You might see this site as a collection of my notes or at times my memoirs, words shaped only by my inspiration in the moment. However, I intend for it to be much more. This site exists for me along with the hope that something I've done might help you.
## About Me
## About
It's been what now? Just over 10 years since I started working in computing professionally. Right after dropping out of a Computer Science program too (oops)! Oh, and about 14 since I learned my first programming language. What?! Im in my thirties?! Guess I cant go saying Im just some random kid on the internet anymore.
Its been what, now? Around 10 years since I started working in computing proffessionally (right after dropping out of a Computer Science program, oops). Oh and about 14 since I'd learned my first programming language. What?! I'm in my thirties?! Guess I can't go saying I'm just some random kid on the internet anymore.
My story starts like many others'. My family couldn't get the WiFi working when broadband internet hit the shelves, leaving me to pick up the slack. What was seen as a knack for electronics quickly snowballed into a middle school robotics class, followed by a summer school course in C# programming. In high school, I managed three semesters of plain ol C, along with a few summer courses in electrical engineering, photography, and web design.
Just like everyone else my age, I got into computing because my family didn't know how to get the wifi working when we finally got broadband internet. Somehow that got me into robotics and programming in middle school and it snowballed from there. After a multi-year stint with the challenges of the cyber security field, I found peace letting other people deal with it. These days I'm a full-time computer engineer that designs and deploys network infrastructure for a Tier-1 cloud provider. In my spare time, I work on projects or dream of financial freedom that would allow me to work on whatever projects I want full-time.
University Java courses were a breeze. However, failing to attend Discrete Mathematics II, Physics, and Calculus classes ended in disaster, showcasing just how much I was in need of some serious structure. One would imagine that studying computer science would impart the imperative of having some semblance of structure in ones life. Yet, naivety sounded the horns of triumph: I dropped out.
"Real life" had started for me; I didn't have $100 to my name, let alone a bed. I pleaded with both friends and family to host me while I figured things out. Within a few months, I managed to secure a job as a C++ programmer for a company that provided custom software solutions aimed at healthcare—wild! This time was short-lived, and out of fear of my own lack of structure, I decided to enlist. As God would have it, I ended up in computer networking despite my best efforts at Navscoleod. Looking back at that time, I marvel at how I operated, chasing dreams of grandeur, only to be consumed by the consequences of my own naivety.
Imagine being a hobbyist and pseudo-classically trained programmer in the military. Your only task: to maintain critical communications networks. What a treat! I was determined to make the most of each opportunity that came my way. Delving into networking, protocol analysis, and network services, I found myself involved in everything related. This led to redesigning network maintenance systems, building data center environments, employing remote communication systems, and eventually becoming the lead for a cybersecurity initiative.
After separating, I held several contracting positions, including a multi-year stint as a Security Operations Center Lead Engineer. While tackling cybersecurity challenges in air-gapped environments, I grew weary of the pace of government work. These days, Im a full-time network development engineer, designing and deploying network infrastructure for a Tier-1 cloud provider. In my spare time, I either work on personal projects or dream of the financial freedom that would allow me to dedicate my time to them full-time.
## What does Rskio Mean?
@@ -21,7 +28,7 @@ Prounciation:
=== "IPA"
`ɑːr-ɛs-keɪ-aɪ-əʊ`
Nothing. Just like QUIC and the G in GNU. As a "programmer" from a young age, I too struggle with naming variables and cache invalidation. It's sort of a mix of a nickname I had when I was young and Input/Outout or IO. After trying to think of something clever that pays homage to Nihei's TOHA Heavy Industries, I inevtiably gave up and fought with Route53 until it provided me a 5-letter .com that made sense to me.
Nothing. Just like QUIC and the G in GNU. As a "programmer" from a young age, I too struggle with naming variables and cache invalidation. It's a blend of a nickname I had when I was younger and Input/Output, or IO. After trying to come up with something clever that pays homage to Nihei's TOHA Heavy Industries, I inevitably gave up and wrestled with Route53 until it provided me with a 5-letter .com that made sense to me.
The same goes for "Rskntroot", it's a mix of that same nickname and the classic "root" term.

View File

@@ -0,0 +1,30 @@
# HomeLab Network
## Firewall
https://firewalla.com/products/firewalla-gold-plus
## Routing
https://store.ui.com/us/en/pro/category/all-unifi-cloud-gateways/products/udm-pro-max
## Switching
=== "Switch to Wifi and NAS"
Unmanaged PoE Switch with 4 x 2.5GbE PoE+@120W + 2x 10G SFP Uplink
https://www.amazon.com/NICGIGA-Port-2-5G-PoE-10G/dp/B0CDH12CVK?ref_=ast_sto_dp&th=1
=== "Switch to PoE Cameras"
## Wifi
https://store.ui.com/us/en/pro/category/all-wifi/products/u7-pro
## Cameras
https://store.ui.com/us/en/pro/category/all-cameras-nvrs/products/uvc-g5-bullet

View File

@@ -0,0 +1,151 @@
# Rust
## Env::args()
### Brief
A naive attempt at optimizing a simple ipv4 address checker using env::args()
#### Assumptions
=== "Cargo.tml"
``` toml
[profile.release]
strip = "symbols"
debug = 0
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
```
#### Unoptimized
- Stores args as an immutable (imut) string vector
- Stores `ip_addr` as imut string then shadows as imut string slice vector
- Uses len() calls for no real reason
=== "main.rs"
``` rust
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
let ip_addr: String = args[1].to_string();
let ip_addr: Vec<&str> = ip_addr.split('.').collect();
if ip_addr.len() == 4 {
for octect in ip_addr {
octect.parse::<u8>().expect(&format!("invalid ip"));
}
} else {
panic!("invalid ip")
}
}
}
```
=== "strace"
``` zsh
~/workspace/ipcheck> sha256sum src/main.rs
4cb6865ea743c3a2cee6e05966e117b8db51f32cb55de6baad205196bbc4195d src/main.rs
~/workspace/ipcheck> cargo build --release
Compiling ipcheck v0.1.0 (/home/lost/workspace/ipcheck)
Finished `release` profile [optimized] target(s) in 2.93s
~/workspace/ipcheck> strace -c ./target/release/ipcheck 1.1.1.1
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ------------------
37.07 0.000470 470 1 execve
14.43 0.000183 14 13 mmap
8.52 0.000108 21 5 read
7.10 0.000090 15 6 mprotect
6.78 0.000086 21 4 openat
3.63 0.000046 23 2 munmap
3.08 0.000039 9 4 newfstatat
2.76 0.000035 11 3 brk
2.60 0.000033 6 5 rt_sigaction
2.52 0.000032 8 4 close
2.37 0.000030 7 4 pread64
1.50 0.000019 6 3 sigaltstack
1.34 0.000017 17 1 1 access
1.34 0.000017 8 2 prlimit64
1.10 0.000014 7 2 1 arch_prctl
1.03 0.000013 13 1 poll
0.71 0.000009 9 1 sched_getaffinity
0.63 0.000008 8 1 getrandom
0.55 0.000007 7 1 set_tid_address
0.47 0.000006 6 1 set_robust_list
0.47 0.000006 6 1 rseq
------ ----------- ----------- --------- --------- ------------------
100.00 0.001268 19 65 2 total
```
#### Optimized
- Needs some cleanup
- Needs break for args after index 1
=== "main.rs"
``` rust
use std::env;
fn main() {
for (index, arg) in env::args().enumerate(){
if index == 1 {
for (i, octect) in arg.split('.').collect::<Vec<&str>>().iter().enumerate() {
if i > 3 {
panic!("invalid")
} else {
let _ = &octect.parse::<u8>().expect("invalid");
}
}
}
}
}
```
=== "strace"
``` zsh
~/workspace/ipcheck> sha256sum src/main.rs
838b3f0c99448e8bbe88001de4d12f5062d293a2a1fd236deacfabdb30a7e2e4 src/main.rs
~/workspace/ipcheck> cargo build --release
Compiling ipcheck v0.1.0 (/home/lost/workspace/ipcheck)
Finished `release` profile [optimized] target(s) in 2.89s
~/workspace/ipcheck> strace -c ./target/release/ipcheck 1.1.1.1 06/22/2024 07:57:31 PM
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ------------------
23.07 0.000161 12 13 mmap
15.33 0.000107 21 5 read
13.04 0.000091 15 6 mprotect
10.17 0.000071 17 4 openat
6.73 0.000047 23 2 munmap
4.87 0.000034 6 5 rt_sigaction
4.01 0.000028 7 4 pread64
4.01 0.000028 7 4 newfstatat
3.72 0.000026 6 4 close
2.87 0.000020 6 3 sigaltstack
2.15 0.000015 5 3 brk
2.01 0.000014 14 1 poll
1.86 0.000013 6 2 prlimit64
1.29 0.000009 9 1 sched_getaffinity
1.15 0.000008 8 1 getrandom
1.00 0.000007 3 2 1 arch_prctl
1.00 0.000007 7 1 set_tid_address
0.86 0.000006 6 1 set_robust_list
0.86 0.000006 6 1 rseq
0.00 0.000000 0 1 1 access
0.00 0.000000 0 1 execve
------ ----------- ----------- --------- --------- ------------------
100.00 0.000698 10 65 2 total
```