From 5715fd5577966c27e0fedb67d2beb745b848dbfe Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Tue, 11 Nov 2025 16:25:03 +0100 Subject: [PATCH] periodic check-in --- .config/karabiner/karabiner.json | 171 +++++++++++++++++++- .config/mc/ini | 2 +- .gitconfig | 2 + .p10k.zsh | 6 +- .spacemacs | 25 ++- .ssh/config.solaris | 17 +- .ssh/scm-script.sh | 267 +++++++++++++++++++++++++++++++ .tridactylrc | 5 + .zshenv | 1 + .zshrc | 2 +- bin/proxy | 8 + bin/ul11u4_gate_open.sh | 2 +- 12 files changed, 498 insertions(+), 10 deletions(-) create mode 100755 .ssh/scm-script.sh diff --git a/.config/karabiner/karabiner.json b/.config/karabiner/karabiner.json index a6d29b2..4a57d81 100644 --- a/.config/karabiner/karabiner.json +++ b/.config/karabiner/karabiner.json @@ -68,6 +68,171 @@ } ] }, + { + "description": "Hyper Deletion", + "manipulators": [ + { + "description": "option + n = delete whole line", + "from": { + "key_code": "n", + "modifiers": { "mandatory": ["left_option", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["left_command"] + } + ], + "type": "basic" + }, + { + "description": "option + m = move line down", + "from": { + "key_code": "m", + "modifiers": { "mandatory": ["left_option", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "down_arrow", + "modifiers": ["left_option", "left_shift"] + } + ], + "type": "basic" + }, + { + "description": "option + , = move line up", + "from": { + "key_code": "comma", + "modifiers": { "mandatory": ["left_option", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "up_arrow", + "modifiers": ["left_option", "left_shift"] + } + ], + "type": "basic" + }, + { + "description": "option + . = delete whole line", + "from": { + "key_code": "period", + "modifiers": { "mandatory": ["left_option", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["left_command"] + } + ], + "type": "basic" + }, + { + "description": "command + n = delete whole line", + "from": { + "key_code": "n", + "modifiers": { "mandatory": ["left_command", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": ["left_shift", "left_command"] + }, + { "key_code": "delete_or_backspace" } + ], + "type": "basic" + }, + { + "description": "command + m = delete word ahead", + "from": { + "key_code": "m", + "modifiers": { "mandatory": ["left_command", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["left_option"] + } + ], + "type": "basic" + }, + { + "description": "command + , = delete word after", + "from": { + "key_code": "comma", + "modifiers": { "mandatory": ["left_command", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_forward", + "modifiers": ["left_option"] + } + ], + "type": "basic" + }, + { + "description": "command + . = delete whole line", + "from": { + "key_code": "period", + "modifiers": { "mandatory": ["left_command", "right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "right_arrow", + "modifiers": ["left_shift", "left_command"] + }, + { "key_code": "delete_or_backspace" } + ], + "type": "basic" + }, + { + "description": "n = delete a word ahead", + "from": { + "key_code": "n", + "modifiers": { "mandatory": ["right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["left_option"] + } + ], + "type": "basic" + }, + { + "description": "m = delete a char ahead", + "from": { + "key_code": "m", + "modifiers": { "mandatory": ["right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [{ "key_code": "delete_or_backspace" }], + "type": "basic" + }, + { + "description": ", = delete a char after", + "from": { + "key_code": "comma", + "modifiers": { "mandatory": ["right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [{ "key_code": "delete_forward" }], + "type": "basic" + }, + { + "description": ". = delete a word after", + "from": { + "key_code": "period", + "modifiers": { "mandatory": ["right_command", "right_control", "right_shift", "right_option"] } + }, + "to": [ + { + "key_code": "delete_forward", + "modifiers": ["left_option"] + } + ], + "type": "basic" + } + ] + }, { "description": "Hyper Navigation", "manipulators": [ @@ -2346,6 +2511,10 @@ "selected": true, "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } }, - { "name": "test profile" } + { "name": "test profile" }, + { + "name": "New profile", + "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } + } ] } \ No newline at end of file diff --git a/.config/mc/ini b/.config/mc/ini index 6d0c3de..cca508b 100644 --- a/.config/mc/ini +++ b/.config/mc/ini @@ -89,7 +89,7 @@ filepos_max_saved_entries=1024 [Layout] output_lines=0 -left_panel_size=110 +left_panel_size=86 top_panel_size=0 message_visible=true keybar_visible=true diff --git a/.gitconfig b/.gitconfig index f826b6a..ec81ba2 100644 --- a/.gitconfig +++ b/.gitconfig @@ -47,3 +47,5 @@ autoupdate = true ; [color] ; ui = auto +[http] + sslVerify = false diff --git a/.p10k.zsh b/.p10k.zsh index 1391221..f3ef129 100644 --- a/.p10k.zsh +++ b/.p10k.zsh @@ -110,7 +110,7 @@ # ip # ip address and bandwidth usage for a specified network interface # public_ip # public IP address proxy # system-wide http/https/ftp proxy - # battery # internal battery + battery # internal battery # wifi # wifi speed # example # example user-defined segment (see prompt_example function below) ) @@ -553,7 +553,7 @@ #######################[ background_jobs: presence of background jobs ]####################### # Don't show the number of background jobs. - typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false + typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true # Background jobs color. typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70 # Custom icon. @@ -1536,7 +1536,7 @@ # Battery pictograms going from low to high level of charge. typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578' # Don't show the remaining time to charge/discharge. - typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false + typeset -g POWERLEVEL9K_BATTERY_VERBOSE=true #####################################[ wifi: wifi speed ]##################################### # WiFi color. diff --git a/.spacemacs b/.spacemacs index 6552fc8..16361e1 100644 --- a/.spacemacs +++ b/.spacemacs @@ -33,6 +33,7 @@ This function should only modify configuration layer settings." ;; List of configuration layers to load. dotspacemacs-configuration-layers '(swift + multiple-cursors ;; https://www.spacemacs.org/layers/+misc/multiple-cursors/README.html#key-bindings shell yaml themes-megapack @@ -682,6 +683,18 @@ before packages are loaded." (global-set-key (kbd " s") 'jp/set-dotfiles-environment) (global-set-key (kbd " u") 'jp/unset-dotfiles-environment) + (defun jp/set-scm-git() + (interactive) + (setq magit-git-executable "/usr/local/bin/scm-git")) + + ;; for scm-git + (defun jp/unset-scm-git() + (interactive) + (setq magit-git-executable "/usr/bin/git")) + + (global-set-key (kbd " 1") 'jp/set-scm-git) + (global-set-key (kbd " 2") 'jp/unset-scm-git) + (defun magit-status-dotfiles () "Open Magit with the dotfiles Git configuration." @@ -785,7 +798,7 @@ before packages are loaded." (setq org-refile-targets '(("/Users/jetpac/Documents/org/projects.org" :maxlevel . 3) ("/Users/jetpac/Documents/org/inbox.org" :maxlevel . 3) - ("/Users/jetpac/Documents/org/work/oracle.org" :maxlevel . 3) + ("/Users/jetpac/Documents/org/work/oracle.org" :maxlevel . 4) ("/Users/jetpac/Documents/org/someday.org" :maxlevel . 3) ("/Users/jetpac/Documents/org/inbox.org" :maxlevel . 3) ("/Users/jetpac/Documents/org/calendar.org" :maxlevel . 2))) @@ -934,8 +947,18 @@ before packages are loaded." (global-set-key (kbd " i") 'bh/punch-in) (global-set-key (kbd " o") 'bh/punch-out) + (global-set-key (kbd " h") 'bh/hide-other) (global-set-key (kbd "") 'org-clock-goto) + (defun bh/hide-other () + (interactive) + (save-excursion + (org-back-to-heading 'invisible-ok) + (hide-other) + (org-cycle) + (org-cycle) + (org-cycle))) + ;; Resume clocking task when emacs is restarted (org-clock-persistence-insinuate) ;; Save the running clock and all clock history when exiting Emacs, load it on startup diff --git a/.ssh/config.solaris b/.ssh/config.solaris index 8fe8507..2a10d84 100644 --- a/.ssh/config.solaris +++ b/.ssh/config.solaris @@ -1,3 +1,6 @@ +# Include config-scm + + Host * # UseKeychain yes AddKeysToAgent yes @@ -15,6 +18,11 @@ Host * Host 192.168.2.* IdentitiesOnly yes +Host osd-fra + User desktopuser + HostName 100.109.60.126 + IdentityFile ~/.ssh/id_ed25519 + Host gitlab.com User git IdentityFile ~/.ssh/gitlab @@ -30,6 +38,12 @@ Host hetzner IdentityFile ~/.ssh/id_hetzner +# for SCM +Host oci.private.devops.scmservice.us-phoenix-1.oci.oracleiaas.com + PKCS11Provider /Library/OpenSC/lib/opensc-pkcs11.so + User pnyc@bmc_operator_access + + Host pnyc-ws pnyc-ws.webad1phx.solarisx86phx.oraclevcn.com HostName pnyc-ws.webad1phx.solarisx86phx.oraclevcn.com User opc @@ -76,7 +90,7 @@ Host www.jetpac.org User jetpac -Host dabel dabel.us.oracle.com +Host dabel dabel.us.oracle.com andel andel.us.oracle.com gates gates.us.oracle.com User pnyc IdentityFile ~/.ssh/dabel.key RequestTTY yes @@ -154,4 +168,3 @@ Include ossh_configs/*.ossh Include ssh_configs/config Include osd_configs/config - diff --git a/.ssh/scm-script.sh b/.ssh/scm-script.sh new file mode 100755 index 0000000..78d66b3 --- /dev/null +++ b/.ssh/scm-script.sh @@ -0,0 +1,267 @@ +#!/bin/bash +export SSH_SCM_AUTH_SOCK="$HOME/.ssh/scm-agent.sock" +SCRIPT_VERSION=1 + +# Starts the custom SSH agent. +start_scm_ssh_agent() { + # Check if the socket file exists + if [ -S "$SSH_SCM_AUTH_SOCK" ]; then + # If the socket exists, check if the SSH agent process is running + AGENT_PID=$(ps aux | grep $SSH_SCM_AUTH_SOCK | grep -v grep | head -1 | awk '{print $2}') + + # If no associated process is found or the agent isn't running, start a new SSH agent + if [ -z "$AGENT_PID" ]; then + echo "Socket exists but no running agent, starting new SSH agent..." + rm $SSH_SCM_AUTH_SOCK + eval $(ssh-agent -a "$SSH_SCM_AUTH_SOCK") + else + # If the agent is already running, use the existing one + echo "SSH agent already running with PID: $AGENT_PID, using existing agent." + fi + else + # If the socket doesn't exist, start a new SSH agent + echo "Socket doesn't exist, starting new SCM SSH agent..." + ssh-agent -a "$SSH_SCM_AUTH_SOCK" + fi +} + +# Stops the custom SSH agent. +stop_scm_ssh_agent() { + # Check if the socket file exists + if [ -S "$SSH_SCM_AUTH_SOCK" ]; then + # If the socket exists, check if the SSH agent process is running + AGENT_PID=$(ps aux | grep $SSH_SCM_AUTH_SOCK | grep -v grep | head -1 | awk '{print $2}') + + # If no associated process is found or the agent isn't running, start a new SSH agent + if [ -z "$AGENT_PID" ]; then + echo "Socket exists but no running agent, removing the socket..." + rm $SSH_SCM_AUTH_SOCK + else + # If the agent is already running, use the existing one + echo "Killing SSH agent running with PID: $AGENT_PID ..." + SSH_AGENT_PID=$AGENT_PID ssh-agent -k + fi + else + # If the socket doesn't exist, start a new SSH agent + echo "Socket doesn't exist, nothing to do to stop SSH agent." + fi +} + +ssh_add() { + ssh_reset +} + +ssh_reset() { + echo "Clearing and reloading the card..." + local providers=("/usr/local/lib/libykcs11.dylib" "/usr/lib64/opensc-pkcs11.so" "/usr/local/lib/opensc-pkcs11.so") + + if [[ -S "$SSH_SCM_AUTH_SOCK" ]]; then + SSH_AUTH_SOCK="$SSH_SCM_AUTH_SOCK" ssh-add -D + + local provider_path="$1" + if [[ -z "$provider_path" ]]; then + for path in "${providers[@]}"; do + if [[ -e "$path" ]]; then + echo "Using provider '${provider_path}'" + SSH_AUTH_SOCK="$SSH_SCM_AUTH_SOCK" ssh-add -e "$path" + SSH_AUTH_SOCK="$SSH_SCM_AUTH_SOCK" ssh-add -s "$path" + return + fi + done + elif [[ -e "$provider_path" ]]; then + SSH_AUTH_SOCK="$SSH_SCM_AUTH_SOCK" ssh-add -e "$provider_path" + SSH_AUTH_SOCK="$SSH_SCM_AUTH_SOCK" ssh-add -s "$provider_path" + else + echo "Invalid provider path: $provider_path" + return 1 + fi + else + read -p "SSH agent socket not found at $sock_path. Continue with default SSH Agent (without SSH_AUTH_SOCK) or you may run 'start_agent' command to setup one? (y/n): " confirm + if [[ "$confirm" != "y" ]]; then + echo "Aborted." + return 1 + fi + + ssh-add -D + + local provider_path="$1" + if [[ -z "$provider_path" ]]; then + for path in "${providers[@]}"; do + if [[ -e "$path" ]]; then + ssh-add -e "$path" + ssh-add -s "$path" + return + fi + done + elif [[ -e "$provider_path" ]]; then + ssh-add -e "$provider_path" + ssh-add -s "$provider_path" + else + echo "Invalid provider path: $provider_path" + return 1 + fi + fi +} + +install() { + local script_path="$HOME/.ssh/scm-script.sh" + mkdir -p "$HOME/.ssh" + chmod 700 $HOME/.ssh + cp "$0" "$script_path" + chmod +x "$script_path" + + + if [ "$(uname)" == "Darwin" ]; then + install_yubico_piv_tool_mac + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + install_yubico_piv_tool_linux + else + echo "Unsupported OS" + return 1 + fi + + + local profile_file + if [[ $SHELL == "/bin/bash" ]]; then + profile_file="$HOME/.bashrc" + else + profile_file="$HOME/.zshrc" + fi + + if ! grep -q "Include config-scm" "$HOME/.ssh/config"; then + +cat <<< "Include config-scm +$(cat $HOME/.ssh/config) +" > $HOME/.ssh/config + +cat > $HOME/.ssh/config-scm << EOF +Host oci*.private.devops.scmservice.*.oci.oracleiaas.com + User $(whoami)@bmc_operator_access + IdentityAgent $HOME/.ssh/scm-agent.sock +EOF + fi + + if ! grep -q "alias scm-ssh='$script_path'" "$profile_file"; then + echo "" >> "$profile_file" + echo "" >> "$profile_file" + echo "alias scm-ssh='$script_path'" >> "$profile_file" + echo "scm-ssh start_agent" >> "$profile_file" + fi + + + echo "SCM script installed successfully. Please restart your terminal or run 'source $profile_file' to apply changes." +} + +install_yubico_piv_tool_linux() { + local providers=("/usr/local/lib/libykcs11.dylib" "/usr/lib64/opensc-pkcs11.so" "/usr/local/lib/opensc-pkcs11.so") + + for path in "${providers[@]}"; do + if [[ -e "$path" ]]; then + return + fi + done + + echo "Automatic install not supported. Please install OpenSC or Yubico PIV Tool manually." +} + +install_yubico_piv_tool_mac() { + local url="https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-latest-mac-universal.pkg" + local pkg_file="/tmp/yubico-piv-tool-latest-mac-universal.pkg" + local lib_path="/usr/local/lib/libykcs11.dylib" + + if [[ -f $lib_path ]]; then + echo "Yubico PIV tool is already installed at $lib_path. Skipping..." + return 0 + fi + + + echo "Downloading Yubico PIV Tool..." + curl -L "$url" -o "$pkg_file" + + if [[ ! -f "$pkg_file" ]]; then + echo "Download failed!" + return 1 + fi + + + + echo "Installing Yubico PIV Tool... (sudo password might be required)" + + if sudo installer -pkg "$pkg_file" -target /; then + echo "Installation of Yubico PIV Tool complete" + else + echo "Install failed" + return 1 + fi + + # Cleanup + rm "$pkg_file" + + echo "Verifying installation..." + + if [[ -f "$lib_path" ]]; then + echo "Library $lib_path is present!" + else + echo "Library $lib_path is missing! Installation might be incomplete." + return 1 + fi +} + +scm_script_help() { + echo "Usage: $0 [args...]" + echo "---------------------------" + echo "Commands:" + echo " start_agent - Starts the SCM ssh agent." + echo " stop_agent - Stops the SCM ssh agent." + echo " ssh_reset - Clears and reload the Yubikey to the agent." + echo " ssh_add - Alias to ssh_reset." + echo " install - Installs scm command by copying script to ~/.ssh/scm-script.sh and adding alias to the profile." + echo " install_yubico_piv_tool - Download and install Yubikey PIV tool" + echo " help - Displays this help message." + echo "---------------------------" + echo "Completed execution of SCM Script v${SCRIPT_VERSION}." +} + +# Prevent execution when sourced in both bash and zsh +if [[ -n "$ZSH_VERSION" ]]; then + return # For zsh +elif [[ -n "$BASH_VERSION" && "${BASH_SOURCE[0]}" != "$0" ]]; then + return # For bash +fi + +# Check if at least one argument is provided +if [ "$#" -lt 1 ]; then + scm_script_help + exit 1 +fi + +# Extract the command +COMMAND="$1" +shift # Remove the first argument + +# Execute the corresponding function +case "$COMMAND" in + start_agent) + start_scm_ssh_agent "$@" + ;; + stop_agent) + stop_scm_ssh_agent "$@" + ;; + ssh_reset) + ssh_reset "$@" + ;; + ssh_add) + ssh_add "$@" + ;; + install) + install "$@" + ;; + install_yubico_piv_tool) + install_yubico_piv_tool "$@" + ;; + *) + echo "Invalid command. Use help." + exit 1 + ;; +esac +echo "Completed execution of SCM Script v${SCRIPT_VERSION}." diff --git a/.tridactylrc b/.tridactylrc index f7af511..23f4ac9 100644 --- a/.tridactylrc +++ b/.tridactylrc @@ -8,8 +8,13 @@ set configversion 2.0 set editorcmd '/opt/homebrew/bin/emacsclient' set smoothscroll true +" pentadactyl-style tab switching +bind J tabnext +bind K tabprev blacklistadd https://www.youtube.com/ +blacklistadd https://login.us-phoenix-1.idp.mc1.oracleiaas.com/ +blacklistadd https://jellyfin.cloud.jetpac.org " blacklistadd https://grt.us.oracle.com " auto-contain diff --git a/.zshenv b/.zshenv index e4152f1..ba6b98e 100644 --- a/.zshenv +++ b/.zshenv @@ -138,3 +138,4 @@ if [[ -n ${commands[kubectl]} ]]; then } fi +alias scm-ssh='/Users/jetpac/.ssh/scm-script.sh' diff --git a/.zshrc b/.zshrc index d792697..37a5ea1 100644 --- a/.zshrc +++ b/.zshrc @@ -115,7 +115,7 @@ COMPLETION_WAITING_DOTS="true" # Add wisely, as too many plugins slow down shell startup. plugins=(colorize colored-man-pages vi-mode common-aliases themes dircycle iterm2 zsh-navigation-tools urltools history zsh-syntax-highlighting zsh-autosuggestions web-search aliases) -cmd_plugins=(rsync tmux docker docker-compose tmux kubectl helm terraform asdf brew emacs fzf asdf brew emacs) +cmd_plugins=(git rsync conda tmux docker docker-compose tmux kubectl helm terraform asdf brew emacs fzf asdf brew emacs) # Add a plugin only if its command exists add_plugin_if_command_exists() { diff --git a/bin/proxy b/bin/proxy index 3dc1cc4..6756278 100755 --- a/bin/proxy +++ b/bin/proxy @@ -3,6 +3,14 @@ # when the first positional command line parameter is 'on' # and unsets them when the first positional command line parameter is 'off' # +# proxy locations are documented at: +# https://confluence.oraclecorp.com/confluence/pages/viewpage.action?spaceKey=CORPNET&title=Corporate+Proxy+Environment +# +# this will get the first defined proxy from the PAC file: +# WPAD=http://wpad.oraclecorp.com/wpad.dat +# L_PROXY=$(curl -s "$WPAD" | \ +# grep 'proxies =' | sed -n 's/^[^"]*"\(.*\)".*/\1/p' | \ +# tr ';' '\n' | grep 'PROXY' | head -1 | sed 's/PROXY //') # # usage: # source proxy off diff --git a/bin/ul11u4_gate_open.sh b/bin/ul11u4_gate_open.sh index 6fada54..949fd2c 100755 --- a/bin/ul11u4_gate_open.sh +++ b/bin/ul11u4_gate_open.sh @@ -13,7 +13,7 @@ CURL=/usr/bin/curl source "${BINDIR}/lib/logging.sh" -TARGET="${1-11.4.86.0.1.201.1}" +TARGET="${1-11.4.87.0.1.207.1}" log::info "TARGET:${TARGET}"