diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 7a0ef5a..f1b30be 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -158,5 +158,5 @@ schemes: # colors: *gruvbox_material_medium_light # colors: *gruvbox_material_soft_light -# colors: *gruvbox_material_soft_light -colors: *gruvbox_material_soft_dark +colors: *gruvbox_material_soft_light +# colors: *gruvbox_material_soft_dark diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2102cd2..75abcc4 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,5 +1,7 @@ let mapleader ="," +" set termguicolors + if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) echo "Downloading junegunn/vim-plug to manage plugins..." silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ @@ -22,11 +24,14 @@ Plug 'tpope/vim-commentary' " comment out word / line with 'gc' Plug 'ap/vim-css-color' " show css colors Plug 'editorconfig/editorconfig-vim' " editor-config extension for vim Plug 'scrooloose/syntastic' " syntax checker -Plug 'airblade/vim-gitgutter' " show git diff insertions / deletions -Plug 'junegunn/vim-emoji' " emoji autocomplete + emojis in gitgutter +" Plug 'airblade/vim-gitgutter' " show git diff insertions / deletions +" Plug 'junegunn/vim-emoji' " emoji autocomplete + emojis in gitgutter Plug 'rrethy/vim-illuminate' " highlight other uses of the current word under the cursor " Plug 'jupyter-vim/jupyter-vim' " one day we'll start using jupyter in vim Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy-finder +Plug 'ibhagwan/fzf-lua', {'branch': 'main'} +" optional for icon support +Plug 'kyazdani42/nvim-web-devicons' call plug#end() @@ -36,11 +41,11 @@ set list set listchars=tab:→\ ,nbsp:␣,trail:•,precedes:«,extends:» " vim-emoji setup -set completefunc=emoji#complete -let g:gitgutter_sign_added = emoji#for('small_blue_diamond') -let g:gitgutter_sign_modified = emoji#for('small_orange_diamond') -let g:gitgutter_sign_removed = emoji#for('small_red_triangle') -let g:gitgutter_sign_modified_removed = emoji#for('collision') +" set completefunc=emoji#complete +" let g:gitgutter_sign_added = emoji#for('small_blue_diamond') +" let g:gitgutter_sign_modified = emoji#for('small_orange_diamond') +" let g:gitgutter_sign_removed = emoji#for('small_red_triangle') +" let g:gitgutter_sign_modified_removed = emoji#for('collision') " syntastic recommended settings diff --git a/.zshrc b/.zshrc index 5cc5239..fd5a8c6 100644 --- a/.zshrc +++ b/.zshrc @@ -113,7 +113,9 @@ bindkey -v [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh # make brew accessible -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +if [ -d "$HOME/linuxbrew/.linuxbrew" ] ; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +fi # set PATH so it includes user's private ~/.local/bin if it exists # lvim is installed to this directory (at least on ubuntu) @@ -123,3 +125,18 @@ fi alias pbpaste="powershell.exe -noprofile Get-Clipboard" alias pbcopy="clip.exe" + +# on exit from lf this function changes directory to last browser fir in lf +lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + if [ -d "$dir" ]; then + if [ "$dir" != "$(pwd)" ]; then + cd "$dir" + fi + fi + fi +} diff --git a/README.md b/README.md index dd58025..73312bf 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,12 @@ Here's what I've done so far: * get local admin rights * [install powertoys](https://docs.microsoft.com/en-us/windows/powertoys/install#install-with-windows-executable-file-via-github) * remap CAPS LOCK to L-CTRL +* ~~install glasswire network monitor~~ (glasswire sucks) +* install portmaster network monitor + * https://safing.io/blog/2022/10/27/portmaster-reaches-1.0/ +* install basic miktex (for LaTeX) * install [alacritty](https://alacritty.org/) (use the installer, not portable) -* install [wsl](https://docs.microsoft.com/en-us/windows/wsl/install#install-wsl-command) +* install [wsl](https://docs.microsoft.com/en-us/windows/wsl/install#install-wsl-command) + WSL specifics * fix wsl dns issue via [stackoverflow](https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error/91595#comment1911934_91595) * write wsl.conf: * `sudo touch /etc/wsl.conf` @@ -59,16 +63,20 @@ Here's what I've done so far: * add content `echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null` * add alacritty config: `/mnt/c/Users//AppData/Roaming/alacritty/alacritty.yml` * add private folder symlink: `ln -s -f /mnt/c/Users//Private ~/Private` +* follow Ubuntu guide: * `apt install neovim` (NVIM v0.4.3) - consider - * `apt install texlive` + * `apt install texlive texlive-latex-extra` * setup [ssh github](ubuntu.md#setup-ssh-key-for-github) + * install [brew](ubuntu#brew) * install [zsh + omz](ubuntu.md#apt-package) * clone this (dotfiles) repo and `cd dotfiles` * configure git (inspired by `make setup_git`) - * TODO: remove email from this file + * TODO: remove email from makefile * install [build-essential](https://askubuntu.com/a/753113/882709) to get `make` * run `make setup_locale setup_zshrc setup_tmux_a setup_nvim setup_editorconfig setup_client_mynetwork` - * TODO: move up: install [brew](ubuntu#brew) (should be done before install zsh / omz) + * configure nvim clipboard to use system clipboard - had to setup some windows yank script + * install autohotkey + * add script: shift and space + caps and escape: `sas-cae.ahk` * Next steps: - * TODO: configure nvim clipboard to use system clipboard - * TODO: nvim + tmux pasteboard should play with windows pasteboard + * TODO: tmux pasteboard should play with windows pasteboard +* install node 18 and npm diff --git a/firefox-scrolling.md b/firefox-scrolling.md index 18de015..489ab9c 100644 --- a/firefox-scrolling.md +++ b/firefox-scrolling.md @@ -11,3 +11,8 @@ mousewheel.default.delta_multiplier_y: 10 ``` > [source](https://www.reddit.com/r/firefox/comments/mq9g52/linux_firefox_performancemacos_like_mouse_wheel/) + +## other firefox config + +* new tabs open next to current tab + * `browser.tabs.insertAfterCurrent = true` diff --git a/makefile b/makefile index b13a2b9..44da630 100644 --- a/makefile +++ b/makefile @@ -5,7 +5,7 @@ setup_zshrc: ln -s -f ~/dotfiles/.zshrc ~/.zshrc setup_alacritty_wsl: - ln -s -f ~/dotfiles/.config/alacritty/alacritty.yml /mnt/c/Users/dnth/AppData/Roaming/alacritty/alacritty.yml + cp ~/dotfiles/.config/alacritty/alacritty.yml /mnt/c/Users/dnth/AppData/Roaming/alacritty/alacritty.yml setup_alacritty: mkdir -p ~/.config/alacritty diff --git a/sas-cae.ahk b/sas-cae.ahk new file mode 100644 index 0000000..a3ca434 --- /dev/null +++ b/sas-cae.ahk @@ -0,0 +1,116 @@ +; this file contains two mods: shift-and-space and control-and-escape + +; shift-and-space script +; source: https://stackoverflow.com/a/39226212 +#InputLevel, 10 ;set send level for the following code to 10 +$Space:: +#InputLevel ;set it back to default value of 0 for any remaining code +now := A_TickCount +while GetKeyState("Space", "P") ; to find out whether space-bar is held + if (A_TickCount-now > 120) ; this time is tested on asker's computer + { + SendInput {Shift Down} + KeyWait, Space + SendInput {Shift Up} + return + } + + +SendInput {Space} ; if key detected to be tapped, send space as per normal +return + + +; control-and-escape script +; source: https://gist.github.com/nocaoper/b872f97cda29bd8f0f2617606abd9fe4 +LShift & Capslock:: +SetCapsLockState, % (State:=!State) ? "on" : "alwaysoff" +Return + +g_AbortSendEsc := false + +#InstallKeybdHook +SetCapsLockState, alwaysoff +Capslock:: +g_DoNotAbortSendEsc := true +Send {LControl Down} +KeyWait, CapsLock +Send {LControl Up} +if ( A_PriorKey = "CapsLock") +{ + if(g_DoNotAbortSendEsc){ + Send {Esc} + } +} +return + +~*^a:: +~*^b:: +~*^c:: +~*^d:: +~*^e:: +~*^f:: +~*^g:: +~*^h:: +~*^i:: +~*^j:: +~*^k:: +~*^l:: +~*^m:: +~*^n:: +~*^o:: +~*^p:: +~*^q:: +~*^r:: +~*^s:: +~*^t:: +~*^u:: +~*^v:: +~*^w:: +~*^x:: +~*^y:: +~*^z:: +~*^1:: +~*^2:: +~*^3:: +~*^4:: +~*^5:: +~*^6:: +~*^7:: +~*^8:: +~*^9:: +~*^0:: +~*^Space:: +~*^Backspace:: +~*^Delete:: +~*^Insert:: +~*^Home:: +~*^End:: +~*^PgUp:: +~*^PgDn:: +~*^Tab:: +~*^Return:: +~*^,:: +~*^.:: +~*^/:: +~*^;:: +~*^':: +~*^[:: +~*^]:: +~*^\:: +~*^-:: +~*^=:: +~*^`:: +~*^F1:: +~*^F2:: +~*^F3:: +~*^F4:: +~*^F5:: +~*^F6:: +~*^F7:: +~*^F8:: +~*^F9:: +~*^F10:: +~*^F11:: +~*^F12:: + g_DoNotAbortSendEsc := false + return diff --git a/scripts/24-bit-color.sh b/scripts/24-bit-color.sh new file mode 100644 index 0000000..b557f8c --- /dev/null +++ b/scripts/24-bit-color.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# This file was originally taken (by JohnMorales) from iterm2: +# https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh +# This file was then taken by (DannyDannyDanny) from JohnMorales: +# https://github.com/JohnMorales/dotfiles/blob/master/colors/24-bit-color.sh +# +# This file echoes a bunch of 24-bit color codes +# to the terminal to demonstrate its functionality. +# The foreground escape sequence is ^[38;2;;;m +# The background escape sequence is ^[48;2;;;m +# range from 0 to 255 inclusive. +# The escape sequence ^[0m returns output to default +# +# The script can be run using if cloned locally +# $ bash /scripts/24-bit-color.sh +# +# Alternatively download the script and pipe it into bash: +# $ curl -s https://raw.githubusercontent.com/DannyDannyDanny/dotfiles/main/scripts/24-bit-color.sh | bash + +setBackgroundColor() +{ + #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3 + printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3 +} + +resetOutput() +{ + echo -en "\x1b[0m\n" +} + +# Gives a color $1/255 % along HSV +# Who knows what happens when $1 is outside 0-255 +# Echoes "$red $green $blue" where +# $red $green and $blue are integers +# ranging between 0 and 255 inclusive +rainbowColor() +{ + let h=$1/43 + let f=$1-43*$h + let t=$f*255/43 + let q=255-t + + if [ $h -eq 0 ] + then + echo "255 $t 0" + elif [ $h -eq 1 ] + then + echo "$q 255 0" + elif [ $h -eq 2 ] + then + echo "0 255 $t" + elif [ $h -eq 3 ] + then + echo "0 $q 255" + elif [ $h -eq 4 ] + then + echo "$t 0 255" + elif [ $h -eq 5 ] + then + echo "255 0 $q" + else + # execution should never reach here + echo "0 0 0" + fi +} + +for i in `seq 0 127`; do + setBackgroundColor $i 0 0 + echo -en " " +done +resetOutput +for i in `seq 255 -1 128`; do + setBackgroundColor $i 0 0 + echo -en " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor 0 $i 0 + echo -n " " +done +resetOutput +for i in `seq 255 -1 128`; do + setBackgroundColor 0 $i 0 + echo -n " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor 0 0 $i + echo -n " " +done +resetOutput +for i in `seq 255 -1 128`; do + setBackgroundColor 0 0 $i + echo -n " " +done +resetOutput + +for i in `seq 0 127`; do + setBackgroundColor `rainbowColor $i` + echo -n " " +done +resetOutput +for i in `seq 255 -1 128`; do + setBackgroundColor `rainbowColor $i` + echo -n " " +done +resetOutput diff --git a/server.md b/server.md index c8a6f10..ceb560b 100644 --- a/server.md +++ b/server.md @@ -1,7 +1,7 @@ # HOME SERVERS ## Roadmap - +* [ ] read [HN: What'ts on your home server](https://news.ycombinator.com/item?id=34271167) * [.] auto-setup ssh + ngrok on all machines * [X] client machines automation * [X] read ssh commands in [ubuntu](ubuntu.md) diff --git a/ubuntu.md b/ubuntu.md index abc0434..b7953b5 100644 --- a/ubuntu.md +++ b/ubuntu.md @@ -72,6 +72,7 @@ copy their public keys to this machine. * disable password authentication ## stterm +> :bomb: remove stterm - it'll never work on a windows machine * install requirements * `sudo apt install libfontconfig1-dev` * `sudo apt install libx11-dev` @@ -95,13 +96,20 @@ open terminal, run one code snippet at the time and check that no errors occur: # replace alacritty with stterm sudo apt install git -y # version control -# sudo apt install neovim -y # brew install nvim to get version 0.7 + +# install neovim: [src](https://vi.stackexchange.com/a/38348) +#sudo apt-get install software-properties-common +sudo add-apt-repository ppa:neovim-ppa/stable +sudo apt-get update +sudo apt-get install neovim -y + # sudo apt install librewolf -y # add librewolf repo first sudo apt install qutebrowser -y # minimal vim-binding browser sudo apt install gnome-tweaks -y # tool to remap caps to ctrl # sudo apt install alacritty -y # add alacritty repo first # replace alacritty with stterm sudo apt install tmux -y # terminal multiplexer +sudo apt install jq -y # lightweight and flexible command-line JSON processor sudo apt install make -y # utility to maintain shell program groups sudo apt install curl -y # file transfer helper sudo apt install ffmpeg -y # audio/video converter