From bd9d6b0a49298fb57bac48cf90bbd7ebfcda9089 Mon Sep 17 00:00:00 2001 From: Mars Ultor Date: Sun, 2 Feb 2025 17:00:19 -0600 Subject: [PATCH] update - many samll fixes with the duplication and otehr things --- frontend/src/main.rs | 33 ++++- session.nvim | 343 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 368 insertions(+), 8 deletions(-) create mode 100644 session.nvim diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 96daa54..20b7e00 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -1,4 +1,4 @@ -use std::{collections::VecDeque, hash::{Hash, Hasher}, sync::{Arc, Mutex}, thread}; +use std::{collections::{HashSet, VecDeque}, hash::{Hash, Hasher}, sync::{Arc, Mutex}, thread}; use dioxus::prelude::*; @@ -37,19 +37,35 @@ fn main() { let message = pubsub.get_message().unwrap(); let payload_string: String = message.get_payload().unwrap(); - println!("{payload_string}"); + //println!("{payload_string}"); let notif: Vec = serde_json::from_str(payload_string.as_str()).unwrap(); - println!("Just recieved: {:#?}", notif); + //println!("Just recieved: {:#?}", notif); for notification in notif{ - reference_arc.lock().unwrap().push_front(notification.clone()); + reference_arc.lock().unwrap().push_back(notification.clone()); } while reference_arc.lock().unwrap().len() > 10{ - reference_arc.lock().unwrap().pop_back(); + reference_arc.lock().unwrap().pop_front(); } - let unique_vec: VecDeque<_> = reference_arc.lock().unwrap().clone().into_iter().collect::>().into_iter().collect(); - *reference_arc.lock().unwrap()=unique_vec; - } + println!("Current vec length: {}", reference_arc.lock() .unwrap().len()); + let temp_mutable_ref = reference_arc.lock().unwrap().clone(); + let mut temp_hash_set: HashSet = HashSet::new(); + for notif_in_order in temp_mutable_ref{ + let add: bool = temp_hash_set.insert(notif_in_order.clone()); + + if !add{ + let notif_clone = notif_in_order.clone(); + if let Some(position) = reference_arc.lock().unwrap().iter().position(|x| *x==notif_clone){ + reference_arc.lock().unwrap().remove(position); + } + + } + + } + println!("Current vec length: {}", reference_arc.lock() .unwrap().len()); + + + } }) ; dioxus::launch(App); } @@ -81,3 +97,4 @@ impl Hash for Notification{ self.url.hash(state); } } + diff --git a/session.nvim b/session.nvim new file mode 100644 index 0000000..83a214b --- /dev/null +++ b/session.nvim @@ -0,0 +1,343 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd /mnt/stock_notifs +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +let s:shortmess_save = &shortmess +if &shortmess =~ 'A' + set shortmess=aoOA +else + set shortmess=aoO +endif +badd +22 stock_news_publisher/src/main.rs +badd +23 frontend/Dioxus.toml +badd +50 frontend/src/main.rs +badd +18 /mnt/stock_notifs/frontend/src/components/echo.rs +badd +1 frontend/assets/tailwind.css +badd +36 frontend/assets/styling/main.css +badd +6 /mnt/stock_notifs/frontend/src/components/navbar.rs +badd +6 frontend/src/views/home.rs +badd +10 frontend/Cargo.toml +badd +8 stock_news_publisher/Cargo.toml +badd +18 frontend/src/components/story.rs +badd +11 frontend/src/components/mod.rs +badd +2 frontend/src/shared.rs +argglobal +%argdel +$argadd NvimTree_1 +edit stock_news_publisher/src/main.rs +let s:save_splitbelow = &splitbelow +let s:save_splitright = &splitright +set splitbelow splitright +wincmd _ | wincmd | +vsplit +1wincmd h +wincmd w +wincmd _ | wincmd | +split +1wincmd k +wincmd _ | wincmd | +vsplit +wincmd _ | wincmd | +vsplit +2wincmd h +wincmd _ | wincmd | +split +1wincmd k +wincmd w +wincmd w +wincmd _ | wincmd | +split +1wincmd k +wincmd w +wincmd w +wincmd _ | wincmd | +split +1wincmd k +wincmd w +wincmd w +wincmd _ | wincmd | +vsplit +wincmd _ | wincmd | +vsplit +2wincmd h +wincmd w +wincmd w +let &splitbelow = s:save_splitbelow +let &splitright = s:save_splitright +wincmd t +let s:save_winminheight = &winminheight +let s:save_winminwidth = &winminwidth +set winminheight=0 +set winheight=1 +set winminwidth=0 +set winwidth=1 +exe 'vert 1resize ' . ((&columns * 30 + 146) / 293) +exe '2resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 2resize ' . ((&columns * 87 + 146) / 293) +exe '3resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 3resize ' . ((&columns * 87 + 146) / 293) +exe '4resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 4resize ' . ((&columns * 87 + 146) / 293) +exe '5resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 5resize ' . ((&columns * 87 + 146) / 293) +exe '6resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 6resize ' . ((&columns * 86 + 146) / 293) +exe '7resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 7resize ' . ((&columns * 86 + 146) / 293) +exe '8resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 8resize ' . ((&columns * 87 + 146) / 293) +exe '9resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 9resize ' . ((&columns * 115 + 146) / 293) +exe '10resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 10resize ' . ((&columns * 58 + 146) / 293) +argglobal +enew +file NvimTree_1 +balt stock_news_publisher/src/main.rs +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal nofen +wincmd w +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 21 - ((19 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 21 +normal! 0134| +wincmd w +argglobal +if bufexists(fnamemodify("frontend/src/main.rs", ":p")) | buffer frontend/src/main.rs | else | edit frontend/src/main.rs | endif +if &buftype ==# 'terminal' + silent file frontend/src/main.rs +endif +balt stock_news_publisher/src/main.rs +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 46 - ((0 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 46 +normal! 059| +wincmd w +argglobal +if bufexists(fnamemodify("/mnt/stock_notifs/frontend/src/components/echo.rs", ":p")) | buffer /mnt/stock_notifs/frontend/src/components/echo.rs | else | edit /mnt/stock_notifs/frontend/src/components/echo.rs | endif +if &buftype ==# 'terminal' + silent file /mnt/stock_notifs/frontend/src/components/echo.rs +endif +balt frontend/src/views/home.rs +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 3 - ((2 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 3 +normal! 0 +wincmd w +argglobal +if bufexists(fnamemodify("frontend/src/components/story.rs", ":p")) | buffer frontend/src/components/story.rs | else | edit frontend/src/components/story.rs | endif +if &buftype ==# 'terminal' + silent file frontend/src/components/story.rs +endif +balt frontend/Cargo.toml +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 26 - ((23 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 26 +normal! 017| +wincmd w +argglobal +if bufexists(fnamemodify("frontend/assets/styling/main.css", ":p")) | buffer frontend/assets/styling/main.css | else | edit frontend/assets/styling/main.css | endif +if &buftype ==# 'terminal' + silent file frontend/assets/styling/main.css +endif +balt frontend/assets/tailwind.css +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 71 - ((14 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 71 +normal! 013| +wincmd w +argglobal +if bufexists(fnamemodify("frontend/Cargo.toml", ":p")) | buffer frontend/Cargo.toml | else | edit frontend/Cargo.toml | endif +if &buftype ==# 'terminal' + silent file frontend/Cargo.toml +endif +balt frontend/src/shared.rs +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 10 - ((5 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 10 +normal! 019| +wincmd w +argglobal +if bufexists(fnamemodify("term:///mnt/stock_notifs//676883:/usr/bin/zsh", ":p")) | buffer term:///mnt/stock_notifs//676883:/usr/bin/zsh | else | edit term:///mnt/stock_notifs//676883:/usr/bin/zsh | endif +if &buftype ==# 'terminal' + silent file term:///mnt/stock_notifs//676883:/usr/bin/zsh +endif +balt stock_news_publisher/src/main.rs +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +let s:l = 3106 - ((19 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 3106 +normal! 070| +wincmd w +argglobal +if bufexists(fnamemodify("term:///mnt/stock_notifs//680135:/usr/bin/zsh", ":p")) | buffer term:///mnt/stock_notifs//680135:/usr/bin/zsh | else | edit term:///mnt/stock_notifs//680135:/usr/bin/zsh | endif +if &buftype ==# 'terminal' + silent file term:///mnt/stock_notifs//680135:/usr/bin/zsh +endif +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +let s:l = 9353 - ((15 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 9353 +normal! 036| +wincmd w +argglobal +if bufexists(fnamemodify("term:///mnt/stock_notifs//546990:/usr/bin/zsh", ":p")) | buffer term:///mnt/stock_notifs//546990:/usr/bin/zsh | else | edit term:///mnt/stock_notifs//546990:/usr/bin/zsh | endif +if &buftype ==# 'terminal' + silent file term:///mnt/stock_notifs//546990:/usr/bin/zsh +endif +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +let s:l = 398 - ((23 * winheight(0) + 12) / 24) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 398 +normal! 08| +wincmd w +7wincmd w +exe 'vert 1resize ' . ((&columns * 30 + 146) / 293) +exe '2resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 2resize ' . ((&columns * 87 + 146) / 293) +exe '3resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 3resize ' . ((&columns * 87 + 146) / 293) +exe '4resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 4resize ' . ((&columns * 87 + 146) / 293) +exe '5resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 5resize ' . ((&columns * 87 + 146) / 293) +exe '6resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 6resize ' . ((&columns * 86 + 146) / 293) +exe '7resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 7resize ' . ((&columns * 86 + 146) / 293) +exe '8resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 8resize ' . ((&columns * 87 + 146) / 293) +exe '9resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 9resize ' . ((&columns * 115 + 146) / 293) +exe '10resize ' . ((&lines * 24 + 38) / 77) +exe 'vert 10resize ' . ((&columns * 58 + 146) / 293) +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 +let &shortmess = s:shortmess_save +let &winminheight = s:save_winminheight +let &winminwidth = s:save_winminwidth +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +nohlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim :