首页 > 其他分享 >【自用】常用配置记录

【自用】常用配置记录

时间:2023-08-16 17:01:51浏览次数:39  
标签:常用 git 记录 etc 自用 printf export PS1 com

Python

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Go

export GOPROXY="https://goproxy.cn/"
export GOROOT=""

Nodejs

换源

npm set registry http://registry.npmmirror.com

修改npm全局安装位置

export NPM_HOME=""
export PNPM_HOME=""

Java

环境变量

export JAVA_HOME=""

Maven换源

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

Docker

sudo vim /etc/docker/daemon.json

{
    "registry-mirrors": [
        "https://registry.hub.docker.com",
        "http://hub-mirror.c.163.com",
        "https://registry.docker-cn.com"
    ]
}

sudo systemctl restart docker

Git

配置

git config --global user.name "Brevin"
git config --global user.email "[email protected]"
git config --global core.editor "vim"
git config --global init.defaultBranch "main"

源码

https://mirrors.edge.kernel.org/pub/software/scm/git/

终端补全,显示git分支

参考 “Linux初始化脚本”中的git部分与bash_profile部分

各Linux发行版更改软件源

fedora

终端执行

sudo sed -e 's|^metalink=|#metalink=|g' \
         -e 's|^#baseurl=http://download.example/pub/fedora/linux|baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora|g' \
         -i.bak \
         /etc/yum.repos.d/fedora.repo \
         /etc/yum.repos.d/fedora-modular.repo \
         /etc/yum.repos.d/fedora-updates.repo \
         /etc/yum.repos.d/fedora-updates-modular.repo

alpine

终端执行

sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

ubuntu

按网页内容操作

# x86
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
# arm
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu-ports/

Jetbrains Mono字体

https://www.jetbrains.com/lp/mono/

Linux初始化脚本

适用与aarch64架构的openEuler操作系统,其他系统没有测试过。
github镜像如果失效,需要修改成可用镜像

#! /usr/bin/env bash

#[ "${USER}" != "root" ] 可能没有USER变量
if [ "$(id)" != "$(id root)" ];then
  echo "Please execute with root"
  exit 0
fi

# -------------------- 基础环境配置 --------------------
# 下面需要用到的命令可能没有
dnf install -y passwd iproute tar xz wget findutils python3 python3-pip
# 安装运行环境和常用软件
dnf install -y gcc g++ make cmake go git vim tmux


github_mirror='gitclone.com/github.com'
raw_github_mirror='raw.kgithub.com'

git_name='Brevin'
git_email='[email protected]'

root_password='brevin'

pip_mirror='https://pypi.tuna.tsinghua.edu.cn/simple'

arch=$(arch)


# -------------------- 开始 --------------------
passwd --stdin root <<< "${root_password}"

# 更新除内核外的所有软件
dnf list --upgrades | tail -n +3 | awk '{print $1}' | grep -v 'kernel' \
| xargs -n 10 dnf upgrade -y


# -------------------- Python --------------------
/usr/bin/pip config set global.index-url "${pip_mirror}"

# -------------------- ShellCheck --------------------
wget -O shellcheck.tar.xz "https://${github_mirror}/koalaman/shellcheck/releases/download/v0.9.0/shellcheck-v0.9.0.linux.${arch}.tar.xz" \
&& tar -Jxf shellcheck.tar.xz \
&& mv shellcheck-v0.9.0/shellcheck /usr/local/bin/ \
&& rm -rf shellcheck.tar.xz shellcheck-v0.9.0


# -------------------- Git --------------------
git config --global user.name "${git_name}"
git config --global user.email "${git_email}"
git config --global core.editor "vim"
git config --global init.defaultBranch "main"

wget -O /etc/bash_completion.d/git-completion.bash \
https://${raw_github_mirror}/git/git/master/contrib/completion/git-completion.bash
wget -O /etc/bash_completion.d/git-prompt.sh \
https://${raw_github_mirror}/git/git/master/contrib/completion/git-prompt.sh

# -------------------- Vim --------------------
git clone --depth=1 https://${github_mirror}/amix/vimrc.git ~/.vim_runtime && \
sh ~/.vim_runtime/install_awesome_vimrc.sh && \
echo "set nu" >> ~/.vim_runtime/my_configs.vim && \
echo "set visualbell" >> ~/.vim_runtime/my_configs.vim

# -------------------- inputrc --------------------
echo "set enable-bracketed-paste off" >> /etc/inputrc
echo "set bell-style none" >> /etc/inputrc

# -------------------- bash_profile --------------------
{
  printf 'PS1_GREEN="%s"\n' "\\[\\e[0;32m\\]"
  printf 'PS1_BLUE="%s"\n' "\\[\\e[0;34m\\]"
  printf 'GIT_COLOR="%s"\n' "\\[\\e[0;35m\\]"
  printf 'PS1_RESET="%s"\n' "\\[\\e[0m\\]"

  if [ -f /etc/bash_completion.d/git-prompt.sh ]; then
    printf '. /etc/bash_completion.d/git-completion.bash\n'
    printf '. /etc/bash_completion.d/git-prompt.sh\n'
    printf 'export GIT_PS1_SHOWDIRTYSTATE=1\n'
    printf 'export GIT_PS1_SHOWSTASHSTATE=1\n'
    printf 'export GIT_PS1_SHOWUNTRACKEDFILES=1\n'
    printf 'export GIT_PS1_SHOWUPSTREAM="auto"\n'
    echo "export PS1='\\[\\e[0;32m\\]\\u@\\h\\[\\e[0m\\]:\\[\\e[0;34m\\]\\w\\[\\e[0;35m\\]\$(__git_ps1 \" (%s)\") \\[\\e[0m\\]'"
  else
    printf 'export PS1="${PS1_GREEN}\\u@\\h${PS1_RESET}:${PS1_BLUE}\\w ${PS1_RESET}"\n'
  fi

  printf '\n'
  printf 'unset PS1_GREEN\n'
  printf 'unset PS1_BLUE\n'
  printf 'unset GIT_COLOR\n'
  printf 'unset PS1_RESET\n'
  printf 'export EDITOR="/usr/bin/vim"\n'
} >> /etc/profile.d/custom.sh


dnf autoremove -y
reboot

标签:常用,git,记录,etc,自用,printf,export,PS1,com
From: https://www.cnblogs.com/brevin/p/17635581.html

相关文章

  • 记录一个解决方法- 使用editableProTable表头筛选,无法重置,位置偏移
    问题如图:切换原始告警和收敛告警以后,由于二者用到同一个table,切换之后再点击筛选条件,则筛选框的位置发生偏移解决办法:给table一个key属性,改变table中的数据或者列时,去改变这个唯一的key,key值改变,table就可以重新渲染了!......
  • 常用浏览器重要启动参数和配置参数整理
    IE的常用启动参数1、-nohome双击此快捷方式则只打开一个空白IE窗口,可以加快IE启动速度,同时如果IE主页被恶意修改了,利用此法就不会自动打开恶意主页。2、-k-k参数可以让IE工作在全屏方式下。3、-v-v参数会显示出IE当前的版本(Unix平台上适用)。Firefox的常用启动......
  • 记录 centos firewall 引起ipv6隧道失效的故障排查
    由于宝塔会在centos7默认开启firewall 首先ipv6是由v4隧道中转过来的:ipaddrshowsit15:sit1@NONE:<POINTOPOINT,NOARP,UP,LOWER_UP>mtu1480qdiscnoqueuestateUNKNOWNgroupdefaultqlen1000link/sit0.0.0.0peer99.99.104.74inet62001:232:232:232::2/64......
  • 常用文件读取(python)
    CSV文件CSV(Comma-SeparatedValues)是一种常见的文本文件格式,用于存储结构化的数据。CSV文件中的数据是以逗号(或其他指定的分隔符)分隔的文本行,每一行表示一条记录,每个字段表示记录中的一个属性或值。读CSVimportcsvimportcodecsfile_name=""withopen(file_name,"r",en......
  • openssl 常用命令
    openssl是目前最流行的SSL密码库工具,其提供了一个通用、健壮、功能完备的工具套件,用以支持SSL(Secure Sockets Layer)/TLS(Transport Layer Security)协议的实现官网:https://www.openssl.org/source/#生成RSA私钥(无加密)opensslgenrsa2048>rsa_private.key......
  • Linux常用命令
    1.目录进入目录:cdxxx返回当前用户的根目录: cd返回上一级目录:cd..进入当前目录的xxx目录:cd./xxx2.用户切换用户:su 用户名新增用户:useradd-g 用户组:用户新增用户组:groupadd用户组添加用户密码:passwd 用户查看所有用户:vim/etc/passwd查看所有用户组:vim/etc......
  • CF 记录
    CF1858BTheWalkway降智题,但是这种题放B着实有点恶心考虑每两个相邻点对\(x\),\(y\)对于答案的贡献,显然是\(\frac{s_y-s_x-1}{d}\)然后每次枚举删除的点\(i\),减去\((i-1,i)\),\((i+1,i)\)的贡献,再加上\((i-1,i+1)\)的贡献就是可能的答案但是实现的时候细节很多,主要是两个端点......
  • 数据结构口胡记录
    数据结构口胡记录114514天没写博客了(悲)BearandBadPowersof42\(tag\):线段树,势能分析原问题不好直接做,考虑转化维护信息首先可以发现42的幂次并不多,所以每次操作3到停止的次数并不多,因此可以用线段树多次打区间加标记。问题转化为看一个区间内是否存在42的倍数,因为区间......
  • ARC 做题记录
    又来开新坑了建议改为ATC看题解记录[ARC103F]DistanceSums\(tag\):构造,树的性质sol\(remark\):构造题多考虑题目中隐式给出的已知量,如本题的重心,树的构造题中从儿子向上,由变化量得到父亲信息是很重要的思想。[ARC102F]RevengeofBBuBBBlesort!\(tag\):构造,逆序对,结论sol......
  • dp递推 口胡记录
    dp/递推口胡记录[SHOI2013]超级跳马\(tag\):矩阵乘法,前缀和暴力\(dp\)很显然,设\(f_{i,j}\)为从\((1,1)\)跳到\((i,j)\)的方案数,那么有$f_{i,j}=\sum\limits_{j-(2k+1)>0}f_{i/i+1/i-1,j-(2k+1)}$发现这个东西其实是一直由前面奇偶性相同的一段转移过来的,因此考虑前缀和......