Old MBP Setups

MBP software log

X-code command line tool

xcode-select --install

Root

OsX 10.14 clang100

root_v6.14.06.macosx64-10.14-clang100.dmg

128M

OsX 10.14 clang100

root_v6.14.06.macosx64-10.14-clang100.tar.gz

127M

tar.解压缩后放入/Users/zhangce/Application/root_534 (614)

在.bash_profile中加入 source /Users/zhangce/Application/root_534/bin/thisroot.sh


Calibri fonts

other mirosoft fonts can be found at zhangce/Application

Git

git config --global user.name "CedricZhang"
git config --global user.email "zhangce9516@gmail.com"

然后根据廖雪峰网站上远程仓库一章的步骤,敲入:

ssh-keygen -t rsa -C "zhangce9516@gmail.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/zhangce/.ssh/id_rsa);

Created directory ‘/Users/zhangce/.ssh’.

Enter passphrase (empty for no passphrase);

Your identification has been saved in /Users/zhangce/.ssh/id_rsa.

Your public key has been saved in /Users/zhangce/.ssh/id_rsa.pub.

第一次配置好以后 clone Muyield:

git clone git@github.com:CedricZhang9516/MuYield.git

Cloning into 'MuYield'...

The authenticity of host 'github.com (192.30.255.113)' can't be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.

Are you sure you want to continue connecting (yes/no)?

Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.

remote: Enumerating objects: 51, done.

remote: Counting objects: 100% (51/51), done.

remote: Compressing objects: 100% (39/39), done.

remote: Total 251 (delta 30), reused 29 (delta 12), pack-reused 200

Receiving objects: 100% (251/251), 118.76 KiB | 668.00 KiB/s, done.

Resolving deltas: 100% (133/133), done.

Remote access for two MacBooks

Home to Air: ssh zhangce@mar88-86.kek.jp

文件共享:smb://mar88-86.kek.jp

屏幕共享:vnc://mar88-86.kek.jp

KEK Printer

DocuPrint C3200 A macOS 10.13 High Sierra (English Environment)

https://www.fujixerox.co.jp/download/eng/docuprint/c3200a

For DocuPrint C3200 A macOS 10.14 Mojave (English Environment)

https://www.fujixerox.co.jp/download/apeosport/6_c7771/mac1013/ppd

添加打印机、IP地址、LPD协议即可。

XQuartz

2019/02/01

XQuartz-2.7.11.dmg

Iterm2

02-05

shell integration

https://www.iterm2.com/documentation-shell-integration.html

curl -L https://iterm2.com/shell_integration/install_shell_integration_and_utilities.sh | bash

HostName

mar92-64:~ zhangce$ sudo scutil --get HostName

HostName: not set

mar92-64:~ zhangce$ sudo scutil --get ComputerName

ZhangCe-MacBook-Pro

mar92-64:~ zhangce$ scutil --set HostName ZhangCe-MacBook-Pro

Scp shortcut

Details in snippernote

在.bashrc中加入(第一行)

if [ -z "$PS1" ]; then
    return
fi

https://stackoverflow.com/questions/12440287/scp-doesnt-work-when-echo-in-bashrc

Odeint

export PATH=$PATH:/Users/zhangce/Application/odeint-v2/include
###in the .bash_profile:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export PATH=$PATH:/usr/local
source /Users/zhangce/Application/root_61600/bin/thisroot.sh
### /Users/zhangce/Application/headmyshoulder

(install boost, to be precise)

- git clone --depth=50 --branch=master https://github.com/headmyshoulder/odeint-v2.git headmyshoulder/odeint-v2
- cd headmyshoulder/odeint-v2
- wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.bz2/download?use_mirror=superb-dca2 -O /tmp/boost.tar.bz2
- tar jxf /tmp/boost.tar.bz2
- mv boost_1_63_0 $PWD/boost-trunk
- source /Users/zhangce/Application/headmyshoulder/odeint-v2/tmp/config.sh ///这只是一次性的
- export BOOST_ROOT="$PWD/boost-trunk" ///// 这只是一次性的export
- cd $BOOST_ROOT

/Users/zhangce/Application/headmyshoulder/odeint-v2/tmp/config.sh

export CXXSTD=""
export TRAVIS_COMPILER=clang
export CXX=clang++
export CXX_FOR_BUILD=clang++
export CC=clang
export CC_FOR_BUILD=clang
$ ./bootstrap.sh /// when finish, will prompt you run ./b2 to build
but the website still does something else
$ cd $TRAVIS_BUILD_DIR
$ if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$CC" = "gcc" ]; then export CC=gcc-4.8; fi
$ echo $CC // should be clang
$ $CC --version
$ if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
/// 意味着用g++ 4.8 编译, default is g++ 4.2
$ $BOOST_ROOT/b2 install toolset=$CC cxxflags='$CXXSTD' -j2
//// 注意比网站上多了一个install
the end!

Iit copies the .h file into /usr/local/include/boost and /usr/local/lib

in the bash_profile:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export PATH=$PATH:/usr/local

https://travis-ci.org/headmyshoulder/odeint-v2/jobs/507332885

Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Power line fonts

git clone https://github.com/powerline/fonts.git --depth=1
cd Application/Powerline_fonts/
./install.sh
Copying fonts...
Resetting font cache, this may take a moment...
Powerline fonts installed to /Users/zhangce/Library/Fonts
###

Oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

The lambda mode:

https://xiaozhou.net/learn-the-command-line-iterm-and-zsh-2017-06-23.html

Plugins:

brew install autojump
[brew install zsh-syntax-highlighting](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-syntax-highlighting.rb)

Tmux

zhangce [~] → brew install tmux

Sublime Text

Package control

  • Installation

快捷键 Ctrl+Shift+P,在对话框中输入“list”,选择“Package Control:List Packages”。有时候我们需要移除自己不想要的插件,具体操作如下:快捷键 Ctrl+Shift+P,在对话框中输入“remove”,选择“Package Control: Remove Packages”。

Shortcuts

  • To open the console, press

Ctrl+`
  • control panel:

command+ shift + P
  • Selection

Select some text and press command + D to add more instances. If you want to skip the current instance, press command + K, command + D.

command + L expands the selections to the end of the line. command + Shift + L splits the selections into lines.

  • Select Block

Right Mouse Button + ⌥
  • Add to Selection

⌘ + Right Mouse Button

OS X:

ctrl + shift + up/down
  • Others

command + J 可以把当前选中区域合并为一行:

command + Shift + Enter 在当前行上面增加一行并跳至该行。

Ctrl + D 选择当前光标所在的词并高亮该词所有出现的位置,再次 Ctrl + D 选择该词出现的下一个位置,在多重选词的过程中,使用 Ctrl + K 进行跳过,使用 Ctrl + U 进行回退,使用 Esc 退出多重编辑。

Ctrl + P 会列出当前打开的文件(或者是当前文件夹的文件),输入文件名然后 Enter 跳转至该文件。

Command + R 会列出当前文件中的符号(例如类名和函数名,但无法深入到变量名),输入符号名称 Enter 即可以跳转到该处。

command + G 一个一个的选择。

ctrl + G 跳转到某一行

“Go To Anything”: command + P

Ctrl + K, Ctrl + B 显示或隐藏侧栏

command + option (alt) + 12345 分屏

  • DeleteBlankLines 插件

选择部分后 ctrl+alt+backspace 键 (Mac是delete键).

OSX:

- Fn+Ctrl+Option+Delete –> Delete Blank Lines
- Fn+Ctrl+Option+Shift+Delete –> Delete Surplus Blank Lines

Latex on sublime

Install latexmk on the mac with sublime plugs.

sshfs

Permanently Mounting the Remote File System

SSHFS also allows for setting up permanent mount points to remote file systems. This would set a mount point that would persist through restarts of both your local machine and droplets. In order to set up a permanent mount point, we will need to edit the /etc/fstab file on the local machine to automatically mount the file system each time the system is booted.

First we need to edit the /etc/fstab file with a text editor.

sudo nano /etc/fstab

Scroll to the bottom of the file and add the following entry

sshfs#root@xxx.xxx.xxx.xxx:/ /mnt/droplet

Save the changes to /etc/fstab and reboot if necessary.


安装sshfs的依赖和其本身:

brew install Caskroom/cask/osxfuse
brew install sshfs

使用sshfs挂载服务器目录:

sshfs username@host:remote_dir local_dir

remote_dir 和 local_dir分别指需要挂载的服务器目录和挂载到本地形成的本地目录。

使用完成后取消挂载:

umount local_dir

如果电脑休眠或重启导致挂载失效,且无法取消挂载,可以杀掉相应挂载进程:

pgrep -lf sshfs
pkill -9 sshfs

原文链接:https://blog.csdn.net/x_koozal/article/details/79784659

KEKCC

KEKCC

Synchronize the code on KEKCC via GitHub

我的代码框架:本地 –> gitlab –> KEKCC

git init
git remote add origin https://github.com/CedricZhang9516/MuYield.git

(SSH: git@github.com:CedricZhang9516/Mu1S2SStatistics.git)

git pull origin master

注意:

  1. 用 git pull 从github 下载到kekcc上的时候,检查的是在github上的版本stamp和kekcc上的版本stamp是否一致,不一致,有更新,才下载。即使在kekcc上修改了某个文件,只要这个文件的版本stamp是最新的,就不会被GitHub更新。更新指的不是GitHub去比较两个文件是否相同,而是仅仅比较两个文件的版本stamp是否相同。

  2. 现在如果要从KEKCC上面修改完成之后push到github上,则采用

$ git remote
check the name of the origin

比如KEKCC上MUYIELD的分支名称就是 origin。

  1. 推送分支,就是把该分支上的所有本地提交推送到远程库。推送时,要指定本地分支,这样,Git就会把该分支推送到远程库对应的远程分支上:

# (after change the code)
git add <file>
git commit
git push origin master

本地的话用GitHub desktop pull 一下。

KEKCC .bashrc

####
.bashrc root-6
.barshrc534 root 5.34.38
.bashrcRootlocal root 5.34.36 local

to compile the musr, we need .bashrc & .bashrc534

Or

.bashrcRootlocal (moved to .bashrc) & .bashrc534

g-2/share/gcc版本都被注释了,今后需要的话再记得加上。

编译musr_sim的时候,必须先把.bashrcRootlocal 变成 .bashrc, 然后再source .bashrc534才行。

至于现在的 bashrc 和 bashrcRootlocal 的区别。有时间再说吧

SSH 免密

方法

scp ~/.ssh/id_rsa.pub username@host:~/.ssh/authorized_keys

若authorized_keys文件已存在,将id_rsa.pub中内容复制追加到已有内容后。

下面这部分很重要,是确保能顺利识别 scp test.txt kekcc: 的重要操作

若没有使用zsh,是普通bash,可以在~/.ssh/config文件中添加服务器信息,文件不存在则新建,存在则追加,格式:

Host      new      #别名
HostName    host      #服务器IP
Port      port      #端口,默认22
User      username    #登录用户名
IdentityFile  ~/.ssh/id_rsa #私钥文件,参加第一步

原文链接:https://blog.csdn.net/x_koozal/article/details/79784659

原理学习

假设 A (192.168.20.59)为客户机器,B(192.168.20.60)为目标机;

单向登陆的操作过程: 1、登录A机器 2、ssh-keygen -t [rsa|dsa],将会生成密钥文件和私钥文件 id_rsa,id_rsa.pub或id_dsa,id_dsa.pub 3、将 .pub 文件复制到B机器的 .ssh 目录, 并 cat id_dsa.pub >> ~/.ssh/authorized_keys 4、大功告成,从A机器登录B机器的目标账户,不再需要密码了;(直接运行 #ssh 192.168.20.60

添加已有的PublicKey到ssh的authorized_keys

To overwrite authorized_keys

cat <your_key >~/.ssh/authorized_keys

To append to the end of authorized_keys

cat <your_key >>~/.ssh/authorized_keys

man sshd”命令查看对authorized_keys文件的描述如下:

man sshd
.....
     ~/.ssh/authorized_keys
             Lists the public keys (DSA/ECDSA/RSA) that can be used for logging in as this user.  The format of
             this file is described above.  The content of the file is not highly sensitive, but the recommended
             permissions are read/write for the user, and not accessible by others.
If this file, the ~/.ssh directory, or the user's home directory are writable by other users, then the
         file could be modified or replaced by unauthorized users.  In this case, sshd will not allow it to be
         used unless the StrictModes option has been set to “no”.

Reference

https://blog.csdn.net/dongwuming/article/details/9705595

http://smilejay.com/2013/01/ssh-password-authorized_keys/

Air 2022