2016年10月19日 星期三
2016年10月15日 星期六
紀錄sublime 3 裝了啥
首先裝
packagecontrol:
https://packagecontrol.io/installation
command + shift + p 找安裝套件
安裝alignment
Preferences > Packages Settings > Alignment > Settings - User
加入以下內容:
{
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": [
"=", ":"
],
"alignment_space_chars": ["="],
"alignment_prefix_chars": [
"+", "-", "&", "|", "<", ">", "!", "~", "%", "/", "*", "."
]
}
之後選取要alignment的內容
command + ctl + a
安裝git
安裝SideBarEnhancements
下載Vinageous
啟用vim模式
Preference->Setting-User 打開編輯,將ignored_packages裡面的[]清空
"ignored_packages":
[
]
我的主要配置 Preferences -> Settings -> User
安裝sftp
http://ephrain.pixnet.net/blog/post/60699853-%5Bsublime-text%5D-%E4%BD%BF%E7%94%A8-sftp-%E5%A5%97%E4%BB%B6%E8%87%AA%E5%8B%95%E5%90%8C%E6%AD%A5%E6%9C%AC%E5%9C%B0-%E9%81%A0%E7%AB%AF
packagecontrol:
https://packagecontrol.io/installation
command + shift + p 找安裝套件
安裝alignment
Preferences > Packages Settings > Alignment > Settings - User
加入以下內容:
{
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": [
"=", ":"
],
"alignment_space_chars": ["="],
"alignment_prefix_chars": [
"+", "-", "&", "|", "<", ">", "!", "~", "%", "/", "*", "."
]
}
之後選取要alignment的內容
command + ctl + a
安裝git
安裝SideBarEnhancements
下載Vinageous
啟用vim模式
Preference->Setting-User 打開編輯,將ignored_packages裡面的[]清空
"ignored_packages":
[
]
我的主要配置 Preferences -> Settings -> User
{ "color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme", "highlight_line": true, "ignored_packages": [ "Vintage" ], "vintageous_use_ctrl_keys": true, "vintageous_use_sys_clipboard": true
}
方便我切換其tab:
修改Preferences -> Key Bindings -> User
[
{ "keys": ["super+left"], "command": "prev_view" },
{ "keys": ["super+right"], "command": "next_view" },
{ "keys": ["super+t"], "command": "new_file" },
]
參考mac os X 上sublime 的配置:
http://guoqiao.me/post/2015/0110-sublime-text-config-for-mac-os-x
我的keymap 長這樣:
[
{ "keys": ["super+left"], "command": "prev_view" },
{ "keys": ["super+right"], "command": "next_view" },
{ "keys": ["super+t"], "command": "new_file" },
{
"keys": ["super+alt+right"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.33, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
},
{
"keys": ["super+alt+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.66, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
},
{ "keys": ["alt+1"], "command": "move_to_group", "args": { "group": 0 } },
{ "keys": ["alt+2"], "command": "move_to_group", "args": { "group": 1 } },
{ "keys": ["alt+3"], "command": "move_to_group", "args": { "group": 2 } },
{ "keys": ["alt+4"], "command": "move_to_group", "args": { "group": 3 } },
{ "keys": ["alt+5"], "command": "move_to_group", "args": { "group": 4 } },
{ "keys": ["alt+6"], "command": "move_to_group", "args": { "group": 5 } },
{ "keys": ["alt+7"], "command": "move_to_group", "args": { "group": 6 } },
{ "keys": ["alt+8"], "command": "move_to_group", "args": { "group": 7 } },
{ "keys": ["alt+9"], "command": "move_to_group", "args": { "group": 8 } },
{ "keys": ["f1"], "command": "clone_file_and_move_to_group" }
]
我想要一個功能類似vim 裡面的:split
1) Tools → New Plugin
import sublime
import sublime_plugin
class CloneFileAndMoveToGroup(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command("clone_file")
# self.window.run_command("move_to_group", { "group": 1 })
self.window.run_command("move_to_neighboring_group")
2) Sublime Text 2 → Preferences → Key Bindings — User
{ "keys": ["f1"], "command": "clone_file_and_move_to_group" }
安裝sftp
http://ephrain.pixnet.net/blog/post/60699853-%5Bsublime-text%5D-%E4%BD%BF%E7%94%A8-sftp-%E5%A5%97%E4%BB%B6%E8%87%AA%E5%8B%95%E5%90%8C%E6%AD%A5%E6%9C%AC%E5%9C%B0-%E9%81%A0%E7%AB%AF
2016年10月2日 星期日
NFS setup
http://flykof.pixnet.net/blog/post/23028290-ubunto%E4%B8%8B%E5%AE%89%E8%A3%9D%E8%A8%AD%E5%AE%9Anfs
2016年9月24日 星期六
C: call by value/reference 複習
http://wp.mlab.tw/?p=176
http://www.quanxue.cn/jc_clanguage/CLang/Clang18.html
http://www.quanxue.cn/jc_clanguage/CLang/Clang18.html
2016年2月25日 星期四
2016年2月23日 星期二
solve the loop login problem of install the CUDA 7.5 on Ubuntu
http://codeyarns.com/2015/09/25/how-to-install-cuda-7-5-on-ubuntu/
2015年11月29日 星期日
Vim plugs
ctrlp:
快速開啟目錄下檔案
快速開啟目錄下檔案
- command mode 打 ctrl+p
- 找檔名
- 選檔案, ctrl+t 開在新分頁; ctrl+v 開在目前分頁的新 window, ctrl+x 水平切,按 enter 開在目前分頁
- ctrl+g 離開
2015年11月28日 星期六
github 常用指令
基礎的:
生patch:
git diff branchname --cached > patch
Push changes from your commit into your branch :
$ git push origin [name_of_your_remote]
刪除遠端 branch:git push origin :your_branch刪除本地branch:git branch -d yourbranch
update remote branch: http://blog.csdn.net/u012150179/article/details/171722112 ,从远程获取最新版本到本地
1 2 3 4 | $ git fetch origin master
From https://github.com/com360/android-app
* branch master -> FETCH_HEAD
su@SUCHANGLI /e/eoe_client/android-app (master)
|
$ git fetch origin master 这句的意思是:从远程的origin仓库的master分支下载代码到本地的origin master
3. 比较本地的仓库和远程参考的区别
1 2 | $ git log -p master.. origin/master
su@SUCHANGLI /e/eoe_client/android-app (master)
|
因为我的本地仓库和远程仓库代码相同所以没有其他任何信息
4. 把远程下载下来的代码合并到本地仓库,远程的和本地的合并
1 2 3 | $ git merge origin/master
Already up-to-date.
su@SUCHANGLI /e/eoe_client/android-app (master)
|
加patch: 今天要打包最新的三個 commit 的話 git format-patch -3 此時 git 便會幫你產生3個類似下列的檔案 0001-First.patch 0002-Second.patch 0003-Third.patch 2.那如果要套用別人的patch 也相當簡單 git am 0001-First.patch 就將 patch apply 上去了
================================
刪除錯誤提交commit:
方法:
git reset --hard
git push origin HEAD --force
Git patch 合併有衝突的話:
http://www.fwolf.com/blog/post/448
2015年10月22日 星期四
常用核心記憶體分配函數
[轉貼]http://welkinchen.pixnet.net/blog/post/44174948-%E5%B8%B8%E7%94%A8%E6%A0%B8%E5%BF%83%E8%A8%98%E6%86%B6%E9%AB%94%E5%88%86%E9%85%8D%E5%87%BD%E6%95%B8
2015年6月23日 星期二
2015年6月15日 星期一
3n+1
#include <stdio.h>
#include <stdlib.h>
#define swap(x,y) (x^=y,y^=x,x^=y)
int main()
{
unsigned long A, B;
while(scanf("%ld %ld", &A, &B) == 2)
{
printf("%ld %ld ", A, B);
if (A > B) swap(A,B);
unsigned long max = 0;
unsigned long i;
for(i = A; i <= B; i++)
{
unsigned long count, n;
for(count = 0, n = i;;)
{
count++;
if(n == 1) break;
n = (n%2==1)? 3*n+1 : n >> 1;
}
if(count >= max) max = count;
}
printf("%ld\n", max);
}
return 0;
}
2015年5月13日 星期三
2015年5月11日 星期一
安裝cmake與其相關套件東東
ubuntu 14.04:
apt-get install cmake flex libpciaccess-dev bison libx11-dev libxext-dev libxml2-dev libvdpau-dev
apt-get install build-essential -y
apt-get install doxygen
2015年3月24日 星期二
2015年3月14日 星期六
xeyes X11 connection rejected because of wrong authentication. Error: Can't open display: localhost:11.0
發現X11 connection有問題,原來是我變成"su"之後執行指令就產生以下訊息:
xeyes X11 connection rejected because of wrong authentication. Error: Can't open display: localhost:11.0
解法:
An easier solution follow as:
1.- ssh user@host
2.- $ sudo su
3.- # xauth merge /home/user/.Xauthority
xeyes X11 connection rejected because of wrong authentication. Error: Can't open display: localhost:11.0
解法:
An easier solution follow as:
1.- ssh user@host
2.- $ sudo su
3.- # xauth merge /home/user/.Xauthority
2015年1月13日 星期二
centos apache server python 網頁
在 /etc/httpd/conf/httpd.conf
寫 AddHandler cgi-script .cgi .py
寫 AddHandler cgi-script .cgi .py
service httpd restart
chmod 755 /var/www/cgi-bin/test.py
OK~
2014年11月4日 星期二
一些build new kernel的東東
http://people.cs.nctu.edu.tw/~chenwj/dokuwiki/doku.php?id=ubuntu
其中在ubuntu 12.04,若有改boot options,在/boot/grub/grub.cfg
改完要update-grub
其中在ubuntu 12.04,若有改boot options,在/boot/grub/grub.cfg
改完要update-grub
2014年11月3日 星期一
virtGL筆記
with apt-get:
freeglut3.dev
pkg-config
libpixman-1-dev
libasound2-dev
libssl-dev
libxrandr-dev
libxfixes-dev
libxrender-dev
x11proto-core-dev
libjpeg62-dev
libsasl2-dev
libglib2.0-dev
libgl1-mesa-dev
libnss3-dev
g++
apt-get install build-essential
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
apt-get install vncviewer
wget https://launchpad.net/~dev-zero/+archive/ubuntu/spice/+files/libcelt051_0.5.1.3-2_amd64.deb
wget https://launchpad.net/~dev-zero/+archive/ubuntu/spice/+files/libcelt051-dev_0.5.1.3-2_amd64.deb
wget http://www.spice-space.org/download/libcacard/libcacard-0.1.2.tar.gz
wget https://launchpad.net/ubuntu/+archive/primary/+files/python-pyparsing_2.0.3%2Bdfsg1-1_all.deb
dpkg -i libcelt051_0.5.1.3-2_amd64.deb
dpkg -i libcelt051-dev_0.5.1.3-2_amd64.deb
dpkg -i python-pyparsing_2.0.3+dfsg1-1_all.deb
tar zxvf libcacard-0.1.2.tar.gz
cd libcacard-0.1.2
./configure
make
make install
======
////////////////////
at spice/git/spice
chmod 777 configure
./configure
make
make install
////////////////////
////////////////////
at spice/git/spice/spice-protocol
chmod 777 configure
./configure
make
make install
////////////////////
//////////////////
at spice/git/spice/spice-common
./configure
make
make install
//////////////////
at spice/git/qemu/
git checkout hw/{qxl,qxl-logger,qxl-render}.c
chmod 777 configure
./configure --target-list=x86_64-softmmu --enable-opengl --enable-spice --extra-ldflags="-lm -lrt -lX11" --disable-docs --disable-werror --disable-libiscsi
modify Makefile.target : LIBS+=-lm -> LIBS+=-lm -lGL -lGLU -lglut -lX11
make clean
make
make install
============
crete vm:
qemu-img create -f qcow2 ex.qcow2 10G
edit: /etc/bash.bashrc
export LD_LIBRARY_PATH=/usr/local/lib
wget http://old-releases.ubuntu.com/releases/11.10/ubuntu-11.10-alternate-amd64.iso
=================
執行了:
qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -cdrom ubuntu-11.10-alternate-amd64.iso -boot d -vga qxl -spice port=5901,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent
connect:
spicec -h 127.0.0.1 -p 5901
spice連太慢的話改這個:
qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -cdrom ubuntu-11.10-alternate-amd64.iso -boot d -vga qxl -vnc :5,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent
connect:
vncviewer :5905
=====================
開guest:
/home/sslab719/virtgl/spice/git/qemu/x86_64-softmmu/qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -boot d -vga qxl -spice port=5901,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent -net user,hostfwd=tcp::10022-:22 -net nic
進去guest改sources.list (https://coderwall.com/p/3n6xka/fix-apt-on-old-unsupported-ubuntu-releases )
replace /etc/apt/sources.list:
deb http://old-releases.ubuntu.com/ubuntu/ oneiric main
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/
————————————
sudo apt-get update
sudo apt-get upgrade
————————————
Guest:
kernel 3.0.0.12 (ex. ubuntu 11.10)
package:
officail spice protocol :http://www.spice-space.org/download.html
apt-get
xserver-xorg-video-qxl
freeglut3.dev
xorg-dev
/virtgl/guest/virtio/virtio-gl.c
add #define VIRTIO_ID_OPENGL 10
/virtgl/guest/virtio/
make
make install
use dmesg check virtio-gl module major id
modify makefile to fit the nod id into virtio-gl's major id
make nod
virtgl/guest/gl
make
make run #test glxgears
標籤:
Linux,
Virtualization
訂閱:
文章 (Atom)