summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorSuper User <root@p.noml.ch>2026-03-23 19:09:37 +0800
committerSuper User <root@p.noml.ch>2026-03-23 19:09:37 +0800
commitc332cf11dc0266f31eeae067ace5a9bda18122c6 (patch)
treee4934d0f83aa1c7138e9b22efea97d5bf67ad905 /setup
parentdea4663f14bcb1703aa616ad05172667e452e701 (diff)
flatten setup directory structure
Diffstat (limited to 'setup')
-rwxr-xr-xsetup/core/install-packages.sh27
-rwxr-xr-xsetup/core/packages/install_claude.sh8
-rwxr-xr-xsetup/core/packages/install_rust.sh7
-rwxr-xr-xsetup/core/ssh.sh12
-rw-r--r--setup/core/tmux.conf11
-rwxr-xr-xsetup/core/tmux.sh5
-rwxr-xr-xsetup/core/vim.sh66
-rwxr-xr-xsetup/git/set-global_user.sh2
-rwxr-xr-xsetup/git/tools/git-ssh-wrapper.sh2
-rw-r--r--setup/git/tools/usefulbutnotthatusefulidkwhattodo0
-rwxr-xr-xsetup/port-forward/persistent-ssh.sh35
-rwxr-xr-xsetup/port-forward/rm_all_ssh_connections.sh4
-rwxr-xr-xsetup/port-forward/ssh-multiport-forward.sh44
-rwxr-xr-xsetup/port-forward/ssh-port-forward.sh19
-rwxr-xr-xsetup/setup.sh21
15 files changed, 0 insertions, 263 deletions
diff --git a/setup/core/install-packages.sh b/setup/core/install-packages.sh
deleted file mode 100755
index fb0a75d..0000000
--- a/setup/core/install-packages.sh
+++ /dev/null
@@ -1,27 +0,0 @@
1#!/bin/bash
2
3# Install core packages
4sudo dnf install -y epel-release
5#sudo dnf group install -y "Development Tools"
6sudo dnf install -y nc openssl bat autossh tmux htop tar bmon gzip tree wget curl plocate nano vim unzip net-tools git python3 python3-pip make wireguard-tools usbutils yum
7sudo dnf install -y xclip
8
9sudo dnf install -y gcc gcc-c++ openssl-devel
10sudo dnf install -y java-latest-openjdk-devel
11#sudo dnf install -y asio-devel boost-devel openssl-devel
12
13# Execute all package installation scripts
14SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15for script in "$SCRIPT_DIR/packages"/*.sh; do
16 if [ -f "$script" ]; then
17 "$script"
18 fi
19done
20
21#install packages ml
22#pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
23#pip3 install transformers
24
25#sudo yum install -y python3-openstackclient s3fs-fuse awscli
26#pip install jupyterlab python-swiftclient
27#sudo dnf update -y
diff --git a/setup/core/packages/install_claude.sh b/setup/core/packages/install_claude.sh
deleted file mode 100755
index 99a881d..0000000
--- a/setup/core/packages/install_claude.sh
+++ /dev/null
@@ -1,8 +0,0 @@
1#!/bin/bash
2sudo dnf install -y tar
3# Install Node.js via nvm and Claude Code
4curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
5export NVM_DIR="$HOME/.nvm"
6[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7nvm install 22
8npm install -g @anthropic-ai/claude-code
diff --git a/setup/core/packages/install_rust.sh b/setup/core/packages/install_rust.sh
deleted file mode 100755
index 921a533..0000000
--- a/setup/core/packages/install_rust.sh
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/bash
2
3# Install Rust and Cargo tools
4curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5echo '[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"' >> ~/.bashrc
6source "$HOME/.cargo/env"
7cargo install cargo-clone-crate cargo-edit cargo-info evcxr_jupyter bacon du-dust ripgrep bandwhich
diff --git a/setup/core/ssh.sh b/setup/core/ssh.sh
deleted file mode 100755
index c4454ae..0000000
--- a/setup/core/ssh.sh
+++ /dev/null
@@ -1,12 +0,0 @@
1#!/bin/bash
2
3dnf install -y git
4
5echo "PasswordAuthentication no" | sudo tee -a /etc/ssh/sshd_config
6echo "AllowTcpForwarding yes" | sudo tee -a /etc/ssh/sshd_config
7echo "GatewayPorts yes" | sudo tee -a /etc/ssh/sshd_config
8echo "AllowAgentForwarding yes" | sudo tee -a /etc/ssh/sshd_config
9
10git clone https://git.noml.ch/keys/ ~/keys
11~/keys/add-ssh-keys.sh
12sudo systemctl restart sshd
diff --git a/setup/core/tmux.conf b/setup/core/tmux.conf
deleted file mode 100644
index f01bf59..0000000
--- a/setup/core/tmux.conf
+++ /dev/null
@@ -1,11 +0,0 @@
1# Vi mode for copy
2setw -g mode-keys vi
3
4# Mouse selection
5set -g mouse on
6
7# v to start selection, y to yank (like vim)
8bind-key -T copy-mode-vi v send-keys -X begin-selection
9bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1"
10bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1"
11bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 p.noml.ch 5023 >/dev/null 2>&1"
diff --git a/setup/core/tmux.sh b/setup/core/tmux.sh
deleted file mode 100755
index 1e5d3db..0000000
--- a/setup/core/tmux.sh
+++ /dev/null
@@ -1,5 +0,0 @@
1#!/bin/bash
2
3cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4
5cp tmux.conf /etc/tmux.conf
diff --git a/setup/core/vim.sh b/setup/core/vim.sh
deleted file mode 100755
index bd99a13..0000000
--- a/setup/core/vim.sh
+++ /dev/null
@@ -1,66 +0,0 @@
1#!/bin/bash
2
3cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4
5VIMRC_PATH="/etc/vimrc"
6[ -d /etc/vim ] && VIMRC_PATH="/etc/vim/vimrc"
7CLIP_HOST="p.noml.ch"
8CLIP_PORT="5023"
9CLIP_CMD="openssl enc -aes-256-cbc -pbkdf2 -pass pass:YourPassword | nc -w 1 ${CLIP_HOST} ${CLIP_PORT}"
10
11grep -q 'netcat_clipboard' "$VIMRC_PATH" && exit 0
12
13cat << EOF >> "$VIMRC_PATH"
14augroup netcat_clipboard
15 au!
16 au TextYankPost * call system("echo " . shellescape(@") . " | ${CLIP_CMD} >/dev/null 2>&1 &")
17augroup END
18
19" Enable line wrapping
20set wrap
21
22" Optional: Make wrapped lines easier to read by indenting them
23set breakindent
24set breakindentopt=shift:1
25
26syntax on
27set mouse=a
28set expandtab
29set shiftwidth=4
30set softtabstop=4
31set tabstop=4
32set noautoindent
33set nosmartindent
34filetype plugin indent on
35
36set laststatus=2 " permanent status bar
37set statusline=%F " shows full file path
38
39if (has("termguicolors"))
40 set termguicolors
41endif
42
43"colorscheme murphy
44colorscheme zellner
45
46" Ctrl+A: Move to the beginning of the line in INSERT mode
47inoremap <C-a> <Home>
48
49" Ctrl+E: Move to the end of the line in INSERT mode
50inoremap <C-e> <End>
51
52" Ctrl+A: Move to the beginning of the line in NORMAL mode
53nnoremap <C-a> 0
54
55" Ctrl+E: Move to the end of the line in NORMAL mode
56nnoremap <C-e> $
57
58set number
59setlocal regexpengine=2
60set paste
61set foldcolumn=12
62
63set noswapfile
64autocmd InsertLeave * silent! update
65
66EOF
diff --git a/setup/git/set-global_user.sh b/setup/git/set-global_user.sh
deleted file mode 100755
index 30e11eb..0000000
--- a/setup/git/set-global_user.sh
+++ /dev/null
@@ -1,2 +0,0 @@
1git config --global user.email "hc@email.ch"
2git config --global user.name "hc"
diff --git a/setup/git/tools/git-ssh-wrapper.sh b/setup/git/tools/git-ssh-wrapper.sh
deleted file mode 100755
index dc23334..0000000
--- a/setup/git/tools/git-ssh-wrapper.sh
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/bash
2ssh -v -A -o ForwardAgent=yes "$@"
diff --git a/setup/git/tools/usefulbutnotthatusefulidkwhattodo b/setup/git/tools/usefulbutnotthatusefulidkwhattodo
deleted file mode 100644
index e69de29..0000000
--- a/setup/git/tools/usefulbutnotthatusefulidkwhattodo
+++ /dev/null
diff --git a/setup/port-forward/persistent-ssh.sh b/setup/port-forward/persistent-ssh.sh
deleted file mode 100755
index 36d14dd..0000000
--- a/setup/port-forward/persistent-ssh.sh
+++ /dev/null
@@ -1,35 +0,0 @@
1#!/bin/bash
2
3echo "selinux command is untested. copy paste systemd file if you want"
4echo "reboot afterwards(selinux unset, need reboot to take effect, or just do sudo setenforce 0 for temp unset)"
5echo "make sure /root/m exists"
6echo "remember to change the remote port or host if needed"
7
8# disable selinux
9sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
10
11sudo cat << 'EOF' > /etc/systemd/system/ssh-tunnel.service
12[Unit]
13Description=Persistent SSH Tunnel
14After=network.target
15StartLimitIntervalSec=0
16
17[Service]
18Type=simple
19ExecStart=/usr/bin/ssh \
20 -i /root/m \
21 -o "ExitOnForwardFailure=yes" \
22 -o "StrictHostKeyChecking=no" \
23 -N -R 24:localhost:22 root@p.0nom.ch
24Restart=always
25RestartSec=10
26RemainAfterExit=no
27KillMode=process
28
29[Install]
30WantedBy=multi-user.target
31EOF
32
33sudo chmod 600 /root/m
34sudo systemctl daemon-reload
35sudo systemctl enable --now ssh-tunnel
diff --git a/setup/port-forward/rm_all_ssh_connections.sh b/setup/port-forward/rm_all_ssh_connections.sh
deleted file mode 100755
index f19300d..0000000
--- a/setup/port-forward/rm_all_ssh_connections.sh
+++ /dev/null
@@ -1,4 +0,0 @@
1#!/bin/bash
2ss -tnp | grep ':22'
3ps -ef | grep sshd | grep -v grep | awk '{if($3!=1) print $2}' | xargs kill
4#sudo systemctl restart sshd
diff --git a/setup/port-forward/ssh-multiport-forward.sh b/setup/port-forward/ssh-multiport-forward.sh
deleted file mode 100755
index 40d4ef6..0000000
--- a/setup/port-forward/ssh-multiport-forward.sh
+++ /dev/null
@@ -1,44 +0,0 @@
1#!/bin/bash
2# Check if at least one argument is provided
3if [ $# -lt 1 ]; then
4 echo "Usage: $0 <base_number> [additional_ports...]"
5 echo "Example: $0 5 80 443"
6 exit 1
7fi
8
9# First argument is the base number for port range
10j=$1
11shift # Remove first argument from the list, leaving only additional ports
12
13HOST="root@p.0nom.ch"
14
15# Clean management port
16echo "cleaning management port..."
17ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9"
18echo "cleaning attempted."
19
20# Build the SSH command with all port forwards
21SSH_CMD="ssh $HOST"
22
23# Add range-based port forwards (j000-j005)
24for i in $(seq ${j}000 ${j}005); do
25 SSH_CMD+=" -R $i:localhost:$i"
26done
27
28# Add management port forward
29SSH_CMD+=" -R ${j}022:localhost:22"
30
31# Add additional individual port forwards from remaining arguments
32for port in "$@"; do
33 SSH_CMD+=" -R $port:localhost:$port"
34done
35
36# Execute the SSH command
37eval $SSH_CMD
38
39echo "Port forwards are available on:"
40echo "- Ports ${j}000-${j}005"
41echo "- Management port ${j}022"
42if [ $# -gt 0 ]; then
43 echo "- Additional ports: $@"
44fi
diff --git a/setup/port-forward/ssh-port-forward.sh b/setup/port-forward/ssh-port-forward.sh
deleted file mode 100755
index c4cb0a8..0000000
--- a/setup/port-forward/ssh-port-forward.sh
+++ /dev/null
@@ -1,19 +0,0 @@
1#!/bin/bash
2
3# opens 5 ports
4
5#file will be run from where the user executes the script
6j=$1
7HOST="root@p.0nom.ch"
8
9# get the process holding the specified port and kill it
10echo "cleaning management port..."
11ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9"
12echo "cleaning attempted."
13
14ssh $HOST $(for i in $(seq ${j}000 ${j}005); do echo "-R $i:localhost:$i"; done; echo "-R ${j}022:localhost:22")
15
16echo "port forward is available on ports ${j}000-${j}005, ssh on ${j}022"
17
18#ideally port forward from 2 onwards, there seems to be a problem for 1000(or just change all to j001)
19#jupyter lab --port=2001 --ip=0.0.0.0
diff --git a/setup/setup.sh b/setup/setup.sh
deleted file mode 100755
index f0cf83b..0000000
--- a/setup/setup.sh
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/bash
2
3SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4cd "$SCRIPT_DIR" || exit
5
6# Shell appearance (only append if not already present)
7grep -q 'di=38;5;135' /etc/bashrc || sudo tee -a /etc/bashrc > /dev/null << 'EOF'
8LS_COLORS=$LS_COLORS:'di=38;5;135:ex=00;32:' ; export LS_COLORS
9PS1='[\[\033[01;32m\]\u\[\033[00m\]@\h \[\033[38;5;135m\]\W\[\033[00m\]]\$ '
10export TERM=xterm-256color
11EOF
12source /etc/bashrc
13
14# Timezone
15sudo timedatectl set-timezone Asia/Singapore
16
17# Core setup
18sudo bash ./core/ssh.sh || { echo "Failed to configure SSH"; exit 1; }
19sudo bash ./core/install-packages.sh || { echo "Failed to install packages"; exit 1; }
20sudo bash ./core/vim.sh || { echo "Failed to configure Vim"; exit 1; }
21sudo bash ./core/tmux.sh || { echo "Failed to configure Tmux"; exit 1; }