Compare commits
	
		
			43 Commits
		
	
	
		
			95fb4c0050
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b0c5edc100 | |||
| f8fe872aff | |||
| 3900d6e89d | |||
| a03739b204 | |||
| e8daa5f7f7 | |||
| 4df4be69b7 | |||
| 5a9d8f991d | |||
| 
						 | 
					4b4fcd7e0a | ||
| 
						 | 
					308940981f | ||
| 
						 | 
					b8251a5695 | ||
| 
						 | 
					87bc2b297c | ||
| 
						 | 
					3510290e3d | ||
| 
						 | 
					b05bb89bca | ||
| 
						 | 
					80e5eae7bf | ||
| 5e4a1adff7 | |||
| 9c83663b89 | |||
| ac4d1a97a5 | |||
| 3d97c89e87 | |||
| 78237afa2a | |||
| 632653808b | |||
| d80d426a68 | |||
| eb64c319de | |||
| 0842e2d353 | |||
| 1abf7f48e2 | |||
| be2aa79a37 | |||
| ad58d4f3cd | |||
| 9ca6bed8f1 | |||
| d2cc661ed8 | |||
| c75ebcfef6 | |||
| b4813fb1de | |||
| c382a06b50 | |||
| 8182e30426 | |||
| 50525dc124 | |||
| 47bed9ba2f | |||
| 889c84819c | |||
| 830cbb4173 | |||
| ba5cc94b72 | |||
| 2e8193c40b | |||
| 5aed9d6f68 | |||
| edf0a89c7b | |||
| 678846d378 | |||
| affc7696f4 | |||
| aa539880e0 | 
							
								
								
									
										54
									
								
								.bashrc
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								.bashrc
									
									
									
									
									
								
							@@ -7,31 +7,43 @@
 | 
			
		||||
 | 
			
		||||
# alias ls='ls --color=auto'
 | 
			
		||||
PS1='\[\e[38;5;249m\]+$(jobs | wc -l)\[\e[38;5;24m\][$(ip route get 1.1.1.1 2>/dev/null | awk -F"src " '"'"'NR==1{split($2,a," ");print a[1]}'"'"')\[\e[38;5;46m\]:\[\e[38;5;208m\]\W\[\e[38;5;24m\]]\$ \[\e[0m\]'
 | 
			
		||||
alias luamake=/home/oliver/sources/lua-language-server/3rd/luamake/luamake
 | 
			
		||||
alias l=lfcd
 | 
			
		||||
alias clip="xclip -selection clipboard"
 | 
			
		||||
alias phone="simple-mtpfs"
 | 
			
		||||
alias bell="paplay /usr/share/sounds/freedesktop/stereo/complete.oga"
 | 
			
		||||
alias useage="du -h -d 1 2> /dev/null | sort -h"
 | 
			
		||||
# For laptop multi-gpu offloading
 | 
			
		||||
alias nvidia_gpu="DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
 | 
			
		||||
# Opinionated defaults
 | 
			
		||||
alias feh="swallow feh --force-aliasing --draw-exif --scale-down --draw-filename"
 | 
			
		||||
alias ffplay="swallow ffplay $@"
 | 
			
		||||
alias shutdown="shutdown -P now"
 | 
			
		||||
alias untar="tar -xvf $@"
 | 
			
		||||
 | 
			
		||||
export DENO_INSTALL="/home/oliver/.deno"
 | 
			
		||||
export PATH="$PATH:$DENO_INSTALL/bin:$HOME/.cargo/bin:$HOME/.local/bin/"
 | 
			
		||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
 | 
			
		||||
export TORCH_CUDA_VERSION="cu117"
 | 
			
		||||
export LIBTORCH="/home/oliver/sources/libtorchcxx11"
 | 
			
		||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LIBTORCH}/lib"
 | 
			
		||||
export WINEPREFIX="$HOME/.wine/"
 | 
			
		||||
export DXVK_HUD="fps,compiler"
 | 
			
		||||
export EDITOR="nvim"
 | 
			
		||||
export TZ='America/Denver'
 | 
			
		||||
 | 
			
		||||
# XDG
 | 
			
		||||
export XDG_CACHE_HOME="$HOME/.cache"
 | 
			
		||||
export XDG_CONFIG_HOME="$HOME/.config"
 | 
			
		||||
export XDG_DATA_HOME="$HOME/.local/share"
 | 
			
		||||
 | 
			
		||||
# Clean ~/
 | 
			
		||||
# Languages
 | 
			
		||||
export GOPATH="$XDG_DATA_HOME/go"
 | 
			
		||||
export GOMODCACHE="$XDG_DATA_HOME/go/mod"
 | 
			
		||||
export RBENV_ROOT="$XDG_DATA_HOME/rbenv"
 | 
			
		||||
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
 | 
			
		||||
export CARGO_HOME="$XDG_DATA_HOME/cargo"
 | 
			
		||||
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
 | 
			
		||||
export DENO_INSTALL="$XDG_DATA_HOME/deno"
 | 
			
		||||
export DOTNET_CLI_HOME="$XDG_DATA_HOME/dotnet"
 | 
			
		||||
export PYTHON_HISTORY="$XDG_CACHE_HOME/pyhton_history"
 | 
			
		||||
# Programs
 | 
			
		||||
export LESSHIST="-"
 | 
			
		||||
export WINEPREFIX="$XDG_CONFIG_HOME/wine"
 | 
			
		||||
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
 | 
			
		||||
export XAUTHORITY="$XDG_CONFIG_HOME/x11/Xauthority"
 | 
			
		||||
export GIT_CONFIG_GLOBAL="$XDG_CONFIG_HOME/gitconfig"
 | 
			
		||||
export HISTFILE="$XDG_CACHE_HOME/bash_history"
 | 
			
		||||
# Would need to be run as root, prevents the creation of "~/.sudo_as_admin_successful"
 | 
			
		||||
# echo Default !admin_flag >> /etc/sudoers.d/disable_saas
 | 
			
		||||
 | 
			
		||||
# Paths
 | 
			
		||||
export PATH="$PATH:$HOME/.local/bin/"
 | 
			
		||||
export PATH="$PATH:$CARGO_HOME/bin:$DENO_INSTALL/bin:$PYENV_ROOT/bin"
 | 
			
		||||
 | 
			
		||||
lfcd() {
 | 
			
		||||
	tmp="$(mktemp)"
 | 
			
		||||
	lfrun -last-dir-path="$tmp" "$@"
 | 
			
		||||
@@ -46,3 +58,9 @@ lfcd() {
 | 
			
		||||
	    fi
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Load aliases from file
 | 
			
		||||
if [ -f $XDG_CONFIG_HOME/aliasrc ]; then
 | 
			
		||||
    . $XDG_CONFIG_HOME/aliasrc
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								.config/aliasrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								.config/aliasrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
# New commands
 | 
			
		||||
alias clip="xclip -selection clipboard"
 | 
			
		||||
alias phone="simple-mtpfs"
 | 
			
		||||
alias bell="paplay /usr/share/sounds/freedesktop/stereo/complete.oga"
 | 
			
		||||
alias usage="du -h -d 1 2> /dev/null | sort -h"
 | 
			
		||||
# alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
 | 
			
		||||
 | 
			
		||||
# For laptop multi-gpu offloading
 | 
			
		||||
alias nvidia_gpu="DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
 | 
			
		||||
 | 
			
		||||
# Opinionated defaults
 | 
			
		||||
alias feh="swallow feh --force-aliasing --draw-exif --scale-down --draw-filename"
 | 
			
		||||
alias ffplay="swallow ffplay $@"
 | 
			
		||||
alias shutdown="shutdown -P now"
 | 
			
		||||
alias untar="tar -xvf $@"
 | 
			
		||||
alias cura="cura5 -platformtheme gtk3"
 | 
			
		||||
alias cp="cp -iv"
 | 
			
		||||
alias mv="mv -iv"
 | 
			
		||||
alias rm="rm -vI"
 | 
			
		||||
alias vim="nvim"
 | 
			
		||||
 | 
			
		||||
# User lfcd by default (it should exist), fall back
 | 
			
		||||
# to ranger if lfcd isn't found. IDK why you wouldn't
 | 
			
		||||
# have either
 | 
			
		||||
[ -x "$(command -v ranger)"] && alias l=". ranger"
 | 
			
		||||
[ -x "$(command -v lfcd)" ] && alias l="lfcd"
 | 
			
		||||
 | 
			
		||||
# enable color support of ls and also add handy aliases
 | 
			
		||||
if [ -x /usr/bin/dircolors ]; then
 | 
			
		||||
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
 | 
			
		||||
    alias ls='ls --color=auto'
 | 
			
		||||
    alias grep='grep --color=auto'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
@@ -2,4 +2,24 @@
 | 
			
		||||
	"java.import.gradle.java.home": "/usr/lib/jvm/java-17-openjdk",
 | 
			
		||||
	"java.jdt.ls.java.home": "/usr/lib/jvm/java-17-openjdk",
 | 
			
		||||
	"semanticTokens.enable": true,
 | 
			
		||||
 | 
			
		||||
	"inlayHint.enable": true,
 | 
			
		||||
	"inlayHint.display": true,
 | 
			
		||||
	"inlayHint.enableParameter": true,
 | 
			
		||||
 | 
			
		||||
  	"languageserver": {
 | 
			
		||||
    	"ccls": {
 | 
			
		||||
      		"command": "ccls",
 | 
			
		||||
			"filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
 | 
			
		||||
			"rootPatterns": [".ccls-root", "compile_commands.json"],
 | 
			
		||||
			"initializationOptions": {
 | 
			
		||||
				"cache": {
 | 
			
		||||
					"directory": ".ccls-cache"
 | 
			
		||||
				},
 | 
			
		||||
				"client": {
 | 
			
		||||
					"snippetSupport": true
 | 
			
		||||
        		}
 | 
			
		||||
      		}
 | 
			
		||||
    	}
 | 
			
		||||
  	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,27 +6,25 @@ Plug 'https://github.com/preservim/nerdtree' " file tree
 | 
			
		||||
Plug 'https://github.com/airblade/vim-gitgutter' " git diff
 | 
			
		||||
Plug 'luochen1990/rainbow'
 | 
			
		||||
Plug 'navarasu/onedark.nvim'
 | 
			
		||||
" Plug 'https://github.com/weilbith/nvim-code-action-menu' " fix my shit helper window :)
 | 
			
		||||
Plug 'neoclide/coc.nvim', {'branch': 'release'} " code completion
 | 
			
		||||
 | 
			
		||||
call plug#end()
 | 
			
		||||
 | 
			
		||||
" =============== Vannila vim config ================================================
 | 
			
		||||
let mapleader = "\\"
 | 
			
		||||
:set splitbelow
 | 
			
		||||
:set clipboard=unnamedplus
 | 
			
		||||
:set number relativenumber 
 | 
			
		||||
:windo set nowrap 
 | 
			
		||||
:set showcmd
 | 
			
		||||
:set mouse=a
 | 
			
		||||
set splitbelow
 | 
			
		||||
set clipboard=unnamedplus
 | 
			
		||||
set number relativenumber 
 | 
			
		||||
windo set nowrap 
 | 
			
		||||
set showcmd
 | 
			
		||||
set mouse=a
 | 
			
		||||
" :set cursorline
 | 
			
		||||
:set foldmethod=syntax
 | 
			
		||||
:set updatetime=250
 | 
			
		||||
:set tabstop=4 shiftwidth=4 smarttab
 | 
			
		||||
:highlight Comment ctermfg=Grey
 | 
			
		||||
set foldmethod=syntax
 | 
			
		||||
set updatetime=250
 | 
			
		||||
set tabstop=4 shiftwidth=4 smarttab
 | 
			
		||||
highlight Comment ctermfg=Grey
 | 
			
		||||
nnoremap <silent> <leader>p :split +term <CR>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
" =============== NERDTree ================================================
 | 
			
		||||
" Toggle file browser
 | 
			
		||||
nnoremap <silent> <leader>e :NERDTreeToggle<CR>
 | 
			
		||||
@@ -36,16 +34,16 @@ let g:onedark_config = {
 | 
			
		||||
	\ 'style': 'warmer',
 | 
			
		||||
\}
 | 
			
		||||
colorscheme onedark
 | 
			
		||||
:hi CocFloating 		guibg=#151515	guifg=clear 	
 | 
			
		||||
:hi Pmenu 				guibg=#151515 	guifg=clear
 | 
			
		||||
:hi @parameter 							guifg=#ed6215
 | 
			
		||||
:hi CursorColumn 		guibg=#e2c792 	guifg=#232326 
 | 
			
		||||
hi CocFloating 	guibg=#151515	guifg=clear
 | 
			
		||||
hi Pmenu 	guibg=#151515 	guifg=clear
 | 
			
		||||
" hi @parameter			guifg=#ed6215
 | 
			
		||||
hi CursorColumn guibg=#e2c792 	guifg=#232326
 | 
			
		||||
 
 | 
			
		||||
" =============== NERDTree Config ================================================
 | 
			
		||||
:let NERDTreeShowHidden=1
 | 
			
		||||
let NERDTreeShowHidden=1
 | 
			
		||||
"
 | 
			
		||||
" =============== Rainbow Config ================================================
 | 
			
		||||
:let g:rainbow_active = 1
 | 
			
		||||
let g:rainbow_active = 1
 | 
			
		||||
 | 
			
		||||
" =============== COC Config ================================================
 | 
			
		||||
 | 
			
		||||
@@ -64,16 +62,16 @@ endfunction
 | 
			
		||||
autocmd CursorHold * silent call CocActionAsync('highlight')
 | 
			
		||||
 | 
			
		||||
" coc rename
 | 
			
		||||
nnoremap <silent> <leader>r <Plug>(coc-rename)
 | 
			
		||||
nmap <leader>r <Plug>(coc-rename)
 | 
			
		||||
" Jump between references and definiton 
 | 
			
		||||
nnoremap <silent> <C-k> :call CocActionAsync('jumpReferences')<CR>
 | 
			
		||||
nnoremap <silent> K :call CocActionAsync('jumpDefinition')<CR>
 | 
			
		||||
nnoremap <leader>j :call CocActionAsync('jumpReferences')<CR>
 | 
			
		||||
nnoremap <leader>k :call CocActionAsync('jumpDefinition')<CR>
 | 
			
		||||
" show help menu
 | 
			
		||||
nnoremap <C-u> :call CocActionAsync('codeAction', 'cursor')<CR>
 | 
			
		||||
 | 
			
		||||
nnoremap <leader>d :call CocActionAsync('codeAction', 'cursor')<CR>
 | 
			
		||||
nnoremap <leader>a :call CocActionAsync('runCommand', 'editor.action.formatDocument')<CR>
 | 
			
		||||
 | 
			
		||||
" Show Documentation
 | 
			
		||||
nnoremap <silent> J :call ShowDocumentation()<CR>
 | 
			
		||||
nnoremap <leader>f :call ShowDocumentation()<CR>
 | 
			
		||||
function! ShowDocumentation() " Show hover when provider exists, fallback to vim's builtin behavior.
 | 
			
		||||
	if CocAction('hasProvider', 'hover')
 | 
			
		||||
		call CocActionAsync('definitionHover')
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
x11_home="$XDG_CONFIG_HOME/x11"
 | 
			
		||||
 | 
			
		||||
userresources=$HOME/.Xresources
 | 
			
		||||
usermodmap=$HOME/.Xmodmap
 | 
			
		||||
userresources=$x11_home/Xresources
 | 
			
		||||
usermodmap=$x11_home/Xmodmap
 | 
			
		||||
sysresources=/etc/X11/xinit/.Xresources
 | 
			
		||||
sysmodmap=/etc/X11/xinit/.Xmodmap
 | 
			
		||||
 | 
			
		||||
@@ -39,6 +40,7 @@ xcompmgr -n &
 | 
			
		||||
 | 
			
		||||
xrandr --output HDMI-1 --mode 1920x1080 --rate 60 --brightness 0.8 --left-of DP-3
 | 
			
		||||
xrandr --output DP-3 --mode 1920x1080 --rate 165 --brightness 0.8 --primary
 | 
			
		||||
otd-daemon & disown
 | 
			
		||||
 | 
			
		||||
start-pipewire &
 | 
			
		||||
dbus-launch --exit-with-session awesome
 | 
			
		||||
@@ -1,3 +1,2 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
 | 
			
		||||
pw-play /usr/share/sounds/freedesktop/stereo/complete.oga
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.local/bin/brightness
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								.local/bin/brightness
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
xrandr | grep " connected" | awk '{print $1}' | xargs -I% xrandr --output % --brightness $1
 | 
			
		||||
							
								
								
									
										58
									
								
								.local/bin/chroot-gen
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										58
									
								
								.local/bin/chroot-gen
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# Adapted from LinuxConfig.org 
 | 
			
		||||
# GNU GPL v3.0+
 | 
			
		||||
 | 
			
		||||
# cmds build into bash: echo, cd
 | 
			
		||||
CMDS="bash clear mkdir touch mv rm ls grep cat vim"
 | 
			
		||||
 | 
			
		||||
USER=$1
 | 
			
		||||
CMDS=($CMDS) # convert to array
 | 
			
		||||
# Create user if not exist
 | 
			
		||||
if ! id "$USER" 2&>/dev/null; then
 | 
			
		||||
	echo 'INFO: User not found'
 | 
			
		||||
	echo 'Creating...'
 | 
			
		||||
	useradd --create-home --shell /usr/bin/bash $USER
 | 
			
		||||
	echo "Password for $USER:"
 | 
			
		||||
	passwd $USER
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
CHROOT=$(eval echo ~$USER)
 | 
			
		||||
 | 
			
		||||
mkdir -p $CHROOT$CHROOT # make new home dir
 | 
			
		||||
chown $USER:$USER $CHROOT$CHROOT
 | 
			
		||||
echo "PS1='\[\e[38;5;202m\][\[\e[38;5;45m\]\h\[\e[38;5;202m\]:\[\e[38;5;40m\]\W\[\e[38;5;202m\]]\\$ \[\e[0m\]'" > $CHROOT$CHROOT/.bashrc
 | 
			
		||||
 | 
			
		||||
# ChrootDirectory requires these permissions 
 | 
			
		||||
chown root:root $CHROOT
 | 
			
		||||
chmod 745 $CHROOT
 | 
			
		||||
printf "Match User $USER\n 	ChrootDirectory $CHROOT" > /etc/ssh/sshd_config.d/70-$USER.conf
 | 
			
		||||
 | 
			
		||||
# cp user and group into chroot
 | 
			
		||||
mkdir -p $CHROOT/etc/
 | 
			
		||||
cat /etc/passwd | grep $USER > $CHROOT/etc/passwd
 | 
			
		||||
cat /etc/group | grep $USER > $CHROOT/etc/group
 | 
			
		||||
 | 
			
		||||
# cp in all commands and dependencies 
 | 
			
		||||
for cmd in "${CMDS[@]}"; do
 | 
			
		||||
	for dep in $( ldd $(which $cmd) | grep -v dynamic | cut -d " " -f 3 | sed 's/://' | sort | uniq ); do
 | 
			
		||||
    	cp --parents $dep $CHROOT
 | 
			
		||||
	done
 | 
			
		||||
	cp --parents $(which $cmd) $CHROOT
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
SHELL=$(cat /etc/passwd | grep $USER | tr ":" "\n" | tail -n 1)
 | 
			
		||||
if [ ! -f $CHROOT$SHELL ]; then 
 | 
			
		||||
	echo "WARN: You didn't add the shell specified in /etc/passwd for \"$USER\": ($SHELL)"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# ARCH amd64
 | 
			
		||||
if [ -f /lib64/ld-linux-x86-64.so.2 ]; then
 | 
			
		||||
   cp --parents /lib64/ld-linux-x86-64.so.2 /$CHROOT
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# ARCH i386
 | 
			
		||||
if [ -f  /lib/ld-linux.so.2 ]; then
 | 
			
		||||
   cp --parents /lib/ld-linux.so.2 /$CHROOT
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
systemctl restart sshd
 | 
			
		||||
							
								
								
									
										8
									
								
								.local/bin/printclip
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								.local/bin/printclip
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
for (( i=1; i<4; i++ )); do
 | 
			
		||||
	echo $i
 | 
			
		||||
	sleep 1
 | 
			
		||||
done
 | 
			
		||||
echo "Go!"
 | 
			
		||||
xclip -o | xdotool type --file -
 | 
			
		||||
							
								
								
									
										2
									
								
								.local/bin/reload
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								.local/bin/reload
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
sudo s6-rc -d change $1 && sudo s6-rc -u change $1
 | 
			
		||||
							
								
								
									
										2
									
								
								.local/bin/srt-mp4-embed
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								.local/bin/srt-mp4-embed
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
ffmpeg -i "$1" -i "$2" -c:s mov_text -c:v copy -c:a copy $(basename "$1").embed.mp4
 | 
			
		||||
@@ -1,27 +1,45 @@
 | 
			
		||||
FILE=$1
 | 
			
		||||
OTHER=$2
 | 
			
		||||
EXTENSION=".new.mp4"
 | 
			
		||||
TEMP="/tmp/"
 | 
			
		||||
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
__usage="Usage: $(basename $0) FILE [ssh alias]
 | 
			
		||||
Options:
 | 
			
		||||
	[FILE],      Input video file
 | 
			
		||||
	[ssh alias], The alias setup in ~/.ssh/config (default location)
 | 
			
		||||
	             See: ssh_config(5)
 | 
			
		||||
	-d,          Delete origional file
 | 
			
		||||
Notes:
 | 
			
		||||
The file will be copied to the remote computer and then the new file movied to the local computer.
 | 
			
		||||
This can use lots of bandwidth. Plan accordingly.
 | 
			
		||||
"
 | 
			
		||||
 | 
			
		||||
if [[ -z $1 ]];
 | 
			
		||||
then
 | 
			
		||||
	echo "$__usage"
 | 
			
		||||
	echo "Pass the file to encode as the first argument."
 | 
			
		||||
	exit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ -z $2 ]];
 | 
			
		||||
then
 | 
			
		||||
	echo "$__usage"
 | 
			
		||||
	echo "Pass the ssh alias of the remote device as the second argument."
 | 
			
		||||
	exit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# move file to other's temp drive
 | 
			
		||||
scp $FILE $OTHER:$TEMP
 | 
			
		||||
# use ffmpeg to encode on other computer
 | 
			
		||||
ssh $OTHER "ffmpeg -y -i $TEMP$FILE -vcodec h264_nvenc -acodec aac -pix_fmt yuv420p -g 15 -movflags frag_keyframe+empty_moov $TEMP$FILE$EXTENSION"
 | 
			
		||||
# move file back
 | 
			
		||||
scp $OTHER:$TEMP$FILE$EXTENSION .
 | 
			
		||||
# delete temp file
 | 
			
		||||
ssh $OTHER "rm $TEMP$FILE; rm $TEMP$FILE$EXTESION"
 | 
			
		||||
FILE=$1
 | 
			
		||||
BASE=$(basename "$FILE")
 | 
			
		||||
OTHER=$2
 | 
			
		||||
EXTENSION=".new.mp4"
 | 
			
		||||
TEMP="/tmp/" # don't put in a dir with spaces
 | 
			
		||||
 | 
			
		||||
# move file to other's temp drive
 | 
			
		||||
scp "$FILE" $OTHER:$TEMP
 | 
			
		||||
# use ffmpeg to encode on other computer
 | 
			
		||||
ssh $OTHER "ffmpeg -y -i $TEMP\"$BASE\" -vcodec hevc -filter:v scale=-2:720 $TEMP\"$BASE\"$EXTENSION"
 | 
			
		||||
# move file back
 | 
			
		||||
scp $OTHER:$TEMP"$BASE"$EXTENSION "$FILE"$EXTENSION
 | 
			
		||||
# delete temp file
 | 
			
		||||
ssh $OTHER "rm $TEMP\"$FILE\"; rm $TEMP\"$FILE\"$EXTENSION"
 | 
			
		||||
 | 
			
		||||
if [[ $3 == "-d" ]];
 | 
			
		||||
	rm $FILE
 | 
			
		||||
then
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								.local/bin/tgz
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								.local/bin/tgz
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
tar cvf $1.tar $1 
 | 
			
		||||
gzip --best $1.tar
 | 
			
		||||
rm $1.tar
 | 
			
		||||
							
								
								
									
										11
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.md
									
									
									
									
									
								
							@@ -1,2 +1,13 @@
 | 
			
		||||
# config
 | 
			
		||||
These are my configs for my personal linux systems (AwesomeWM / X11)
 | 
			
		||||
## Installation
 | 
			
		||||
This is needed to install nvim plugins
 | 
			
		||||
```bash
 | 
			
		||||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
 | 
			
		||||
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
 | 
			
		||||
```
 | 
			
		||||
otherwise just copy the .local and .config folders into your system's
 | 
			
		||||
 | 
			
		||||
## Coc plugins
 | 
			
		||||
* coc-pyright
 | 
			
		||||
* coc-rust-analyzer
 | 
			
		||||
		Reference in New Issue
	
	Block a user