update doots

This commit is contained in:
riley 2021-10-19 23:09:24 -04:00
parent e9f966929e
commit 76ac48fa92
4 changed files with 53 additions and 29 deletions

4
.vimrc
View file

@ -39,7 +39,7 @@ set splitright
"nnoremap <C-H> <C-W><C-H> "nnoremap <C-H> <C-W><C-H>
"formatting "formatting
set tabstop=4 set tabstop=2
set softtabstop=0 noexpandtab set softtabstop=0 noexpandtab
set shiftwidth=4 set shiftwidth=4
@ -55,7 +55,7 @@ set number
nnoremap <C-t> :NERDTreeToggle<CR> nnoremap <C-t> :NERDTreeToggle<CR>
"Language server junk "Language server junk
let g:lsc_server_commands = {'py': 'pyls'} let g:lsc_server_commands = {'py': 'pyls', 'xsh': 'pyls'}
let g:lsc_auto_map = v:true let g:lsc_auto_map = v:true

View file

@ -5,12 +5,17 @@ xontrib load apt_tabcomplete argcomplete autovox jedi z
# path stuff # path stuff
$PATH.insert(0, '') def load_path():
$PATH.extend([ import sys
'~/addins', $PATH.extend([
'~/.local/bin', '~/addins',
'~/bin', '~/.local/bin',
]) '~/bin',
'~/go/bin'
])
sys.path.insert(0, '')
load_path()
import addins # my extra stuffs :p import addins # my extra stuffs :p
@ -37,16 +42,20 @@ def _debug():
print("Debug mode enabled.") print("Debug mode enabled.")
# bitwarden shit # bitwarden shit
def _bwc(object : str, id : str): def _bwc(object : str, bw_id: str):
if p'~/.bw_session'.exists(): if p'~/.bw_session'.exists():
if $XONSH_SHOW_TRACEBACK: if $XONSH_SHOW_TRACEBACK:
print("loaded .bw_session") print("loaded .bw_session")
source ~/.bw_session source ~/.bw_session
else: else:
raise FileNotFoundError("~/.bw_session") raise FileNotFoundError("~/.bw_session")
output = $(bw get @(object) @(id)) output = $(bw get @(object) @(bw_id))
$(echo @(output) | xclip -sel clipboard) $(echo @(output) | xclip -sel clipboard)
return output if "password" in object and !(bw get totp @(object[1]) a> /dev/null):
input("totp found, press any key to copy totp ")
output = $(bw get totp @(object[1]))
$(echo @(output) | xclip -sel clipboard)
# return output
# aliases # aliases
aliases.update({ aliases.update({
@ -57,6 +66,7 @@ aliases.update({
'debug': _debug, 'debug': _debug,
'ls': 'ls -alhs --color=auto', 'ls': 'ls -alhs --color=auto',
':q': 'exit', ':q': 'exit',
'owo': 'echo uwu',
}) })
# man page colors :O # man page colors :O

View file

@ -1,4 +1,4 @@
from .version import * from .version import Version
from .package import * from .package import Package
__all__ = ['Version', 'Package'] __all__ = ['Version', 'Package']

View file

@ -1,21 +1,35 @@
import platform
from pathlib import Path from pathlib import Path
__all__ = ['Version'] __all__ = ['Version']
class Version: class Platform:
def __init__(self): def __init__(self):
data = self._load_dict() self.architecture = platform.architecture()
for key, value in data.items(): self.machine = platform.machine()
setattr(self, key.lower(), value) self.node = platform.node()
if hasattr(self, "id_like"): # special handling for ID_LIKE self.platform = platform.platform()
self.id_like = self.id_like.split() self.processor = platform.processor()
self.release = platform.release()
self.system = platform.system()
self.version = platform.version()
def _load_dict(self): class Version:
data = {} def __init__(self):
os_files = Path('/etc').glob("*-release") data = self._load_dict()
for i in os_files: for key, value in data.items():
with i.open() as f: setattr(self, key.lower(), value)
for line in f: if hasattr(self, "id_like"): # special handling for ID_LIKE
line = line.split("=") self.id_like = self.id_like.split()
data[line[0]] = line[1].strip().replace('"', '') if not hasattr(self, "platform"):
return data self.platform = Platform()
def _load_dict(self):
data = {}
os_files = Path('/etc').glob("*-release")
for i in os_files:
with i.open() as f:
for line in f:
line = line.split("=")
data[line[0]] = line[1].strip().replace('"', '')
return data