SIGMA's BLOG

但行好事,莫问前程

https://github.com/atom/atom/issues/5447

@yuyichao I found that the environment variables were wrong. I edited ~/.xprofile as below and it worked.

export GTK_IM_MODULE=fcitx
thanks a lot @yuyichao @xfq @yuyichao @wengxt @defunkt

后记:

我尝试了很多网上的方法,对我来说都不行。后来自己发现了一个方法,就是在atom多打开一个文档。当你无法切换输入法的时候,切换到另一个文档,再切回来,就好了。

每次重新搭建环境太累,写个文档记录一下,方便以后写shell


更新apt

1
2
sudo apt update
sudo apt upgrade

安装python并创建virtualenv

1
2
3
4
5
6
7
8
9
10
11
12
13
# 就是没装这个导致ssl module in Python is not available
sudo apt-get install python3-dev libffi-dev libssl-dev
# zipimport.ZipImportError: can't decompress data; zlib not available make: *** [altinstall] Error 1
sudo apt-get install zlib1g-dev

# 下载并安装python
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --enable-optimizations
make -j8
sudo make altinstall
python3.6

更换系统默认python版本

1
2
3
4
5
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

# 切换python版本
sudo update-alternatives --config python

若创建virtualenv提示找不到python

1
2
# 用这个命令倒是可以
virtualenv -p python3.5 py35

更改pip源

1
2
3
4
sudo vim ~/.pip/pip.conf

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

安装7z

1
$ sudo apt-get install p7zip-full p7zip-rar

若碰到无法解压的,要么压缩文件出了问题,要么文件格式不能用这个工具解压

sougou

Download

1
2
3
4
im-config
选fcitx
在setting-input method configuration里面添加sogou
logout或重启一下

uget+aria2

1
sudo apt install uget aria2

然后在edit -> setting -> plug-in设置为aria2

http://www.bootcss.com/p/git-guide/

简单操作

更新远程仓库

1
2
3
4
5
6
# 不会同步删除操作
git add *
# 会同步所有,包括删除文件的操作
# git add -A
git commit -m "some description"
git push

更新本地仓库

但是更新后然后用上面方式更新会是merge到master而不是更新master
```bash git pull 或者 git fetch origin master

1
2
3
4
5
6
7
<h3 id="创建分支"><a href="#创建分支" class="headerlink" title="创建分支"></a>创建分支</h3>

```bash
git checkout -b iss53
# 上面的命令相当于
git branch iss53
git checkout iss53

删除分支

1
git branch -d hotfix

新建repository

目前用的最笨的手动创建repository,然后git clone到本地,然后往本地的文件夹添加文件,再push上去

问题集合

git push提示没有权限

设置Git的user name和email
```bash git config --global user.name "yourname" git config --global user.email "youremail"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<p>生成SSH密钥<br>```bash
查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
生存密钥:
ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub
```</p>
<p>添加密钥到ssh:ssh-add 文件名,需要之前输入密码.</p>
<p>在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。<br>打开<a href="https://github.com/,在设置中添加密钥" target="_blank" rel="noopener">https://github.com/,在设置中添加密钥</a></p>

```bash
测试:ssh git@github.com
The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.

如何修改github上仓库的项目语言?

问题原因:

github 是根据项目里文件数目最多的文件类型,识别项目类型.

解决办法:

项目根目录添加 .gitattributes 文件, 内容如下 :

1
2
3
*.swift linguist-language=objective-c

作用: 把项目里的 .swift 文件, 识别成 objective-c 语言

问题:WPS下搜狗输入法不能输入中文

原因:环境变量未正确设置

1
2
3
4
$ vi /usr/bin/wps
在第一行 #!/bin/bash 下添加:
export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE="fcitx"

(2)ppt、excel部分

和word一样的方法添加环境变量,只是编辑的文件各不同:

1
2
$ vi /usr/bin/wpp
$ vi /usr/bin/et

opencv

官网教程

  1. 到上面的链接下载源文件

  2. 由于要使用cmake:

    1
    2
    3
    [compiler] sudo apt-get install build-essential
    [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
  3. cd进去文件目录

    1
    2
    3
    4
    5
    6
    cd opencv-3.3
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
    make
    sudo make install
  4. 另外,在Ubuntu上使用python调用OpenCV需要安装python包

    1
    sudo apt-get install python-opencv
  5. 验证是否安装成功

    1
    2
    import cv2
    cv2.__version__

碰到的问题

  • 缺少IPPICV,需要下载但是下载timeout

    从网上下载包(这里)然后

    1
    2
    3
    cd opencv-3.3.0/.cache/ippicv
    替换掉原来的cache文件
    然后重新执行cmake命令
  • 安装完成后virtualenv无法使用cv2

    我尝试过将系统的python3.5里面site-packages关于opencv的文件放到virtualenv的对应目录下,但是不行,故activate后再重新安装,就好了.

nvidia驱动+cuda安装方法

详见同目录下[Ubuntu16.04-TAITAN-X-CUDA-8.pdf]

查看显卡配置

1
2
lspci -vnn | grep VGA -A 12
lshw -C display

测试cuda

1
2
3
4
cd ~/NVIDIA_CUDA-8.0_Samples
make
cd ~/NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release
sudo ./deviceQuery

安装cudnn

下载tgz包
```bash tar -xf cudnn-8.0-linux-x64-v6.0.tgz cd cuda sudo cp ./include/cudnn.h /usr/local/cuda/include sudo cp -a ./lib64/libcudnn* /usr/local/cuda/lib64 sudo rm -rf libcudnn.so.6 libcudnn.so sudo ln -s libcudnn.so.6.0.21 libcudnn.so.6 sudo ln -s libcudnn.so.6 libcudnn.so ```

一些依赖

https://devtalk.nvidia.com/default/topic/993862/cuda-8-0-missing-required-libraries-on-ubuntu-16-04/

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev

wget下载出现 error 403

1
2
3
4
5
6
7
wget wget http://datasets-ac.oss-cn-zhangjiakou.aliyuncs.com/ai_challenger_stock_train_20170916.zip?OSSAccessKeyId=LTAIrOA0FFfXPB7A

--2017-09-19 17:15:08-- http://datasets-ac.oss-cn-zhangjiakou.aliyuncs.com/ai_challenger_stock_train_20170916.zip?OSSAccessKeyId=LTAIrOA0FFfXPB7A
Resolving datasets-ac.oss-cn-zhangjiakou.aliyuncs.com (datasets-ac.oss-cn-zhangjiakou.aliyuncs.com)... 47.92.17.73
Connecting to datasets-ac.oss-cn-zhangjiakou.aliyuncs.com (datasets-ac.oss-cn-zhangjiakou.aliyuncs.com)|47.92.17.73|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-19 17:15:08 ERROR 403: Forbidden.

解决办法

1
wget -O 'test.zip' "http://datasets-ac.oss-cn-zhangjiakou.aliyuncs.com/ai_challenger_stock_train_20170916.zip?OSSAccessKeyId=LTAIrOA0FFfXPB7A"

问题原因

与wget用不同方式发送的header有关,具体看这里

0%