顯示具有 unix 標籤的文章。 顯示所有文章
顯示具有 unix 標籤的文章。 顯示所有文章

2014-08-07

[設定]在VMWare中的Debian wheezy要如何啟動3D加速?

最近常常需要雙開Windows跟Linux來開發程式,考量到Windows會用到一些要求效能以及很會吃記憶體的工具,於是決定用Windows做為Host OS,而讓Linux做為VMWare中的Guest OS。
個人以往在VMWare中安裝Ubuntu是沒有什麼問題,只要裝好VMWare tools就可以讓Ubuntu直接享受到最完善的硬體加速,連3D加速的桌面環境都能順暢運作。
但是最近在VMWare中安裝Debian 7 (wheezy)時卻碰到Gnome 3桌面環境不能啟用的問題,原因是在VMWare中,Debian預帶的video driver不能提供Gnome 3需要的3D加速功能。
花了一些時間拜求Google大神,終於在這個blog文章的下方推文找到了最簡單的解決方法。
在這邊簡單敘述解決步驟。

打開任何你習慣使用的terminal,並依序執行下列指令:
sudo apt-get install libxatracker-dev
sudo apt-get build-dep xserver-xorg-video-vmware

apt-get source xserver-xorg-video-vmware -b
sudo dpkg -i xserver*.deb
rm -rf xserver*

重開機後就可以享受Gnome 3的華麗UI介面了!

2014-07-28

[工具]在泛Debian系的Linux中更新certificate檔

沒想到Linux的方便性也是在日益進化的......

如果要在泛Debian系(例如Debian,Ubuntu)的Linux中更新certificate檔,其實很簡單。只要我們執行一下update-ca-certificates這個工具,它就能幫你搞定所有細節了。

許細做法如下:
先取得root權限,把領到的*.crt檔丟到
/usr/local/share/ca-certificates
再用root權限執行
update-ca-certificates
之後連到那些需要用指定的certificate檔才能連立SSL連線的server時,就不會再跳出錯誤訊息了。

2011-03-10

[Tip]Fix crap gcin in Ubuntu 10.04

If your gcin is crap (couldn't input any Chinese character) while using any Qt based program in Ubuntu 10.04, you could fix gcin after you did the following step:
1. execute
sudo apt-get autoremove gcin gcin-qt3-immodule gcin-qt4-immodule
2. add this to /etc/apt/sources.list
# gcin from ubuntu-tw
# refer to http://wiki.ubuntu-tw.orig/index.php?title=Gcin
deb http://debian.luna.com.tw/lucid ./
deb-src http://debian.luna.com.tw/lucid ./
3. execute
sudo apt-get update
4. execute
sudo apt-get install gcin gcin-qt3-immodule gcin-qt4-immodule

That's all, folks!

2011-02-21

[Tip]make vim copy and paste string with global clipboard.

First, we should make sure vim support clipboard feature by:
vim --version
We will see "+clipboard" if it support global clipboard.
Otherwise, we should install this debian package "vim-gnome" to make vim support global clipboard.

After we get global-clipboard-enabled vim, we should modify "~/.vimrc" and add this line:
set clipboard=unnamed
Then vim will copy and paste string with global clipboard.

2010-11-23

[Tip]enable MP3, MPEG4, AAC, and other restricted encoders in FFmpeg

Because of licenses difference between FFmpeg and libfaac/libmp3lame/etc, the offical FFmpeg doesn't support MP3, MPEG4, AAC, and other restricted encoders. However, we could make FFmpeg support these encoders by installing modified packages from third-party repository.

Medibuntu is a third-party repository that contains packages that are unable to be included in the official Ubuntu repositories. We can install modified libavcodec-extra-52 from them.

First, change repository settings:
sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update

Second, apt-get install libavcodec-extra-52 again:
sudo apt-get install ffmpeg libavcodec-extra-52

Then we are able to use the below command to compress any video file to mp4 with avc/aac stream inside.
ffmpeg -i input.file -acodec libfaac -ab 128k -vcodec libx264 -vpre default -crf 15 -threads 0 output_file.mp4

By the way, we could remove Medibuntu repository:
sudo apt-get autoremove ffmpeg medibuntu-keyring && sudo rm /etc/apt/sources.list.d/medibuntu.list && sudo apt-get update
But I suggest that you should remove modified libavcodec-extra-52 before restoring repository settings to default state.

2010-08-17

[Tip]escape shell metacharacters

There is an efficient method to make arbitrary string to escape shell metacharacters while using single-quote('). That is, just suspend a string by ('), add(\'), then continue the string by (').

For example, in Python:
def escapeShellArg(string):
    return u"'"+string.replace(u"'",u"'\\''")+u"'"
This is because UNIX shell explain
testcmd 'test'\''string'
as
testcmd "test'string"
Besides, program testcmd will receive argv=["testcmd","test'string"]. Thus, we could efficiently escape shell metacharacters without regular expression library or other complex string processing library.