擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Mar-10-10

vim - Scrolling around

posted by Thomas

請自己記住

很基本,但常常忘記,都浪費很多時間up/down

應該用 CTRL+E / CTRL+Y 取代 或是 zz 也不錯!

自勉之…

http://vimdoc.sourceforge.net/htmldoc/usr_03.html

*03.7*	Scrolling around

The CTRL-U command scrolls down half a screen of text.  Think of looking
through a viewing window at the text and moving this window up by half the
height of the window.  Thus the window moves up over the text, which is
backward in the file.  Don't worry if you have a little trouble remembering
which end is up.  Most users have the same problem.
   The CTRL-D command moves the viewing window down half a screen in the file,
thus scrolls the text up half a screen.

				       +----------------+
				       | some text	|
				       | some text	|
				       | some text	|
	+---------------+	       | some text	|
	| some text	|  CTRL-U  --> |		|
	|		|	       | 123456		|
	| 123456	|	       +----------------+
	| 7890		|
	|		|	       +----------------+
	| example	|  CTRL-D -->  | 7890		|
	+---------------+	       |		|
				       | example	|
				       | example	|
				       | example	|
				       | example	|
				       +----------------+

To scroll one line at a time use CTRL-E (scroll up) and CTRL-Y (scroll down).
Think of CTRL-E to give you one line Extra.  (If you use MS-Windows compatible
key mappings CTRL-Y will redo a change instead of scroll.)

To scroll forward by a whole screen (except for two lines) use CTRL-F.  The
other way is backward, CTRL-B is the command to use.  Fortunately CTRL-F is
Forward and CTRL-B is Backward, that's easy to remember.

A common issue is that after moving down many lines with "j" your cursor is at
the bottom of the screen.  You would like to see the context of the line with
the cursor.  That's done with the "zz" command.

	+------------------+		 +------------------+
	| some text	   |		 | some text	    |
	| some text	   |		 | some text	    |
	| some text	   |		 | some text	    |
	| some text	   |   zz  -->	 | line with cursor |
	| some text	   |		 | some text	    |
	| some text	   |		 | some text	    |
	| line with cursor |		 | some text	    |
	+------------------+		 +------------------+

The "zt" command puts the cursor line at the top, "zb" at the bottom.  There
are a few more scrolling commands, see |Q_sc|.  To always keep a few lines of
context around the cursor, use the 'scrolloff' option.
Tags:
Mar-2-10

git buildpackage 的用法

posted by Thomas

基本作法:

Init 抓git repository

git clone git://server/prohect.git

建branch 叫作 upstream(ref /etc/git-buildpackage/gbp.conf)

git branch -m master upstream

切回master

git branch master

git checkout master

之後要update

git checkout upstream

git pull

git checkout master

git merge upstream

執行

git-buildpackage

正常情況可以忽略 signkey 然後 build 出 deb

如果要sign tag or something…

建議修改設定檔

ex:

~/.gitconfig

[user]
name = Thomas Tsai
email = thomas@nchc.org.tw
signingkey = 12345678

~/.gbp.conf

[DEFAULT]
# the default build command:
builder = debuild -i\.git/ -I.git -k0×46379ACF
[git-buildpackage]
sign-tags = True
keyid = 0×46379ACF
export-dir = ../download/export/
tarball-dir = ../download/testing/src/
ignore-new = True
參考:http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.man.git.buildpackage.html

參考:http://blog.rmi.twbbs.org/2010/01/gitdebian-packaging-desmume.html

Tags:
Mar-2-10

設定 git protocol

posted by Thomas

設定 Public GIT 服務

git 實作紀錄 之後,愈用愈順手,所以也開了 git 的服務

Server:
apt-get install git-daemon-run
vi /etc/sv/git-daemon-run/run
exec git-daemon –verbose –base-path=$git_path –export-all
sv restart git-daemon

Client
git clone git://$server_ip/project.git

done!

Tags:

Thomas log :

Vmware host - nfs server

apt-get install nfs-kernel-server

vi /etc/exports

/home/partimag     172.16.0.0/16(rw,sync,no_root_squash,no_subtree_check,insecure)
/home/partimag     127.0.0.1(rw,sync,no_root_squash,no_subtree_check,insecure)

service portmap restart

service nfs-kernel-server restart

—-

Vmware guest(NAT) - nfs client

test mount:

mount 172.16.7.2/home/partimag/ /mnt

Tags:

最近剛好有台 apple macbook 想要換大硬碟,這邊 有些很經典的作法,但是我希望用些不一樣的方式,想當然就是用 clonezilla。目前 Clonezilla 可以備份 apple 的電腦,所以想要直接硬幹(Linux, windows 大部份都會自動resize),但是 osx 不能自動 resize, 因為沒有 tool 可以用;無所謂,那就用 osx 自己的 diskutils 去做 resize。

硬幹的結果就是 resize fail,相似的問題,類似這樣…

http://ubuntuforums.org/showthread.php?t=760190

MediaKit reports partition (map) too small
也就是說把硬碟直接對考,之後 resize 會有錯誤,因為 GPT (clonezilla 用 dd 的方式備份) 已經認定硬碟大小,之後用diskutils去拉大、或是新增磁區、甚至是任何變動都會失敗,真是爛到不行。
正確的作法應該是利用gdisk去產生正確的GPT表:
Backup 備份時:
先用 gdisk 備份 GPT  // GPT backup with gdisk
root@T17:/home/thomas/Desktop# gdisk /dev/sdd
GPT fdisk (gdisk) version 0.6.3

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): b
Enter backup filename to save: backup
The operation has completed successfully.

Command (? for help): q
root@T17:/home/thomas/Desktop#

備份 partition // clone partition with partclone
ocs-live ….

Restore 還原時:
用 gdisk 還原 GPT // Restore GPT with gdisk
gdisk /dev/sddd
r
Recovery/transformation command (? for help): l
Enter backup filename to load: gpt-backup
Warning! Current disk size doesn’t match that of the backup!
Adjusting sizes to match, but subsequent problems are possible!

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed, possibly destroying your data? (Y/N):

OK; writing new GUID partition table (GPT).
The operation has completed successfully.
root@T17:/home/thomas/Desktop# gdisk -l /dev/sdd
GPT fdisk (gdisk) version 0.6.3

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdd: 625142448 sectors, 298.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E75560D0-CBAA-4DC8-9515-967D8A397616
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 625142414
Total free space is 312822797 sectors (149.2 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
1              40          409639   200.0 MiB   EF00  EFI System Partition
2          409640       312319623   148.7 GiB   AF00  Apple_HFS_Untitled_1

還原 partition // restore partition with partclone
ocs-live …

之後可以開機使用 osx diskutils 工具,直接拉開就可以resize!

then, osx diskutils to enlarge or add partition successfully.
一些好玩的資料:
什麼是GPT WIKI 有說明
APPLE OSX 電腦磁區切割的秘密 (Partitioning Policy)
第一個EFI分割區的用途
UEFI 是啥?(定義)
結論與疑問:
1. 如果要手動增加osx partition 必須依照 osx Partition Policy 才行??
2. EFI 磁區用 FAT 的方式備份,不一定成功,目前成功應該是因為APPLE還沒有在用??