Friday, September 14, 2012

Hackintosh T420

1. U盘制作
参看这里,首先下载X-Flash。
然后将X-Flash复制到桌面,双击打开安装程序,使其在桌面展开。最后将格式化成HFS+日志系统的U盘拖入X-Flash图标即可。最后可以美化一下,右击U盘点 get info 然后把安装程序里面的狮子图标拖动到U盘信息的左上角。


当然,最后需要替换OSIstall。
替换 mac安装盘目录System/Library/PrivateFrameworks/Install.framework/Frameworks/OSInstall.framework/Versions/A/里的osinstall。

替换mac安装盘目录System/Installation/Packages 里的 osinstall.mpkg

2. FakeSMC设定参看这里。

3. HD3000可参看这里。
HD3000花屏还可以试试添加EDID,以及display注入。参看这里。

4. 电源管理补丁

5. HD3000 集显的机器 显卡id0126 按道理能够直驱的。
但是-v时出现
SNB Framebuffer did not show up
然后跳2下可以进入系统,但是显卡没驱动不能改分辨率,显示显存64M。

如果出现以上情况可以试试,查看
/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/info.plist
找到如下内容
01168086 01268086
在前面添加 0x
然后修复权限,重建缓存试试。
我的改过之后就成功驱动了。

6. RTC补丁解决BIOS重置
终端输入

sudo perl -pi -e 's|\x75\x30\x89\xd8|\xeb\x30\x89\xd8|' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC

7. 解决 Transcript Offline - Buffer Pool Allocate [181000] failed
1. 打开 AppleIntelSNBGraphicsFB 里面 info 文件,将“FBCControl”-“Compression”的值改为‘1’,将“FeatureControl”里面的"FBC"的值改为‘1’,将“FBClientController”栏全部内容删除;

2. 打开 AppleIntelHD3000Graphics 里面 info 文件,IOKitPersonalities 下面Gen6 下面 VRAMMethod 和 VRAMOverride 两项删除。保存后修复权限重建缓存,重启错误解决。


8. 解决smc更新提示
以我的本本为例,和MacBook Pro 8,1的配置比较接近,SMBIOS.plist为MacBook Pro 8,1

到http://support.apple.com/kb/HT1237?locale=zh_CN去查看你对应机型的SMC版本和Boot Rom版本并记下来

1、将你的SMBIOS.plist里面的SMbiosversion字段的值的前面部分修改成和Boot Rom版本一致。比如的MacBook Pro 8,1最新的的Boot Rom版本是MBP81.88Z.0047.B27,则修改SMbiosversion字段的值为MBP81.88Z.0047.B27.1104221557;

2、将你的FakeSMC.kext里面的Info.plist的REV值修改成和SMC版本一致,方法参考【變色龍系列三】FakeSMC.kext 設定說明【08/05】。比如MacBook Pro 8,1最新的SMC版本是1.68f98,则rev值为AWgPAACY。

修改好之后保存重启,这两个更新就不在了,其他机型以此类推。
相关dsdt ssdt 以及驱动:

Read more ...

Install TEX/LATEX in Mac OS X

1. Install MacTex based on Texlive.
Download MacTex from here.
or you can also install from MacPorts.

sudo port install texlive
sudo port install texlive-latex-extra

You can see the list of  texlive ports here. Around 99% of the packages are included in texlive-latex-extra.

2. Use Emacs as an editor.

You can down emacs for mac from here.
or install from macports:
sudo port install emacs-app +fullscreen

If you want to use emacs to edit tex file, you have to install auctex or aquamacs.
For installing aquamacs, you can see here.

I am using auctex.

2.1 Download auctex from here.

2.2 Install

./configure --with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local

instead this by: (if you used macports)
./configure --with-emacs=/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/MacPorts/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local


in OS X 10.11, if u installed the texlive via macports, the texmf-local location is changed to
/opt/local/share/texmf-local

make

sudo make install

Before do this, maybe you have to install make
go to Xcode Preferences, install Command Line Tools in Downloads.

2.3 load auctex
edit your ~/.emacs
put following in.

(setenv "PATH" (concat "/usr/texbin:/usr/local/bin:" (getenv "PATH")))
(setq exec-path (append '("/usr/texbin" "/usr/local/bin") exec-path))
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

P.S.
If you want to swap CTRL and CAPS LOCK

Go into System Preferences, Enter the Keyboard & Mouse preference pane, In the Keyboard tab, click Modifier Keys... Swap the actions for Caps Lock and Control.

If you want to use option as META

In the menu bar, click Terminal, Click Preferences... Under the Settings tab, go to the Keyboard tab, Check the box labeled Use option as meta key.

Read more ...

Add Color to the Terminal in Mac OS X

This post is from here.


Adding colorized ls output to the Terminal in Mac OS X is a good way to make navigating around the command line a bit easier on the eyes.

We’ll cover a customizable setting, and you can get a preview of color ls output by typing “ls -G” at the command line. The preview with ls -G will depend on the Terminals color settings and won’t necessarily represent the colors shown below, however.

Open Terminal and type: nano .bash_profile

Use the arrow keys to navigate to the bottom of the document and paste in either of the blocks of text below, depending on the terminals appearance (see man entry below for further customizations)

Colors for Dark Terminal Themes:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced




Colors for Light Terminal Themes:

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad




After the strings are pasted into .bash_profile confirm that it looks something like this in nano:



Hit Control+O to save and open a new Terminal window
Type "ls" or "ls -la" to confirm the colorized output

This will work with Mac OS X 10.6, OS X 10.7, and OS X 10.8, as long as you are using the bash shell. If you aren't certain what shell you are using, look in the Terminal window titlebar for "bash", or you can check with the following command:

echo $SHELL

The output will be "/bin/bash" if it's bash, and something else if not.

Don't forget that you can also change the appearance of Terminal windows instantly and change the Terminal wallpaper too.

Customizing LSCOLORS Manually

If the above color choices weren't doing it for you, you can set whatever you want. Here's the manual page on LSCOLORS if you want to give it a shot. The default is "exfxcxdxbxegedabagacad" but clearing out the .bash_profile color entry will remove any hideous color combinations too.

LSCOLORS The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.

The color designators are as follows:

a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background


Note that the above are standard ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use.

The order of the attributes are as follows:

1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky bit


The default is "exfxcxdxbxegedabagacad", i.e. blue foreground and default background for regular directories, black foreground and red background for setuid executables, etc.
Read more ...

Make an alias in Mac OS X shell

1.
nano ~/.bash_profile

add you alias like following

alias l='ls -lah'

then run source ~/.bash_profile in terminal.

2.
nano /etc/profile (for a normal user)
nano ~/.profile (for a root/su do)

Add your alias like so to the file:
alias aliasname='mycommand /path/path'
(notice no space between equal sign and ')

Load/reload your profile with:
. /etc/profile
...or for root/superuser do:
. ~/.profile
Read more ...

Thursday, August 30, 2012

The ps Command

This post is from here.



The ps (i.e., process status) command is used to provide information about the currently running processes, including their process identification numbers (PIDs).
A process, also referred to as a task, is an executing (i.e., running) instance of a program. Every process is assigned a unique PID by the system.
The basic syntax of ps is
ps [options]
When ps is used without any options, it sends to standard output, which is the display monitor by default, four items of information for at least two processes currently on the system: the shell and ps. A shell is a program that provides the traditional, text-only user interface in Unix-like operating systems for issuing commands and interacting with the system, and it is bash by default on Linux. ps itself is a process and it dies (i.e., is terminated) as soon as its output is displayed.
The four items are labeled PID, TTY, TIME and CMD. TIME is the amount of CPU (central processing unit) time in minutes and seconds that the process has been running. CMD is the name of the command that launched the process.
TTY (which now stands for terminal type but originally stood for teletype) is the name of the console or terminal (i.e., combination of monitor and keyboard) that the user logged into, which can also be found by using the tty command. This information is generally only useful on a multi-user network.
A common and convenient way of using ps to obtain much more complete information about the processes currently on the system is to use the following:
ps -aux | less
The -a option tells ps to list the processes of all users on the system rather than just those of the current user, with the exception of group leaders and processes not associated with a terminal. A group leader is the first member of a group of related processes.
The -u option tells ps to provide detailed information about each process. The -x option adds to the list processes that have no controlling terminal, such as daemons, which are programs that are launched during booting (i.e., computer startup) and run unobtrusively in the background until they are activated by a particular event or condition.
As the list of processes can be quite long and occupy more than a single screen, the output of ps -aux can be piped (i.e., transferred) to the less command, which lets it be viewed one screenful at a time. The output can be advanced one screen forward by pressing the SPACE bar and one screen backward by pressing the b key.
Among the information that ps -aux provides about each process is the user of the process, the PID, the percentage of CPU used by the process, the percentage of memory used by the process, VSZ (virtual size in kilobytes), RSS (real memory size or resident set size in 1024 byte units), STAT (the process state code), the starting time of the process, the length of time the process has been active and the command that initiated the process. The process state codes include D, uninterruptable sleep; N, low priority; R, runnable (on run queue); S, sleeping; T, traced or stopped; Z, defunct (zombie).
In contrast to most commands, the hyphen preceding ps's options is optional, not mandatory. Thus, the following could be (and sometimes is) used in place of the above command:
ps aux | less
An alternative set of options for viewing all the processes running on a system is
ps -ef | less
The -e option generates a list of information about every process currently running. The -f option generates a listing that contains fewer items of information for each process than the -l option.
Among the columns displayed by ps -ef, UID contains the username of the account that owns the process (which is usually the same user that started the process) and STIME displays the time the process started, or the starting date if it started more than 24 hours ago.
The processes shown by ps can be limited to those belonging to any given user by piping the output through grep, a filter that is used for searching text. For example, processes belonging to a user with a username adam can be displayed with the following:
ps -ef | grep adam
The -l option generates a long listing, and when used together with the -e and -f options creates a table with 15 columns:
ps -efl
The additional columns of most interest are NI and SZ. The former shows the nice value of the process, which determines the priority of the process. The higher the value, the lower the priority. The default nice value is 0 on Linux systems.
The latter displays the size of the process in memory. The value of the field is the number of pages the process is occupying. On Linux systems a page is 4,096 bytes.
ps is most often used to obtain the PID of a malfunctioning process in order to terminate it with the kill command. For example, if the PID of a frozen or crashed program is found to be 1125, the following can usually terminate the process:
kill 1125
ps -ef or ps -efl can then be used to confirm that the process really has stopped. If it has not, then the more forceful -9 option should be used, i.e.,
kill -9 1125
The pstree command is similar to ps in that it can be used to show all of the processes on the system along with their PIDs. However, it differs in that it presents its output in a tree diagram that shows how processes are related to each other and in that it provides less detailed information about each process than does ps.
Read more ...

Monday, August 13, 2012

Friday, August 10, 2012

Mac OS X 下修改机器名和主机名

This post is from here.


修改主机名和计算机名
sudo scutil --set HostName NewName
sudo scutil --set ComputerName NewName

修改终端提示符
vi ~/.profile
添加
export PS1="[\u@\h \W]\$ "
Read more ...

Wednesday, August 1, 2012

Ubuntu下WebQQ桌面化

This post is from here.


sudo add-apt-repository ppa:loneowais/fogger
sudo apt-get update
sudo apt-get install  fogger

然后可以搜索 fogger 打开程序,添加WEBQQ即可。

但是中文提示可能是乱码。
可以参考这里修改:


修改方式如下:

打开终端执行: sudo vim /opt/extras.Ubuntu.com/fogger/fogger/AppWindow.py  (vim不熟悉可以使用gedit,前面带行号)

22 import re         #22行加上该句

252 def unescape(self,url):
253     def repl(mobj):
254          try:
255              return unichr(int(mobj.group(0)[2:],16))
256          except:
257              return mobj.group(0)
258      return re.sub(‘%u[0-9a-fA-F]{4}’,repl,url)
259
260 def on_resource_request_starting(self, widget, frame, resource, request, response, data=None):
261      uri = urllib.unquote(request.props.uri)
262      uri = self.unescape(uri)
263      if uri.startswith(‘http://fogger.local/’):
264          request.props.uri = ‘about:blank’

因为是python代码,请严格按照四个空格键进行缩进,如果使用(tab)键有可能为制表符,这样严重影响代码运行。

修改好的脚本下载:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2012年资料/7月/31日/Ubuntu下WebQQ桌面化替代方案完美版/

如果修改麻烦,可以下载后执行sudo cp  -f AppWindow.py  /opt/extras.Ubuntu.com/fogger/fogger/AppWindow.py 即可。
Read more ...

Wednesday, July 25, 2012

配置 Ubuntu 12.04

首先安装 ubuntu-restricted-extras


sudo apt-get install ubuntu-restricted-extras


>> qq

sudo add-apt-repository ppa:lainme/libqq
sudo apt-get update
sudo apt-get install libqq-pidgin

empathy 里面就有qq了。
或者看这里。


>> stardict

sudo apt-get install stardict

词典。


>> trash


click here.

>> Ubuntu在顶部面板显示系统状态条

click here.

>> ubuntu tweak


click here.

>> mac thema


click here.

>> 修改grub参数


click here.

>> proxy setting


click here.


>> 解决 ibus 输入法图标


启动项加入
ibus-daemon -r -d -x


>> fix graphics unknown


sudo apt-get install mesa-utils


>> Fixing Google Chrome's 100% CPU Usage on Ubuntu


sudo apt-get install m4


or click here.


>> BIOS不能屏蔽显卡的


显卡切换:终端sudo su
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
第一句是切换到集成显卡;
第二句是关闭没有连接的显卡;
此时独显指示灯熄灭。
然后把这两句加入到/etc/rc.local文件里的exit 0之前保存;以便开机时自动运行。


>> indicators


link1; link2


>> 无线网络不稳定


更换network-manager:


sudo apt-get install wicd


连接好网络后,


sudo apt-get remove network-manager
注意先后顺序。


>> Psensor



Psensor 是一个监控硬件温度的工具,并且与Unity很好的整合在一起,支持使用桌面通知系统高温报警,拥有应用程序指示器。

支持监控以下硬件温度:

主板和CPU温度
Nvidia GPU温度
实验性ATI/AMD GPUs温度监控,Ubuntu PPA中未启用。
硬盘温度
风扇转速
CPU使用率


首先安装监控cpu 主板 风扇等需要的包:


sudo apt-get install lm-sensors hddtemp
sudo sensors-detect
回复"yes"即可。
重启或通过以下命令加载 sensor需要的模块。
sudo service module-init-tools start
sudo apt-get install psensor


或者通过stable PPA安装


sudo add-apt-repository ppa:jfi/ppa 
sudo apt-get update 
sudo apt-get install psensor


另外还有个unstable Ubuntu PPA,可能会有bug


sudo add-apt-repository ppa:jfi/psensor-unstable 
sudo apt-get update 
sudo apt-get install psensor

>> 美化 terminal


link1; link2


emacs -nw .bashrc


在最后添加试试。


PS1="\[\033[0;32m\]├ \[\033[0;33m\]\d\[\033[0;32m\] ┼ \[\033[0;33m\]\t\[\033[0;32m\] ┼ \[\033[0;36m\]\u\[\033[0;32m\] ┼ \[\033[0;36m\]\h\[\033[0;32m\] ┼ \[\033[0;35m\]\w\[\0\
   33[0;32m\] ┤ \n\[\033[0;31m\]\$\[\033[0;32m\] >> \[\033[0m\]"


>> Install Jupiter


sudo add-apt-repository ppa:webupd8team/jupiter
sudo apt-get update
sudo apt-get install jupiter


>> install Unity Window Quicklists


sudo apt-add-repository ppa:alanbell/unity
sudo apt-get update
sudo apt-get install unity-window-quicklists


There's a bug with the autostart .desktop file and Unity Window Quicklists doesn't start automatically on login, so let's fix it:


sudo sed -i 's/OnlyShowIn=UNITY/OnlyShowIn=Unity/g' /etc/xdg/autostart/unity-window-quicklists.desktop


>> indicator-cpufreq


click here.


>> 让Ubuntu支持CPU动态调频


click here.

Read more ...

use byobu instead of terminal in ubuntu

sudo apt-get install byobu

byobu-tmux

press F9 to get help.


Read more ...

PPT in shell

Download tpp from here.

tar zxvf tpp-1.3.1.tar.gz

We have to install ruby firstly.

sudo apt-get install ruby ruby-dev

and we also need ncurses-ruby.

tar jxf ncurses-ruby-1.3.0.tar.bz2
cd ncurses-ruby-1.3.0
ruby extconf.rb

If we get error like this,

checking for unistd.h... yes
checking for locale.h... yes
checking for ncurses.h... no
checking for ncurses/curses.h... no
checking for curses.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
extconf.rb:38: ncurses header file not found (RuntimeError)

then,

sudo apt-get libncurses5-dev

then run
make
sudo make install

then
cd tpp-1.3.1
sudo make install

now tpp are completely installed.
try it.

tpp example.tpp


if you want to have huge text printed

sudo apt-get install figlet


example:

Read more ...

Friday, July 20, 2012

德语 zu 的用法

This post is from here.


um…zu的目的不定式结构

um…zu的目的不定式结构在句中作目的状语,意为“为了……”。目的不定式结构中不能出现主语,其动作主体应该同主句主语一致。目的不定式结构可放在句首、句中或句末,并用逗号将前后句分开。提问用wozu,warum或zu welchem Zweck, mit welcher Absicht
Viele Deutsche fahren gern mit dem Fahrrad, um gesund zu bleiben.
Wozu fahren viele Deutsche gern Fahrrad?
注意:
1. zu位于动词不定式之前,如动词是分离动词,则zu位于两者之间,并连写,例如:
ich gehe zum Bahnhof, um meine Großmutter abzuholen.
2. 目的不定式结构放在句首,主句用反语序,也就是,紧跟的是可变位动词;目的不定式结构放在主句后,主句用正语序:
Um gesund zu bleiben, fahren viele Deutsche Rad.
Viele Deutsche fahren Rad, um gesund zu bleiben.
3. 目的不定式假设主语同主句主语不一致时,用damit目的从句,如:
Herr Li gibt seinem Sohn 100 Yuan, damit er (der Sohn) das Englischwörterbuch kauft.
李先生给他儿子100元钱,以便他儿子买一本 英语 字典。
带zu的不定式作宾语和作名词的定语
带zu不定式可作部分动词的宾语和部分名词的定语,它一般放在句尾和被修饰的定语之后。“zu”位于动词不定式前面。如遇可分动词,则放在可分动词中间并连写。带“zu”的不定式用逗号同主句分开,但在简单不定式前则不必加逗号。
1. 作一部分及物动词的宾语,如versuchen, vergessen
versuchen--> Versuch doch bitte, für mich ein paar Kinokarten für morgen Abend zu besorgen!
vergessen--> Ich habe vergessen, Ihnen Bescheid zu sagen, dass wir morgen keinen Deutschunterricht haben.
2. 作部分动词的介词宾语,如bitten, helfen
Sie bittet ihn (darum),morgen Abend zusammen ins Kino zu gehen.
3. 作名词宾语,如zeit, Lust, Chance, Gelegenheit, Wunsch, Absicht, Geld
Zeit--> Ich habe Zeit, dir beim Umzug zu helfen.
Lust--> Sie hat Lust, mit ihm ins Kino zu gehen.
Chance--> Wir haben gute Chance, ins Ausland zu gehen.
Gelegenheit--> Sie hat keine Gelegenheit, uns ihre Meinung zu sagen.
Wunsch--> Das Kind hat den Wunsch, einen PC zum Geburtstag zu bekommen.
Absicht--> Herr Zhang hat keine Absicht, die Wohnung zu verkaufen.
Geld--> Wir haben kein Geld, ein Auto zu kaufen.
4. 带zu不定式作主语
Es ist gut, Deutsch zu lernen.
Es ist schön, jetzt nach Hause yu gehen.
was ist schön?
同位语
同位语在句子中可以以第一、第二、第三、第四格的形式出现,它的性、数、格与同位名词相同。
N. Herr Li, ein guter Lehrer, gibt uns Unterricht.
G. Das ist das Arbeitszimmer meines Freundes, eines guten Technikers.
D. Der löwenwirt stritt oft mit seinem Nachbarn, dem Bärenwirt.
A. Gestern habe ich meine Freundin, eine deutsche Studentin aus München.
Read more ...