Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ on:
push:
branches: [master]
paths:
- ".github/workflows"
- "home/**"
- "install/**"
- "tests/**"
- ".github/workflows/**"
- "home/**"
- "install/**"
- "tests/**"
pull_request:
branches: [master]
paths:
- ".github/workflows"
- "home/**"
- "install/**"
- "tests/**"
- ".github/workflows/**"
- "home/**"
- "install/**"
- "tests/**"

jobs:
test:
Expand Down Expand Up @@ -51,6 +51,11 @@ jobs:
exit 1
fi

- name: Run `shfmt`
uses: reviewdog/action-shfmt@v1
with:
shfmt_flags: -i 4 -sr -d

- name: Run unit test
run: |
./scripts/run_unit_test.sh
Expand Down
4 changes: 2 additions & 2 deletions home/dot_bash/server/bashrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ "$TERM" = "dumb" ]; then
echo -n
echo -n
else
command -v zsh > /dev/null && exec zsh
command -v zsh > /dev/null && exec zsh
fi
4 changes: 2 additions & 2 deletions home/dot_local/bin/client/executable_connect-hosei-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ readonly HOSEI_VPN_CREDENTIAL_JSON="${HOSEI_VPN_CREDENTIAL_JSON:-${HOME%/}/.conf
readonly HOSEI_VPN_HOST="vpn.hosei.ac.jp"

function get-username() {
jq <"${HOSEI_VPN_CREDENTIAL_JSON}" -r ".username"
jq < "${HOSEI_VPN_CREDENTIAL_JSON}" -r ".username"
}

function get-password() {
jq <"${HOSEI_VPN_CREDENTIAL_JSON}" -r ".password"
jq < "${HOSEI_VPN_CREDENTIAL_JSON}" -r ".password"
}

function connect-hosei-vpn() {
Expand Down
14 changes: 7 additions & 7 deletions home/dot_local/bin/common/executable_cdgwq
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash

function cdgwq() {
# git 内かどうかをチェック
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Not inside a git repository."
return 1
fi
moveto=$(gwq list --json | jq -r '.[].path' | fzf)
cd $moveto
# git 内かどうかをチェック
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
echo "Not inside a git repository."
return 1
fi
moveto=$(gwq list --json | jq -r '.[].path' | fzf)
cd $moveto
}

if [ -n "$($SHELL -c "echo ${ZSH_VERSION}")" ]; then
Expand Down
22 changes: 11 additions & 11 deletions home/dot_local/bin/common/executable_cdw
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

function cdw() {
# git 内かどうかをチェック
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Not inside a git repository."
return 1
fi
# git 内かどうかをチェック
if ! git rev-parse --is-inside-work-tree &> /dev/null; then
echo "Not inside a git repository."
return 1
fi

moveto=$(gwq list --json | jq -r 'max_by(.created_at) | .path')
if [ -z "$moveto" ]; then
echo "No recent gwq found."
return 1
fi
cd $moveto
moveto=$(gwq list --json | jq -r 'max_by(.created_at) | .path')
if [ -z "$moveto" ]; then
echo "No recent gwq found."
return 1
fi
cd $moveto
}

if [ -n "$($SHELL -c "echo ${ZSH_VERSION}")" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

function is_inside_git_repository() {
git rev-parse --is-inside-work-tree >/dev/null 2>&1
git rev-parse --is-inside-work-tree > /dev/null 2>&1
}

function get_default_branch() {
Expand Down
2 changes: 1 addition & 1 deletion home/dot_local/bin/server/history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function tac {

function share_history {
history -a
tac ~/.bash_history | awk '!a[$0]++' | tac >~/.bash_history.tmp
tac ~/.bash_history | awk '!a[$0]++' | tac > ~/.bash_history.tmp

[ -f ~/.bash_history.tmp ] &&
mv ~/.bash_history{.tmp,} &&
Expand Down
4 changes: 2 additions & 2 deletions home/dot_local/bin/server/ssh_agent.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

eval "$(ssh-agent)" >/dev/null 2>&1
ssh-add "${HOME}/.ssh/id_ed25519" >/dev/null 2>&1
eval "$(ssh-agent)" > /dev/null 2>&1
ssh-add "${HOME}/.ssh/id_ed25519" > /dev/null 2>&1
80 changes: 40 additions & 40 deletions home/dot_tmux-powerlinerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Default Theme

if patched_font_in_use; then
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD=""
TMUX_POWERLINE_SEPARATOR_LEFT_THIN=""
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD=""
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN=""
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD=""
TMUX_POWERLINE_SEPARATOR_LEFT_THIN=""
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD=""
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN=""
else
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯"
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯"
fi

TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR:-'235'}
Expand All @@ -23,38 +23,38 @@ TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SE
# Format: segment_name background_color foreground_color [non_default_separator]

if [ -z "${SSH_CONNECTION}" ]; then
if [ -z "${TMUX_POWERLINE_LEFT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"tmux_session_info 138 236"
"hostname 250 236"
"xkb_layout 59 111 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
"lan_ip 235 138 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
)
fi
if [ -z "${TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=(
"tmux_mem_cpu_load 236 138 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}"
"battery 138 236 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"date 250 236 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"time 138 236"
)
fi
if [ -z "${TMUX_POWERLINE_LEFT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"tmux_session_info 138 236"
"hostname 250 236"
"xkb_layout 59 111 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
"lan_ip 235 138 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
)
fi
if [ -z "${TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=(
"tmux_mem_cpu_load 236 138 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}"
"battery 138 236 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"date 250 236 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"time 138 236"
)
fi
else
if [ -z "${TMUX_POWERLINE_LEFT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"tmux_session_info 148 234"
"hostname 198 15"
"xkb_layout 59 111 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
"lan_ip 235 136 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}"
)
fi
if [ -z "${TMUX_POWERLINE_LEFT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"tmux_session_info 148 234"
"hostname 198 15"
"xkb_layout 59 111 ${TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}"
"lan_ip 235 136 ${TMUX_POWERLINE_SEPARATOR_RIGHT_THIN}"
)
fi

if [ -z "${TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=(
"tmux_mem_cpu_load 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}"
"battery 59 111 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"date 198 15 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"time 148 234"
)
fi
if [ -z "${TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS}" ]; then
TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=(
"tmux_mem_cpu_load 235 136 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}"
"battery 59 111 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"date 198 15 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}"
"time 148 234"
)
fi
fi
2 changes: 1 addition & 1 deletion install/common/age.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ "${DOTFILES_DEBUG:-}" ]; then
fi

function is_age_installed() {
command -v "age" &>/dev/null
command -v "age" &> /dev/null
}

function get_chezmoi_home_dir() {
Expand Down
4 changes: 1 addition & 3 deletions install/common/mise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function install_mise() {
# https://mise.run
local version="v2025.9.25"
local url="https://raw.githubusercontent.com/jdx/mise/refs/tags/${version}/packaging/standalone/install.envsubst"

export MISE_CURRENT_VERSION="${version}"
curl "${url}" | sh

Expand All @@ -30,5 +30,3 @@ function main() {
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main
fi


2 changes: 1 addition & 1 deletion install/common/tpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readonly TMUX_PLUGINS_DIR="${HOME%/}/.tmux/plugins"
readonly TPM_DIR="${TMUX_PLUGINS_DIR}/tpm"

function is_tmux_mem_cpu_load_installed() {
command -v "tmux-mem-cpu-load" &>/dev/null
command -v "tmux-mem-cpu-load" &> /dev/null
}

function clone_tpm() {
Expand Down
2 changes: 1 addition & 1 deletion install/macos/common/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ "${DOTFILES_DEBUG:-}" ]; then
fi

function is_homebrew_exists() {
command -v brew &>/dev/null
command -v brew &> /dev/null
}

function install_homebrew() {
Expand Down
2 changes: 1 addition & 1 deletion install/macos/common/mac_app_store.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ "${DOTFILES_DEBUG:-}" ]; then
fi

function is_mas_installed() {
common -v mas &>/dev/null
common -v mas &> /dev/null
}

function install_mas() {
Expand Down
2 changes: 1 addition & 1 deletion install/macos/common/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ readonly ADDITIONAL_CASK_PACKAGES=(
function is_brew_package_installed() {
local package="$1"

brew list "${package}" &>/dev/null
brew list "${package}" &> /dev/null
}

function install_brew_packages() {
Expand Down
4 changes: 2 additions & 2 deletions install/macos/common/tmux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ readonly PACKAGES=(
)

function install_tmux() {
# On GitHub Actions macOS instances, reinstalling CMake fails.
# On GitHub Actions macOS instances, reinstalling CMake fails.
# Implement the following workaround to avoid this issue.
# ref. [macOS] Pinned CMake causes some homebrew installs to fail · Issue #12912 · actions/runner-images https://github.com/actions/runner-images/issues/12912#issuecomment-3240845829
# ref. [macOS] Pinned CMake causes some homebrew installs to fail · Issue #12912 · actions/runner-images https://github.com/actions/runner-images/issues/12912#issuecomment-3240845829
for package in "${PACKAGES[@]}"; do
brew list "${package}" || brew install "${package}"
done
Expand Down
4 changes: 2 additions & 2 deletions install/ubuntu/client/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function uninstall_old_docker() {
"runc"
)
for package in "${packages[@]}"; do
if dpkg -s "${package}" >/dev/null 2>&1; then
if dpkg -s "${package}" > /dev/null 2>&1; then
sudo apt-get remove -y "${package}"
fi
done
Expand All @@ -45,7 +45,7 @@ function setup_repository() {
# Use the following command to set up the repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
}

function install_docker_engine() {
Expand Down
4 changes: 2 additions & 2 deletions install/ubuntu/common/kcov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function install_kcov() {

local tmp_dir
tmp_dir=$(mktemp -d /tmp/kcov-XXXXX)

local kcov_version="v43"
git clone "${url}" "${tmp_dir}" -b "${kcov_version}" --depth 1
git clone "${url}" "${tmp_dir}" -b "${kcov_version}" --depth 1

cd "${tmp_dir}" || exit 1
mkdir build && cd build || exit 1
Expand Down
16 changes: 8 additions & 8 deletions install/ubuntu/server/ssh_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ set -Eeuo pipefail
if [ "${DOTFILES_DEBUG:-}" ]; then
set -x
fi

function install_openssh_server() {
# install openssh-server and vim
sudo apt-get update && sudo apt-get install --no-install-recommends -y \
vim \
openssh-server
}

function setup_sshd() {
sudo mkdir -p /var/run/sshd
mkdir -p ${HOME}/.ssh

sudo sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config &&
sudo sed -i 's/^#Port 22/Port 22/' /etc/ssh/sshd_config &&
sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' /etc/ssh/sshd_config &&
sudo sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

# check the /etc/ssh/sshd_config
sudo /usr/sbin/sshd -t

# create .ssh/authorized_keys if not exists
touch ${HOME}/.ssh/authorized_keys
}

function run_sshd() {
# run sshd
sudo /usr/sbin/service ssh start
}

function main() {
install_openssh_server
setup_sshd
Expand All @@ -45,4 +45,4 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
if [ -f "/.dockerenv" ]; then
main
fi
fi
fi
2 changes: 1 addition & 1 deletion scripts/run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function record_startup_time() {
# shellcheck disable=SC2086
average_startup_time=$(cat ${average_file} | awk '{ total += $1 } END { print total/NR }')

cat <<EOJ
cat << EOJ
[
{
"name": "zsh average startup time",
Expand Down
Loading