Skip to content

Instantly share code, notes, and snippets.

@ay65535
Last active July 21, 2020 08:21
Show Gist options
  • Save ay65535/68e45ccba7aac125f960dd420b1cf559 to your computer and use it in GitHub Desktop.
Save ay65535/68e45ccba7aac125f960dd420b1cf559 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eux
# https://note.com/nuts_b/n/n87f1b2f291e5
# https://qiita.com/matarillo/items/f036a9561a4839275e5f
sudo apt -y install daemonize
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter --target $(pidof systemd) --all su - $LOGNAME
sudo apt -y install language-pack-ja-base language-pack-ja ibus-kkc
sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
sudo localectl set-locale LANG=en_US.UTF-8 LANGUAGE="en_US:en"
source /etc/default/locale
locale
localectl
ls -la
echo 'alias q=exit' > .bash_aliases
PROXY_URL='http://x.x.x.x:80/'
BYPASS_LIST="127.0.0.1,localhost,.local,.ad.jp.x.net"
echo -e "\nexport https_proxy=$PROXY_URL" >> ~/.profile
echo 'export http_proxy=$https_proxy' >> ~/.profile
echo 'export ftp_proxy=$https_proxy' >> ~/.profile
echo 'export proxy=$https_proxy' >> ~/.profile
echo -e "export no_proxy=$BYPASS_LIST\n" >> ~/.profile
echo 'export HTTPS_PROXY=$https_proxy' >> ~/.profile
echo 'export HTTP_PROXY=$http_proxy' >> ~/.profile
echo 'export FTP_PROXY=$ftp_proxy' >> ~/.profile
echo 'export PROXY=$https_proxy' >> ~/.profile
echo 'export NO_PROXY=$no_proxy' >> ~/.profile
echo 'Acquire::ftp::proxy "$PROXY_URL";' | sudo tee -a /etc/apt/apt.conf.d/00proxy.conf
echo 'Acquire::http::proxy "$PROXY_URL";' | sudo tee -a /etc/apt/apt.conf.d/00proxy.conf
echo 'Acquire::https::proxy "$PROXY_URL";' | sudo tee -a /etc/apt/apt.conf.d/00proxy.conf
sudo sed -i.orig -e 's%http://[^ ]\+%mirror://mirrors.ubuntu.com/mirrors.txt%g' /etc/apt/sources.list
sudo apt update && \
sudo apt -y upgrade && \
sudo apt -y autoremove && \
sudo apt -y clean
apt list --manual-installed
apt list --installed
for i in python python2 python3 ruby rustc cargo swift swiftc; do which -a $i; done
which -a python
which -a python2
which -a python3
which -a ruby
which -a rustc
which -a cargo
which -a swift
which -a swiftc
which -a java
which -a javac
which -a go
locale
export
export | grep -i proxy
git clone https://github.com/ay65535/dotfiles.git .dotfiles-work
cd .dotfiles-work/
link_with_backup () {
local target="$1"
local dotdir="${2:-.dotfiles-work}"
local LN=ln
if [ -e "${dotdir}/$target" ]; then
# link .dotfiles/.target -> ~/.target
$LN -s --no-dereference --force --verbose --backup=existing "${dotdir}/${target}" "$target"
elif [ -e "${dotdir}/${target#.}" ]; then
# link .dotfiles/target -> ~/.target
$LN -s --no-dereference --force --verbose --backup=existing "${dotdir}/${target#.}" "$target"
else
echo "${dotdir}/${target} does not exist." >&2
fi
}
link_with_backup bin
link_with_backup .config
link_with_backup .bash_profile
link_with_backup .bashrc
link_with_backup .curlrc
link_with_backup local
link_with_backup .profile
link_with_backup .tmux.conf
link_with_backup .zshenv
ls -laFGh
ls -laFGhL
git config --global include.path '~/.config/git/config.core'
ghq root
git config --global ghq.root $HOME/.local/src
mkdir ~/.secret
echo "http_proxy='$PROXY_URL'" >> ~/.secret/proxy.sh
echo "https_proxy='$PROXY_URL'" >> ~/.secret/proxy.sh
echo "ftp_proxy='$PROXY_URL'" >> ~/.secret/proxy.sh
echo "no_proxy='$BYPASS_LIST'" >> ~/.secret/proxy.sh
# https://www.suzu6.net/posts/128-ubuntu-yarn-error/
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt -y install yarn
yarn global add diff-so-fancy
git config --list --show-origin
# https://qiita.com/Ryusuke-Kawasaki/items/3ca0e9674ec41238ab8e
echo '#!/bin/sh' | sudo tee -a /usr/bin/git-credential-manager
echo 'exec /mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe $@' | sudo tee -a /usr/bin/git-credential-manager
cat /usr/bin/git-credential-manager
sudo chmod +x /usr/bin/git-credential-manager
git config --global credential.helper manager
which zsh
sudo apt install zsh
cat /etc/shells
which -a zsh
chsh -s /bin/zsh
which -a zsh
apt list golang
sudo apt install golang
go env
#export GOPATH=$HOME/.local/go
echo $PATH | tr : '\n' | grep go
export PATH="$(go env GOPATH):$PATH"
cat .profile
TMPGOPATH=$(go env GOPATH)
echo $TMPGOPATH
echo "export PATH=\"$TMPGOPATH"':$PATH"' >> ~/.profile
echo $PATH | tr : '\n' | grep go
go get github.com/x-motemen/ghq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment