Hanjie's Blog

一只有理想的羊驼

安装Wine1

1
2
3
4
5
sudo apt-get p11-kit-modules:i386 libp11-kit-gnome-keyring:i386
sudo add-apt-repository ppa:jonathonf/wine
sudo apt-get update
sudo apt-get install wine-stable
sudo apt-get install winetricks
配置Wine
1
winecfg
安装字库(可选)
1
winetricks allfonts
测试:
1
2
wine --version
wine-1.8.7 (Ubuntu)
删除
1
sudo apt-get purge wine-stable winetricks

u-center

将windows中的u-center文件夹复制到Linux下,执行:

1
2
sudo adduser YOUR_USER dialout
ln -s /dev/ttyACM0 ~/.wine/dosdevices/com1

重启,

1
2
cd ~/u-center_v8.25
wine u-Center.exe
未命名

  1. https://www.howtoing.com/install-wine-on-ubuntu-and-linux-mint/↩︎

安装nvm

因为brew安装nvm会有问题,所以推荐用传统方法安装1

1
2
brew install curl
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

删除

1
to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)

升级

1
cd "$NVM_DIR" && git pull origin master && git checkout `git describe --abbrev=0 --tags`

安装node.js

1
2
nvm install 4
nvm use 4.2.6

预设使用Node的版本,否则每次重新登入,都要nvm use一次2

1
nvm alias default 4.2.6

测试:

1
nvm -v

安装Hexo

1
proxychains4 npm install -g hexo-cli

-g–global表示全局安装模块,如果没有这个参数,会安装在当前目录的node_modules子目录下3

因为GFW的问题,会在安装的时候发生错误,此时可以改用4

1
npm install hexo --no-optional

测试:

1
hexo -v

有可能会出现以下错误:

1
2
3
{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

这是由于dtrace-provider出现错误,可以通过重新安装解决:

1
2
3
4
cd .nvm/versions/node/v4.2.6/lib/node_modules/hexo-cli/node_modules/hexo-log/node_modules/bunyan

npm uninstall dtrace-provider
npm install dtrace-provider --save

初始化Hexo

1
2
3
hexo init <folder>
cd <folder>
npm install

启动服务(在博客所在的文件夹内)5:

1
hexo s

如果继续发生如下错误:

1
2
3
{ [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

可以继续通过重新安装dtrace-provider解决:

1
2
3
4
cd node_modules/hexo/node_modules/hexo-log/node_modules/bunyan

npm uninstall dtrace-provider
npm install dtrace-provider --save

更换主题

安装next主题

1
git clone https://github.com/iissnan/hexo-theme-next themes/next

然后修改\_config.yml文件,修改为:

1
2
3
4
5
6
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

language: zh-Hans

使用Mathjax

安装插件6

1
npm install hexo-math --save

在网站的\_config.yml文件中添加:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
math:
engine: 'mathjax' # or 'katex'
mathjax:
src: http://cdn.bootcss.com/mathjax/2.6.1/MathJax.js?config=TeX-MML-AM_HTMLorMML
config:
{
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
processEscapes: true
},
TeX: {
equationNumbers: {
autoNumber: "AMS"
}
},
messageStyle: "none"
}
katex:
css: # not used
js: # not used
config:
# KaTeX config

修改heading里#后的空格

为了##后不用加空格,直接写标题,可以对markdowm渲染器进行修改。把/Blogs/node_modules/hexo-renderer-marked/node_modules/marked/lib/marked.js改为:

1
heading: /^ *(#{1,6})+([^\n]+?) *#* *(?:\n+|$)/

支持footnote

可以通过将markdown渲染器替换为hexo-renderer-markdown-it,使得支持footnote功能7

1
2
npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it --save

必须要先卸载原先的渲染器。然后在网站\_config.yml文件中添加:

1
2
3
markdown:
plugins:
- markdown-it-footnote

然后发现每一条footnote间都有一行间隔。想要去掉的话,可以在'/Blogs/themes/next/source/css/_custom/custom.styl'中添加:

1
2
3
.footnote-item p {
margin-bottom: 0
}

hexo-renderer-markdown-it还支持很多其他的功能,具体可以到官网了解。

Doesn't escape HTML content

hexo-renderer-markdown-it is the default renderer of my Hexo blog. But I found that the HTML content inside the md will be escaped to the final result when I wanted to force a line-break by inserting a <br> tag.

To trigger this function, the configuration of the \_config.yml in the blog should be:

1
2
3
markdown:
render:
html: true

where8:

1
2
3
html: true # Doesn't escape HTML content
## OR
html: false # Escapes HTML content so the tags will appear as text.

支持插入pdf

1
npm install --save hexo-pdf

使用9

1
2
3
4
5
6
7
8
# Normal PDF
{% pdf http://7xov2f.com1.z0.glb.clouddn.com/bash_freshman.pdf %}

#Google drive
{% pdf http://drive.google.com/file/d/0B6qSwdwPxPRdTEliX0dhQ2JfUEU/preview %}

#Slideshare
{% pdf http://www.slideshare.net/slideshow/embed_code/key/8Jl0hUt2OKUOOE %}

  1. https://github.com/creationix/nvm↩︎

  2. http://mac-osx-for-newbie-book.kejyun.com/software/softwareWebDeveloperNodeJS.html↩︎

  3. https://www.haomwei.com/technology/how-to-install-hexo-on-mac.html↩︎

  4. http://www.jianshu.com/p/fd878edb95e7↩︎

  5. https://hexo.io/docs/↩︎

  6. https://github.com/akfish/hexo-math↩︎

  7. https://github.com/celsomiranda/hexo-renderer-markdown-it↩︎

  8. https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/Advanced-Configuration↩︎

  9. https://github.com/superalsrk/hexo-pdf↩︎

换源

1
2
3
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

sudo gedit /etc/apt/sources.list

填入:

1
2
3
4
5
6
7
8
9
10
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
1
2
sudo apt-get update
sudo apt-get upgrade

科学上网

1
2
3
sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5

终端指令代理1

1
2
3
sudo apt-get install proxychains

sudo gedit /etc/proxychains.conf

在末尾,删掉socks4的那一条目(重要),并且根据实际添加代理:

1
socks5  127.0.0.1 1080

或者2

1
2
3
4
5
6
7
8
9
10
11
12
# 安装
git clone https://github.com/rofl0r/proxychains-ng.git
./configure --prefix=/usr --sysconfdir=/etc
make
sudo make install
sudo make install-config

# 配置 socks4 127.0.0.1 9050改为socks5 127.0.0.1 1080
sudo gedit /etc/proxychains.conf

# 使用
proxychains4 telnet google.com 8

Shadowsocks 转换 HTTP 代理3

Shadowsocks 默认是用 Socks5 协议的,对于 Terminal 的 get,wget 等走 Http 协议的地方是无能为力的,所以需要转换成 Http 代理,加强通用性,这里使用的转换方法是基于 Polipo 的。

1
2
sudo apt-get install polipo
sudo gedit /etc/polipo/config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
logSyslog = false
logFile = "/var/log/polipo/polipo.log"

socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5

chunkHighMark = 50331648
objectHighMark = 16384

serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32

proxyAddress = "0.0.0.0"
proxyPort = 8123
1
/etc/init.d/polipo restart

chrome

1
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

Dropbox

这里下载Dropbox,然后执行4

1
2
sudo dpkg -i dropbox_2015.10.28_amd64.deb
proxychains4 dropbox start -i

或者:

这里下载dropbox-lnx.x86_64-3.16.1.tar.gz,将解压缩后的 .dropbox-dist 放在 /home/用户名/ 下。然后:

1
~/.dropbox-dist/dropboxd

右键添加在终端中打开功能

1
sudo apt-get install nautilus-open-terminal

  1. http://www.nenew.net/ubuntu-linux-proxychains.html↩︎

  2. http://www.jakehu.me/2015/Ubuntu-Dropbox/↩︎

  3. http://xuhehuan.com/2119.html↩︎

  4. http://wowubuntu.com/ubuntu_dropbox.html↩︎

0%