Skip to content

Instantly share code, notes, and snippets.

@leizhnxp
Last active February 19, 2021 02:29
Show Gist options
  • Select an option

  • Save leizhnxp/5d8a8f44c29bfc24199827f2d9b895ba to your computer and use it in GitHub Desktop.

Select an option

Save leizhnxp/5d8a8f44c29bfc24199827f2d9b895ba to your computer and use it in GitHub Desktop.
my-env-provision
  • public key
  • proxy shell
  • init components

public key

# using git bash in win10

ssh-copy-id -i pub-key-path-end-with-dot-pub user@ip

init components

grep debian /etc/os-release && sudo apt install curl git zsh -y

grep centos /etc/os-release && sudo yum install curl git zsh -y

http proxy (optional)


read -p "http proxy ip is: " proxy_ip
read -p "http proxy port is: " proxy_port
source <(wget -O- https://code.aliyun.com/leizh/tools/raw/d9df59a7e33cb82b4f7edd7acf0c35e5ad86b69c/proxy/http-no-password.sh) $proxy_ip $proxy_port

my provision

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • vim vundle
git clone https://github.com/leizhnxp/provision.git
sh provision/set-up.sh
#!/usr/bin/env bash
public_key="AAAAB3NzaC1yc2EAAAADAQABAAABAQCfXvlBAIsE4/gQIvQT/I/3ZOptPK+gvhOMDd3pCFbcm4SfYXkUtSlmumuSWoP5XHBpSsBL9ZPYPpXzMrjMn0GcvV5PGu6sX7Ehv0mHB5I/AaLgrcbYcMR+T5JilssucXp/KJFJmT292m6f8fxWlVIFwxzO16RadMI48LGhW+iUFEoyvKz3f9Q0h5VzKRj/tg0qMq+AtatjT7ccd50iRONKsuY53JcFieRHZbbtuUVIcmjP/5phUzI8hAsURE3AxJgzVp092dwvtS7Jr56ArnAkPlLSfy/qTquigLrZXfTzWCuUEmBDowX1Gv/pm5+JK3F7x1pybFmy10RMZpqTeE/X"
user_home=$HOME
user_ssh_directory=$user_home/.ssh
user_file_auth_key=$user_ssh_directory/authorized_keys
mkdir -p $user_ssh_directory
touch $user_file_auth_key
grep $public_key $user_file_auth_key && exit
public_key_line="ssh-rsa "$public_key" zhenhua.lei@t460"
echo $public_key_line
echo $public_key_line | tee $user_file_auth_key
chmod 700 $user_ssh_directory
chmod 600 $user_file_auth_key
#!/usr/bin/env bash
grep debian /etc/os-release && sudo apt install git vim screen curl -y
grep centos /etc/os-release && sudo yum install git vim screen curl -y
#!/usr/bin/env bash
# ref : https://www.raspberrypi.org/documentation/configuration/use-a-proxy.md
# or source <(curl https://code.aliyun.com/leizh/tools/raw/d9df59a7e33cb82b4f7edd7acf0c35e5ad86b69c/proxy/http-no-password.sh) ip port
proxy_url="http://$1:$2"
export http_proxy=$proxy_url
export https_proxy=$proxy_url
export no_proxy="localhost, 127.*, 10.*, 172.16.*, 172.17.*, 172.18.*, 172.19.*, 172.20.*, 172.21.*, 192.168.* "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment