Misc: Rust, Helix, tmux underline, bash, rg, ...
Add: - Rust and Helix install/configure scripts - tmux curly underline with colors - Rocky SSH & Mosh setup - `asciinema` and `rg` - Mosh PPA for old Ubuntu systems - VirtualBox USB devices group - Add `~/.local/bin/` to path in .bashrc Update: - Use `~/.bash_login` instead of `~/.profile` for tmux on login and exec it - Rename `gnome-todo` to `endeavour` - Use new sshd alias - Reload instead of restarting sshd Remove: - Vim colorschemes and plugins - `.sh` extensions on executable scripts
This commit is contained in:
parent
7ff86d5f2d
commit
c772724cac
@ -1,32 +1,32 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -e
|
||||||
cd ssh
|
cd ssh
|
||||||
./ssh.sh
|
./ssh
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd bash
|
cd bash
|
||||||
./bash.sh
|
./bash
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd git
|
cd git
|
||||||
./git.sh
|
./git
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd vim
|
cd vim
|
||||||
./vim.sh
|
./vim
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd gnome
|
cd gnome
|
||||||
./gnome.sh
|
./gnome
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd readline
|
cd readline
|
||||||
./readline.sh
|
./readline
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd tmux
|
cd tmux
|
||||||
./tmux.sh
|
./tmux
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd home-chmod
|
cd home-chmod
|
||||||
./home-chmod.sh
|
./home-chmod
|
||||||
cd ..
|
cd ..
|
@ -9,6 +9,10 @@ export EDITOR='vim'
|
|||||||
export VISUAL='vim'
|
export VISUAL='vim'
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
|
if [[ -d "$HOME/.local/bin" && ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
||||||
|
PATH="$HOME/.local/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
# cool colored command prompt
|
# cool colored command prompt
|
||||||
|
|
||||||
PS1='${debian_chroot:+($debian_chroot)}\[\e[01;38;5;11m\]\u\[\e[00;38;5;208m\]@\[\e[01;38;5;27m\]\h\[\e[00m\]:\[\e[00;38;5;45m\]\w\[\e[0m\]\$ '
|
PS1='${debian_chroot:+($debian_chroot)}\[\e[01;38;5;11m\]\u\[\e[00;38;5;208m\]@\[\e[01;38;5;27m\]\h\[\e[00m\]:\[\e[00;38;5;45m\]\w\[\e[0m\]\$ '
|
||||||
@ -32,20 +36,23 @@ popd() {
|
|||||||
cd .
|
cd .
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
cat >> ~/.profile << 'EOF'
|
if [ -f ~/.bash_profile ]; then
|
||||||
|
mv ~/.bash_profile ~/.bash_login
|
||||||
|
fi
|
||||||
|
cat >> ~/.bash_login << 'EOF'
|
||||||
|
|
||||||
# custom
|
# custom
|
||||||
|
|
||||||
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ]; then
|
if [ -z "$TMUX" ] && [ -n "$SSH_TTY" ]; then
|
||||||
tput sc
|
tput sc
|
||||||
tput smso
|
tput smso
|
||||||
echo -n 'tmux: space - shell: any key'
|
echo -n 'tmux: space / shell: any key'
|
||||||
tput sgr0
|
tput sgr0
|
||||||
read -rsN1 input
|
read -rsN1 input
|
||||||
tput rc
|
tput rc
|
||||||
tput el
|
tput el
|
||||||
if [ "$input" = ' ' ]; then
|
if [ "$input" = ' ' ]; then
|
||||||
tmux new -As default
|
exec tmux new -As default
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
@ -2,6 +2,10 @@ set -g clock-mode-style 12
|
|||||||
set -g default-command "${SHELL}"
|
set -g default-command "${SHELL}"
|
||||||
set -g default-terminal "tmux-256color"
|
set -g default-terminal "tmux-256color"
|
||||||
set -as terminal-features ",xterm-256color:RGB"
|
set -as terminal-features ",xterm-256color:RGB"
|
||||||
|
# curly underline support
|
||||||
|
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
|
||||||
|
# underline colors - needs tmux-3.0
|
||||||
|
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
|
||||||
set -g history-limit 10000
|
set -g history-limit 10000
|
||||||
set -g prefix C-q
|
set -g prefix C-q
|
||||||
set -sg escape-time 25
|
set -sg escape-time 25
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
" vim-plug
|
|
||||||
call plug#begin()
|
|
||||||
Plug 'chriskempson/base16-vim'
|
|
||||||
Plug 'dhruvasagar/vim-table-mode'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
colorscheme base16-default-dark
|
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
syntax on
|
syntax on
|
||||||
|
|
||||||
|
2
auto/vim/vim
Executable file
2
auto/vim/vim
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cp -i .vimrc ~
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cp -i .vimrc ~
|
|
||||||
curl -Lo ~/.vim/autoload/plug.vim --create-dirs \
|
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
65
manual/helix/helix
Executable file
65
manual/helix/helix
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
if ! command -v cargo > /dev/null; then
|
||||||
|
echo "Error: cargo not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! command -v c++ > /dev/null; then
|
||||||
|
echo "Error: c++ not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git clone https://github.com/helix-editor/helix helix-git
|
||||||
|
cd helix-git
|
||||||
|
cargo install --locked --path helix-term
|
||||||
|
mkdir -p ~/.config/helix
|
||||||
|
rm -rf runtime/grammars/sources
|
||||||
|
mv runtime ~/.config/helix
|
||||||
|
rm -rf helix-git
|
||||||
|
cat > ~/.config/helix/config.toml << 'EOF'
|
||||||
|
theme = "monokai_pro_ristretto"
|
||||||
|
|
||||||
|
[editor]
|
||||||
|
auto-pairs = false
|
||||||
|
bufferline = "multiple"
|
||||||
|
rulers = [101]
|
||||||
|
|
||||||
|
[editor.statusline]
|
||||||
|
left = ["mode", "spinner", "file-name"]
|
||||||
|
center = ["position-percentage"]
|
||||||
|
right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending"]
|
||||||
|
|
||||||
|
[keys.normal]
|
||||||
|
space.z = ":reflow 100"
|
||||||
|
|
||||||
|
[editor.soft-wrap]
|
||||||
|
enable = true
|
||||||
|
EOF
|
||||||
|
cat > ~/.config/helix/languages.toml << 'EOF'
|
||||||
|
[editor]
|
||||||
|
auto-pairs = false
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = 'rust'
|
||||||
|
indent.unit = "\t"
|
||||||
|
indent.tab-width = 4
|
||||||
|
config.checkOnSave = { command = "clippy" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "c"
|
||||||
|
indent = { tab-width = 4, unit = "\t" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "cpp"
|
||||||
|
indent = { tab-width = 4, unit = "\t" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = 'java'
|
||||||
|
indent.unit = "\t"
|
||||||
|
indent.tab-width = 4
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "markdown"
|
||||||
|
language-server = { command = "ltex-ls" }
|
||||||
|
file-types = ["md"]
|
||||||
|
scope = "source.markdown"
|
||||||
|
roots = []
|
||||||
|
EOF
|
32
manual/rust/rust
Executable file
32
manual/rust/rust
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
if [ $# -gt 2 ]; then
|
||||||
|
echo "Usage: $0 [-f]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$1" = '-f' ]; then
|
||||||
|
force=true
|
||||||
|
fi
|
||||||
|
if ! command -v curl > /dev/null; then
|
||||||
|
echo "Error: curl not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if command -v cargo > /dev/null && [ "$force" != true ]; then
|
||||||
|
echo "Error: rust already installed; use -f to force"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
rustup component add rust-analyzer
|
||||||
|
cat >> ~/.cargo/config.toml << 'EOF'
|
||||||
|
[registries.crates-io]
|
||||||
|
protocol = "sparse"
|
||||||
|
EOF
|
||||||
|
mkdir -p ~/.local/bin
|
||||||
|
cat >> ~/.local/bin/rust-analyzer << 'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
$(rustup which rust-analyzer) "$@"
|
||||||
|
EOF
|
||||||
|
chmod +x ~/.local/bin/rust-analyzer
|
||||||
|
cargo install cargo-auditable
|
||||||
|
cargo install --force cargo-auditable rust-script
|
||||||
|
./rust-configure
|
64
manual/rust/rust-configure
Executable file
64
manual/rust/rust-configure
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env rust-script
|
||||||
|
//! ```cargo
|
||||||
|
//! [dependencies]
|
||||||
|
//! anyhow = "1.0.69"
|
||||||
|
//! dirs = "4.0.0"
|
||||||
|
//! ```
|
||||||
|
|
||||||
|
use anyhow::Context;
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
fs::{self, File},
|
||||||
|
io::{BufRead, BufReader},
|
||||||
|
};
|
||||||
|
|
||||||
|
const ENV: &str = r#". "$HOME/.cargo/env""#;
|
||||||
|
|
||||||
|
fn main() -> anyhow::Result<()> {
|
||||||
|
let home = dirs::home_dir().context("can't find home directory")?;
|
||||||
|
let mut login_path = home.clone();
|
||||||
|
login_path.push(".bash_login");
|
||||||
|
let login = BufReader::new(File::open(&login_path).context("failed to read ~/.bash_login")?);
|
||||||
|
let mut bashrc_path = home.clone();
|
||||||
|
bashrc_path.push(".bashrc");
|
||||||
|
let bashrc = BufReader::new(File::open(&bashrc_path).context("failed to read ~/.bashrc")?);
|
||||||
|
|
||||||
|
let mut empty = false;
|
||||||
|
let mut new_bashrc = String::new();
|
||||||
|
for line in bashrc.lines() {
|
||||||
|
let line = line.context("failed to read line in ~/.bashrc")?;
|
||||||
|
if line.is_empty() && empty {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
empty = line.is_empty();
|
||||||
|
if line != ENV {
|
||||||
|
new_bashrc.push_str(&line);
|
||||||
|
new_bashrc.push('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut empty = false;
|
||||||
|
let mut new_login = String::new();
|
||||||
|
for line in login.lines() {
|
||||||
|
let line = line.context("failed to read line in ~/.bash_login")?;
|
||||||
|
if line.is_empty() && empty {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
empty = line.is_empty();
|
||||||
|
if line != ENV {
|
||||||
|
new_login.push_str(&line);
|
||||||
|
new_login.push('\n');
|
||||||
|
}
|
||||||
|
if line == "# custom" {
|
||||||
|
new_login.push('\n');
|
||||||
|
new_login.push_str(ENV);
|
||||||
|
new_login.push_str("\n\n");
|
||||||
|
empty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::write(bashrc_path, &new_bashrc).context("failed to write new .bashrc")?;
|
||||||
|
fs::write(login_path, &new_login).context("failed to write new .bash_login")?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
8
setup/rocky-setup.md
Normal file
8
setup/rocky-setup.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Rocky 9 Setup
|
||||||
|
|
||||||
|
## OpenSSH Server & Mosh
|
||||||
|
|
||||||
|
Same as Ubuntu, but:
|
||||||
|
- `s/apt/dnf/g`
|
||||||
|
- `s/sshd_config/sshd_config-rhel/g`
|
||||||
|
- `s/OpenSSH/SSH/g`
|
@ -5,13 +5,13 @@ Here's my personal Ubuntu 22.10 setup. (Make sure to enable Wayland on Nvidia!)
|
|||||||
- Set font size in Terminal to 15 and initial column count to 85
|
- Set font size in Terminal to 15 and initial column count to 85
|
||||||
- Must haves:
|
- Must haves:
|
||||||
- `sudo apt install curl ddcutil deja-dup earlyoom ffmpeg flatpak git gnome-boxes gnome-clocks \
|
- `sudo apt install curl ddcutil deja-dup earlyoom ffmpeg flatpak git gnome-boxes gnome-clocks \
|
||||||
gnome-software-plugin-flatpak gnome-sound-recorder gnome-todo gnome-weather goldendict gparted \
|
gnome-software-plugin-flatpak gnome-sound-recorder endeavour gnome-weather goldendict gparted \
|
||||||
keepassxc mosh mpv needrestart obs-studio shadowsocks-libev sshfs synaptic tmux trash-cli ufw \
|
keepassxc mosh mpv needrestart obs-studio shadowsocks-libev sshfs synaptic tmux trash-cli ufw \
|
||||||
vim-gtk3 vlc wl-clipboard`
|
vim-gtk3 vlc wl-clipboard rg
|
||||||
- Optional:
|
- Optional:
|
||||||
- `sudo apt install gnome-firmware gnome-games gnome-nettool gnome-packagekit gnome-passwordsafe \
|
- `sudo apt install gnome-firmware gnome-games gnome-nettool gnome-packagekit gnome-passwordsafe \
|
||||||
gnome-shell-pomodoro gnome-usage gthumb mkvtoolnix-gui openjdk-17-jdk pulseeffectsqpdf ranger \
|
gnome-shell-pomodoro gnome-usage gthumb mkvtoolnix-gui openjdk-17-jdk pulseeffectsqpdf ranger \
|
||||||
syncplay virtualbox-qt heif-gdk-pixbuf heif-thumbnailer`
|
syncplay virtualbox-qt heif-gdk-pixbuf heif-thumbnailer asciinema`
|
||||||
- Remove all snaps:
|
- Remove all snaps:
|
||||||
- ```
|
- ```
|
||||||
# if this command fails, unmount the snap mounts as reported by `mount` and try again
|
# if this command fails, unmount the snap mounts as reported by `mount` and try again
|
||||||
@ -49,6 +49,8 @@ Here's my personal Ubuntu 22.10 setup. (Make sure to enable Wayland on Nvidia!)
|
|||||||
- Cross compiling (?)
|
- Cross compiling (?)
|
||||||
- `gcc-aarch64-linux-gnu`
|
- `gcc-aarch64-linux-gnu`
|
||||||
- `gcc-arm-linux-gnueabihf`
|
- `gcc-arm-linux-gnueabihf`
|
||||||
|
- Virtualbox
|
||||||
|
- `sudo usermod -aG vboxusers $(whoami)`
|
||||||
|
|
||||||
## UFW
|
## UFW
|
||||||
|
|
||||||
@ -228,6 +230,8 @@ sudo chmod -R 700 /opt/grub
|
|||||||
## OpenSSH Server & Mosh
|
## OpenSSH Server & Mosh
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# trusted PPA from mosh developer for truecolor support
|
||||||
|
# sudo add-apt-repository ppa:keithw/mosh-dev
|
||||||
sudo apt install -y openssh-server mosh
|
sudo apt install -y openssh-server mosh
|
||||||
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
|
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
|
||||||
sudo cp ../system/sshd/sshd_config /etc/ssh/sshd_config
|
sudo cp ../system/sshd/sshd_config /etc/ssh/sshd_config
|
||||||
@ -240,7 +244,7 @@ chmod 600 ~/.ssh/authorized_keys
|
|||||||
# insert your SSH public keys into the file
|
# insert your SSH public keys into the file
|
||||||
sudo ufw limit OpenSSH
|
sudo ufw limit OpenSSH
|
||||||
sudo ufw allow 60001:60999/udp
|
sudo ufw allow 60001:60999/udp
|
||||||
sudo systemctl restart ssh
|
sudo systemctl reload sshd
|
||||||
```
|
```
|
||||||
|
|
||||||
## See logs as admin
|
## See logs as admin
|
||||||
|
@ -4,9 +4,9 @@ Port 22
|
|||||||
PermitRootLogin no
|
PermitRootLogin no
|
||||||
PubkeyAuthentication yes
|
PubkeyAuthentication yes
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
# would be deprecated soon by
|
# deprecated alias:
|
||||||
# KbdInteractiveAuthentication no
|
# ChallengeResponseAuthentication no
|
||||||
ChallengeResponseAuthentication no
|
KbdInteractiveAuthentication no
|
||||||
UsePAM yes
|
UsePAM yes
|
||||||
AllowTcpForwarding yes
|
AllowTcpForwarding yes
|
||||||
X11Forwarding yes
|
X11Forwarding yes
|
||||||
|
16
system/sshd/sshd_config-rhel
Normal file
16
system/sshd/sshd_config-rhel
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Include /etc/ssh/sshd_config.d/*.conf
|
||||||
|
AllowGroups ssh-users
|
||||||
|
Port 22
|
||||||
|
PermitRootLogin no
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
PasswordAuthentication no
|
||||||
|
# deprecated alias:
|
||||||
|
# ChallengeResponseAuthentication no
|
||||||
|
KbdInteractiveAuthentication no
|
||||||
|
AuthorizedKeysFile .ssh/authorized_keys
|
||||||
|
UsePAM yes
|
||||||
|
AllowTcpForwarding yes
|
||||||
|
X11Forwarding yes
|
||||||
|
PrintMotd no
|
||||||
|
AcceptEnv LANG LC_* COLORTERM
|
||||||
|
Subsystem sftp /usr/libexec/openssh/sftp-server
|
Loading…
x
Reference in New Issue
Block a user