0%

This is an example of introducing the font “Noto Serif CJK SC” into Typora Paper theme. Then font-family: "Noto Serif CJK SC" can be used in later CSS codes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@font-face {
font-family: "Noto Serif CJK SC";
font-style: normal;
font-weight: normal;
src: local("Noto Serif CJK SC"), url("./paper/NotoSerifCJKsc-Regular.otf") format("otf");
}

@font-face {
font-family: "Noto Serif CJK SC";
font-style: normal;
font-weight: bold;
src: local("Noto Serif CJK SC Bold"), url("./paper/NotoSerifCJKsc-Bold.otf") format("otf");
}

@font-face {
font-family: "Noto Serif CJK SC";
font-style: normal;
font-weight: black;
src: local("Noto Serif CJK SC Black"), url("./paper/NotoSerifCJKsc-Black.otf") format("otf");
}

@font-face {
font-family: "Noto Serif CJK SC";
font-style: normal;
font-weight: medium;
src: local("Noto Serif CJK SC Medium"), url("./paper/NotoSerifCJKsc-Medium.otf") format("otf");
}
Read more »

This script automatically deploys the blog whenever a change is made locally or remotely:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

while true; do
git add -A && git commit -m -
git fetch
DIFF=$(git rev-list HEAD...origin/master —count)

if [ $DIFF -gt 0 ]; then
echo “Need to sync”
git pull
git push
hexo clean
hexo g
hexo d

else
echo “Up-to-date”

fi
sleep 10
done
Read more »

近期对话。

实验室学长

“最近怎样?”

“啊,我最近在忙xxx课题,输入###输出%%%,可以看作是yyy和zzz方向的结合。我最近刚开始在小数据上做一些实验,结果遇到一堆问题…主要是对zzz方向不太熟,最近几周都没什么进展。我下周打算开始和实习那边meet,看看实习还能不能抢救一下…”

父母

“最近怎样?”

“最近挺好的,学校里的人都挺友善的,附近很安全。食堂能拿饭,门口草坪一堆人铺个毯子晒太阳。我常常穿过一条街去星爸爸买咖啡,路边开满了鲜花,建筑物也很美。另外,我最近研制出来一种炒饭,饭+鸡蛋+葱花+西兰花/玉米粒/虾仁/蘑菇片,加糖和味极鲜一炒就行,10分钟以内出锅,香到不行……什么,你说科研嘛。嗨,没啥新鲜事,每天都差不多。实在没有老板肯要我的话还有硕士这条退路嘛(笑)。”

对象

“在干嘛?”(好像没问过最近怎样)

“代码写不出来,等死中 /
靠为什么我写的全是bug /
又被老板骂了一顿,人生无望 /
实验又不work,心态崩了 /
昨天没咋睡觉,现在整个人飘在天上 /
…”

Read more »

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM ubuntu:16.04

USER root

# install necessary packages
RUN apt-get update && \
apt-get -y install sudo vim zsh curl git build-essential openssh-server python-tk python3-tk x11-apps net-tools iputils-ping software-properties-common

# for X11 forwarding
RUN echo "X11UseLocalhost no" >> /etc/ssh/sshd_config

# duplicate the current user; UID, GID can be input via command line
ARG UNAME=weepingfish
ARG UID=1000
ARG GID=1000
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME

# set default password
RUN echo "weepingfish:password" | chpasswd && adduser weepingfish sudo

# setup custom $HOME
RUN usermod --home /newhome/weepingfish weepingfish

# set the default user and default login directory
USER weepingfish
WORKDIR /newhome/weepingfish

# install zsh
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

Usage

1
2
3
4
5
6
7
8
9
10
11
# build an image (in /path/to/Dockerfile)
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$USER -t ubuntu:16.04 .

# run a deamon container with nvidia support (need to install nvidia-docker first)
nvidia-docker run -dit --name vm1 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /newhome:/newhome -p 8040-8049:8040-8049 --hostname vm1 --gpus all ubuntu:16.04

# start an interactive docker session
docker exec -it vm1 zsh

# stop and delete the container
docker container stop vm1 && docker container rm vm1
Read more »