V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  rayae  ›  全部回复第 2 页 / 共 3 页
回复总数  55
1  2  3  
66 天前
回复了 MRG0 创建的主题 职场话题 突然发现上班这几年工作时长都不长
21 年毕业在现在这家公司,965 从未改变
86 天前
回复了 cowcomic 创建的主题 程序员 LLama3.1 的申请被拒了
一般申请国外的产品/服务我都是填 Hongkong 的
2 口 2.5 软路由,一大堆啊,什么 j1900,j4125,n100 小主机
87 天前
回复了 michaeljackson 创建的主题 分享发现 高效的笔记本散热方案
瓶盖足以
87 天前
回复了 kinboy 创建的主题 程序员 Powershell windows 端口转发
87 天前
回复了 kinboy 创建的主题 程序员 Powershell windows 端口转发
wsl2 自带的`localhostForwarding`和`networkingMode=mirrored`不香吗
分享一下我的:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return

MAIN_DEVICE=harvey

if test -f $HOME/.config/.dotfiles_main_device; then
MAIN_DEVICE=$HOSTNAME
fi

prompt_command() {
local last_ret=$?
history -a

# terminal tab title
local cwd="$PWD"
local title="${cwd/#$HOME/\~}"

if [ "$MAIN_DEVICE"x = "$HOSTNAME"x ] ; then
echo -n -e "\\e]0;$title\\007"
local HOST_FLAG=""
else
echo -n -e "\\e]0;$HOSTNAME > $title\\007"
local HOST_FLAG="${COLOR_YELLOW}\h${COLOR_NOCOLOR} "
fi


export COLOR_NOCOLOR='\[\e[0m\]'
export COLOR_RED='\[\e[0;31m\]'
export COLOR_GREEN='\[\e[0;32m\]'
export COLOR_ORANGE='\[\e[0;33m\]'
export COLOR_BLUE='\[\e[0;34m\]'
export COLOR_PURPLE='\[\e[0;35m\]'
export COLOR_CYAN='\[\e[0;36m\]'
export COLOR_WHITE='\[\e[0;37m\]'
export COLOR_YELLOW='\[\e[0;33m\]'
export COLOR_GRAY='\[\e[0;30m\]'
export COLOR_LIGHT_WHITE='\[\e[1;37m\]'
export COLOR_LIGHT_GRAY='\[\e[0;37m\]'
export COLOR_LIGHT_RED='\[\e[1;31m\]'
export COLOR_LIGHT_GREEN='\[\e[1;32m\]'
export COLOR_LIGHT_BLUE='\[\e[1;34m\]'
export COLOR_LIGHT_PURPLE='\[\e[1;35m\]'
export COLOR_LIGHT_CYAN='\[\e[1;36m\]'
export COLOR_LIGHT_YELLOW='\[\e[1;33m\]'
export COLOR_LIGHT_GRAY='\[\e[1;30m\]'

# PS1
case "$TERM" in
xterm*|gnome*|konsole*|screen*) color_prompt=yes;;
*) color_prompt=no;;
esac

if [ "$color_prompt" == no ]; then
for name in $(env|grep ^COLOR_|cut -d= -f1);do
unset ${name}
done
fi

if [ $UID = 0 ] ; then
local USER_FLAG="#"
else
local USER_FLAG="$"
fi

local SSH_IP=`echo $SSH_CLIENT | awk '{ print $1 }'`
local SSH2_IP=`echo $SSH2_CLIENT | awk '{ print $1 }'`
if [ $SSH2_IP ] || [ $SSH_IP ] ; then
local HOST_FLAG="${COLOR_RESET}${COLOR_LIGHT_YELLOW}\h${COLOR_NOCOLOR} "
fi

if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
local DEBIAN_CHROOT=$(cat /etc/debian_chroot)
fi

local GIT_BRANCH=''
if command -v git >/dev/null ; then
local GIT_BRANCH='$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s#* \(.*\)# ($(git config user.name) @ \1)#")'
fi

# last exit code
PS1=''
# chroot
PS1="${PS1}${COLOR_RESET}${DEBIAN_CHROOT}"
# show hostname if current not main device
PS1="${PS1}${HOST_FLAG}"
# current directory
PS1="${PS1}${COLOR_LIGHT_GRAY}[${COLOR_LIGHT_GREEN}\w${COLOR_NOCOLOR}${COLOR_LIGHT_GRAY}]"
# git repository info
PS1="${PS1}${COLOR_PURPLE}${GIT_BRANCH}${COLOR_NOCOLOR}"
# color by exit code
if [ $last_ret == 0 ] ; then
PS1="${PS1}${COLOR_LIGHT_WHITE} ${USER_FLAG}"
else
PS1="${PS1}${COLOR_LIGHT_RED} ($last_ret)${USER_FLAG}"
fi
# root/user flag
PS1="${PS1}${COLOR_NOCOLOR} "

export PS1
export PS2='> '
export PS3='#? '
export PS4='+'

for name in $(env|grep ^COLOR_|cut -d= -f1);do
unset ${name}
done
}

export HISTFILESIZE=10000
export HISTSIZE=10000
export HISTCONTROL=erasedups:ignoredups:ignorespace # Don't put duplicate lines in the history and do not add lines that start with a space
export HISTIGNORE="pwd:l:la:[bf]g:exit" # ignore such commands
export HISTTIMEFORMAT='%Y%m%d-%H:%M:%S '
export PROMPT_COMMAND='prompt_command'
export PROMPT_DIRTRIM=3


shopt -s cmdhist # combine multiline commands into single history
shopt -s histappend # append history
shopt -s checkwinsize # re-update LINEs and COLUMNs
shopt -s autocd
shopt -s extglob
shopt -s dotglob
shopt -s cdspell
shopt -s dirspell
shopt -s progcomp
shopt -s no_empty_cmd_completion

set -o noclobber

stty -ixon # replace Ctrl-S for forward-search-history


export EDITOR='vim'


# Use bash-completion, if available
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi


bind "set completion-ignore-case on" 2>/dev/null
bind "set bell-style none" 2>/dev/null
bind "set show-all-if-ambiguous on" 2>/dev/null
bind "set show-all-if-unmodified on" 2>/dev/null
# search history with arrow
bind '"\e[A": history-search-backward' 2>/dev/null
bind '"\e[B": history-search-forward' 2>/dev/null



# alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias cd..="cd .."


if command -v dircolors > /dev/null 2>&1; then
source <(dircolors)
fi
132 天前
回复了 zrc199021 创建的主题 Linux export PS1 不生效问题请教
试一下 unset PROMPT_COMMAND 再 export PS1
@june4 不是每个浏览器都会对网页 [安装到桌面] 的功能进行弹窗拦截提示,厂商当然默认对自家浏览器做默认的信任。并且现如今,会用非 OEM 提供的浏览器的人少之又少
你希望某些网站在你手机桌面上到处拉屎的感觉吗,我觉得默认禁用挺好的
@xinmans 那要不直接 rsync 吧
每个容器都 commit 一遍,导成 tar 去另一边导入
和装机助手小程序很像,但是实话实话是,我会选择小程序
高版本 jdk 反射要加 VM 参数
227 天前
回复了 bantoushui 创建的主题 职场话题 分享一下大家工作后的薪资变化
@silencil 工作量换的
227 天前
回复了 bantoushui 创建的主题 职场话题 分享一下大家工作后的薪资变化
5K ( 2021 ) -> 6.5K ( 2021 ) -> 17K ( 2022 ) -> 20K ( 2023 ) -> 22K ( 2024 )
236 天前
回复了 Elaina 创建的主题 硬件 关于 2 台电脑 3 块屏幕的快速切换问题
推荐用 https://github.com/debauchee/barrier 共享 mac 的键鼠给 windows 。延迟我开发时感觉不到,且能剪贴板共享。
用虚拟机,首先排除大小核,一坨翔,改调度提升也不明显。
301 天前
回复了 ayang23 创建的主题 分享发现 WSL 竟然可以执行 Linux 中的 GUI 程序
wsl 用到最后还是放弃了,不好用,最终选择了 debian
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5604 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 34ms · UTC 06:16 · PVG 14:16 · LAX 23:16 · JFK 02:16
Developed with CodeLauncher
♥ Do have faith in what you're doing.