Added Screenshot script for i3, fixed writeup path for ranger, added aws centos to ssh, added some abbrevs for *.go in vim, added metasploit alias to .zshrc~

clean_emacs
TuDatTr 2020-05-13 05:20:44 +02:00
parent b19a19751f
commit 68b7df6495
13 changed files with 61 additions and 49 deletions

View File

@ -147,9 +147,16 @@ bindsym $mod+p exec firefox --private-window https://mos4.de
bindsym $mod+e exec urxvtc -e ranger bindsym $mod+e exec urxvtc -e ranger
bindsym $mod+m exec thunderbird bindsym $mod+m exec thunderbird
bindsym Print exec --no-startup-id maim -f png ~/Pictures/Screenshots/$(date +%G-%m)/$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png # Whole Screen
bindsym control+Shift+Print --release exec --no-startup-id maim -u -s -f png ~/Pictures/Screenshots/$(date +%G-%m)/$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png bindsym Control+Print exec --no-startup-id ~/.scripts/screenshot.sh screen
bindsym Shift+Print --release exec --no-startup-id maim -u -i $(xdotool getactivewindow) -f png ~/Pictures/Screenshots/$(date +%G-%m)/$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png
# Window
bindsym Mod1+Print --release exec --no-startup-id ~/.scripts/screenshot.sh window
# Area
bindsym Print --release exec --no-startup-id ~/.scripts/screenshot.sh area
# Kill Window
bindsym $mod+Ctrl+x --release exec --no-startup-id xkill bindsym $mod+Ctrl+x --release exec --no-startup-id xkill
# change focus # change focus

View File

@ -9,4 +9,4 @@ map nrg shell cp ~/Templates/LaTeX/Invoice/elektro_invoice.tex Gefeba_Elektr
map nrb shell cp ~/Templates/LaTeX/Invoice/engineering_invoice.tex Gefeba_Engineering_-_Rechnung_$(date +%g-%m)_-Engineering.tex; ~/Templates/LaTeX/Invoice/InvNum.sh map nrb shell cp ~/Templates/LaTeX/Invoice/engineering_invoice.tex Gefeba_Engineering_-_Rechnung_$(date +%g-%m)_-Engineering.tex; ~/Templates/LaTeX/Invoice/InvNum.sh
map nu shell touch L_$(basename %f .pdf)\.md map nu shell touch L_$(basename %f .pdf)\.md
map ntu shell cp ~/Templates/LaTeX/UniversityAssignmets/assignment.tex . map ntu shell cp ~/Templates/LaTeX/UniversityAssignmets/assignment.tex .
map nw shell sed "s/# $/# $(pwd | rev | cut -d/ -f1 | rev)/" ~/Templates/writeup.md > ./writeup.md map nw shell sed "s/# $/# $(pwd | rev | cut -d/ -f1 | rev)/" ~/.vim/templates/writeup.md > ./writeup.md

View File

@ -4,9 +4,10 @@ o:/home/tuan/.dotfiles/config
m:/run/media/tuan m:/run/media/tuan
a:/home/tuan/Documents/Arbeit a:/home/tuan/Documents/Arbeit
l:/home/tuan/Local l:/home/tuan/Local
c:/home/tuan/Documents/CTF/picoCTF c:/home/tuan/Documents/CTF
t:/home/tuan/Templates t:/home/tuan/Templates
w:/home/tuan/workspace_l/Projects w:/home/tuan/workspace_l/Projects
k:/home/tuan k:/home/tuan/Documents/CTF/TryHackMe/VulnUniversity
q:/home/tuan/.nextcloud/Quick Drop q:/home/tuan/.nextcloud/Quick Drop
':/home/tuan/.vim ':/usr/share/byobu/keybindings
e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon

22
config/.scripts/screenshot.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
d=$HOME/Pictures/Screenshots/$(date +%G-%m);
case $1 in
"screen"*)
filename=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png;
maim -f png $d/$filename;
dunstify -r 2 "Saved screenshot of screen in $d/$filename";
;;
"window"*)
filename=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png
maim -u -i $(xdotool getactivewindow) -f png $d/$filename;
dunstify -r 2 "Saved screenshot of window in $d/$filename";
;;
"area"*)
dunstify -r 2 'Taking screenshot from area.';
filename=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png;
maim -u -s -f png $d/$filename;
dunstify -r 2 "Saved in $d/$filename.";
;;
esac

View File

@ -1,15 +1,15 @@
#!/bin/sh #!/bin/sh
defaultsink=$(pactl info | grep 'Default Sink' | cut -d' ' -f3); defaultSink=$(pactl info | grep 'Default Sink' | cut -d' ' -f3);
curVolume=$(amixer get Master | grep -o \[0-9\]\\+% -m 1); curVolume=$(amixer get Master | grep -o \[0-9\]\\+% -m 1);
case $1 in case $1 in
"up"*) "up"*)
pactl set-sink-volume $defaultsink +5%; pactl set-sink-volume $defaultSink +5%;
dunstify -r 2 'sound up'\ \($curVolume\); dunstify -r 2 'sound up'\ \($curVolume\);
;; ;;
"down"*) "down"*)
pactl set-sink-volume $defaultsink -5%; pactl set-sink-volume $defaultSink -5%;
dunstify -r 2 'sound up'\ \($curVolume\); dunstify -r 2 'sound up'\ \($curVolume\);
;; ;;
"toggle"*) "toggle"*)
@ -17,7 +17,7 @@ case $1 in
if amixer get Master | grep -q off; then if amixer get Master | grep -q off; then
msg='unmuted'; msg='unmuted';
fi fi
pactl set-sink-mute $defaultsink toggle; pactl set-sink-mute $defaultSink toggle;
dunstify -r 2 'sound'\ $msg; dunstify -r 2 'sound'\ $msg;
echo $msg echo $msg
;; ;;

View File

@ -63,3 +63,9 @@ Host picoCTF
Port 22 Port 22
User mos4 User mos4
IdentityFile "/home/tuan/Documents/CTF/picoCTF/2018/30 - ssh-keyz/picoCTF" IdentityFile "/home/tuan/Documents/CTF/picoCTF/2018/30 - ssh-keyz/picoCTF"
Host CentOS
HostName 3.125.43.27
Port 22
User centos
IdentityFile /mnt/veracrypt1/mos4.de

View File

@ -3,14 +3,17 @@ set autoindent noexpandtab tabstop=4 shiftwidth=4
" Shortcuts " Shortcuts
abbrev funct func Test(t *testing.T) {<CR>}<Esc>kwwi abbrev funct func Test(t *testing.T) {<CR>}<Esc>kwwi
abbrev trun t.Run("", func(t *testing.T) {<CR>})<Esc>%la abbrev trun t.Run("", func(t *testing.T) {<CR>})<Esc>%la
abbrev terr t.Errorf("got %d, want %d", got, want) abbrev terr t.Errorf("got %v, want %v", got, want)<Esc>02f,lcaw
abbrev thelp func(t *testing.T) {<CR>t.Helper()<CR>}<Esc>ko
abbrev fori for i := 0; i <; i++{<CR>}<Esc>k2f;i abbrev fori for i := 0; i <; i++{<CR>}<Esc>k2f;i
abbrev fore for i, c := range{<CR>}<Esc>kf{i
" Compiling " Compiling
nnoremap <C-c><C-f> <Esc>:GoFmt<CR> nnoremap <C-c><C-f> <Esc>:GoFmt<CR>
nnoremap <C-c><C-c> <Esc>:!clear<CR><CR>:GoRun<CR> nnoremap <C-c><C-c> <Esc>:!clear<CR><CR>:GoRun<CR>
nnoremap <C-c><C-b> <CR>:GoBuild<CR> nnoremap <C-c><C-b> <CR>:GoBuild<CR>
nnoremap <C-c><C-t> <CR>:GoTest<CR> nnoremap <C-c><C-t> <CR>:GoTest<CR>
nnoremap <F9> <CR>:GoImports<CR>
nnoremap <C-c><C-d> <CR>:GoDebugStart<CR> nnoremap <C-c><C-d> <CR>:GoDebugStart<CR>
nnoremap gd <Esc>:GoDef nnoremap gd <Esc>:GoDef
nnoremap <F1> <Esc>:GoDoc<CR> nnoremap <F1> <Esc>:GoDoc<CR>

View File

@ -3,7 +3,6 @@ syntax on
filetype indent plugin on filetype indent plugin on
set background=light set background=light
set encoding=utf-8 set encoding=utf-8
set autowrite
set smartcase set smartcase
set incsearch set incsearch
set hlsearch set hlsearch

View File

@ -0,0 +1,2 @@
autocmd BufNewFile,BufRead *.razor setf html

View File

@ -1,33 +0,0 @@
" This callback will be executed when the entire command is completed
function! BackgroundCommandClose(channel)
" Read the output from the command into the quickfix window
unlet g:backgroundCommandOutput
endfunction
function! RunBackgroundCommand(command)
" Make sure we're running VIM version 8 or higher.
if v:version < 800
echoerr 'RunBackgroundCommand requires VIM version 8 or higher'
return
endif
if exists('g:backgroundCommandOutput')
echo 'Already running task in background'
else
echo 'Running task in background'
" Launch the job.
" Notice that we're only capturing out, and not err here. This is because, for some reason, the callback
" will not actually get hit if we write err out to the same file. Not sure if I'm doing this wrong or?
let g:backgroundCommandOutput = tempname()
call job_start(a:command, {'close_cb': 'BackgroundCommandClose', 'out_io': 'file', 'out_name': g:backgroundCommandOutput})
endif
endfunction
" So we can use :BackgroundCommand to call our function.
command! -nargs=+ -complete=shellcmd RunBackgroundCommand call RunBackgroundCommand(<q-args>)
function! GetCWD()
let l:cwd = system('pwd | rev |cut -d- -f1 | rev | xargs | sed "s/[[:space:]]/\\\\&/g\"')
echo l:cwd
call setline('.', l:cwd)
unlet l:cwd
endfunction

View File

@ -14,3 +14,4 @@ let g:polyglot_disabled = ['latex']
let g:UltiSnipsExpandTrigger="<tab>" let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>" let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>" let g:UltiSnipsJumpBackwardTrigger="<c-z>"

View File

@ -3,3 +3,5 @@
author: Tuan-Dat Tran author: Tuan-Dat Tran
date: [:VIM_EVAL:]strftime('%Y-%m-%d')[:END_EVAL:] date: [:VIM_EVAL:]strftime('%Y-%m-%d')[:END_EVAL:]
... ...
# [:VIM_EVAL:]system ("basename $(pwd)")[:END_EVAL:]

View File

@ -1,13 +1,15 @@
# Paths # Paths
export ZSH="/home/tuan/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
export PATH="$PATH:$HOME/.go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools" export PATH="$PATH:$HOME/.go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools"
export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_ROOT=/opt/dotnet export SecList=$HOME/Local/PenTesting/SecLists/
# Alias # Alias
alias q="exit" alias q="exit"
alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"' alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"'
alias xsel='xsel -ib' alias xsel='xsel -ib'
alias msfconsole="msfconsole -x \"db_connect metasploit@msf\""
# Theme # Theme
ZSH_THEME="agnoster" ZSH_THEME="agnoster"