in default terminal of mac osx
Attention: cp file1/ file2/
will copy the files in file1 to file2, rather than the folder file1
----------------------------------------------------------------------------------------------------------------------------------------
disk partition:
using "disk utility" in folder "Utilities". At first waiting for disk partition for a long time and force quit then try again and seceed.
----------------------------------------------------------------------------------------------------------------------------------------
install following software:
MS office 2008 ,Adobe professional, stardict, mathematica, fink in order to install unix and deb software, Macports, MacTex, gnuplot, xcode from apple, gfortran
Fun input: good chinese input
Windows in Vmware fusion
----------------------------------------------------------------------------------------------------------------------------------------
install gnome-terminal
1. download and install darwinports.
2.sudo port -d selfupdate
3.do as this link:
cd /opt/local/bin/portslocation/dports/gnome-terminal
sudo port install gnome-terminal
4. some info about gnome-terminal by the following cmd
man gnome-terminal
apropos gnome-terminal
which gnome-terminal
locate gnome-terminal
5.run gnome-terminal:
if there's an error about dbus, run the following cmd first.
6. put gnome-terminal on the Dock
a. Launch AppleScript (Applications > AppleScript > Script Editor)
b. Create the following script:
do shell script "/usr/bin/open -a X11 /opt/local/bin/gnome-terminal "
c. Save the script somewhere using “application” as the file format
d. 2xClick the new app and gnome-terminal will launch. If X11 has not been launched yet, this should launch X.
/opt/local/bin
launchctl load /Library/LaunchAgents/org.freedesktop.dbus-session.plist
gnome-terminal
----------------------------------------------------------------------------------------------------------------------------------------
7. install stardict dict
copy files to opt/gtk/share/stardict/dic/
----------------------------------------------------------------------------------------------------------------------------------------
8. mactex(texlive 2008) chinese fonts?
see the examples in /usr/local/texlive/2008/texmf-dist/doc/latex/cjk/examples and the readmefile
using cas thesis form? just copy cct folder in windows to "./texmf-local/tex/latex/cct", then texhash and mktexlsr.
utf8 for chinese fonts?
\usepackage{CJK}
\usepackage{latexsym,amsfonts,amsmath,amssymb,graphicx}
\begin{CJK*}{UTF8}{gbsn}
----------------------------------------------------------------------------------------------------------------------------------------
9.add ttf fonts to mactex?
a. make sure ttf2pt1 installed()
b. download mkfont.sh from
c. add fonts from this website.
----------------------------------------------------------------------------------------------------------------------------------------
10. Enable root user
1. From the Finder's Go menu, choose Utilities.
2. Open Directory Utility.
3. Click the lock in the Directory Utility window.
4. Enter an administrator account name and password, then click OK.
5. Choose Enable Root User from the "Edit" menu.
6. Enter the root password you wish to use in both the Password and Verify fields, then click OK.
----------------------------------------------------------------------------------------------------------------------------------------
11. install dos2unix by apt-get
----------------------------------------------------------------------------------------------------------------------------------------
12. vi 不显示行号和列号?
set ruler
----------------------------------------------------------------------------------------------------------------------------------------
13. windows file enter with ^M?
:% s/^M/\r/g
注意 ^M 的输入用? Ctrl+v,再按回车,或者是 Ctrl+v, Ctrl+m。
----------------------------------------------------------------------------------------------------------------------------------------
14. tab space during copy in vim
set paste
----------------------------------------------------------------------------------------------------------------------------------------
15. Windows Xp task manager in vmware fusion?
Ctrl+shift+ESC
----------------------------------------------------------------------------------------------------------------------------------------
16. texshop change between source code and pdf file
cmd+double of single click
----------------------------------------------------------------------------------------------------------------------------------------
17. open new finder?
right click finder ico in dock, then choose open new window
or hold cmd key while clicking the folder
----------------------------------------------------------------------------------------------------------------------------------------
18. firefox 3.1 undo?
shift+cmd+t
----------------------------------------------------------------------------------------------------------------------------------------
19. home and end shortcut
home: ctrl+a, end: ctrl+e
----------------------------------------------------------------------------------------------------------------------------------------
20. during use f95, following warning:
ld warning: duplicate dylib /usr/local/lib/libgcc_s.1.dylib
solution: delete this file, or remove this file
----------------------------------------------------------------------------------------------------------------------------------------
21. connect shared folder on windows.
finder->go->connect to server: smb://ipaddress
----------------------------------------------------------------------------------------------------------------------------------------
22. mplayer fonts:
copy simsun to Applications/MPlayer OS X 2.app/Contents/Resources/Fonts/simsun.ttf
----------------------------------------------------------------------------------------------------------------------------------------
23. missing fonts when opening doc file with word?
word-preference-compatibility->font substitution--
change the missing fonts with others.
----------------------------------------------------------------------------------------------------------------------------------------
24.Quick Look .eps files in Finder?
download:EPSQuickLookPlugin
----------------------------------------------------------------------------------------------------------------------------------------
25. install mysql+mediawiki
start mysql: sudo mysqld_safe --user=root
----------------------------------------------------------------------------------------------------------------------------------------
26. add luna calendar to icalendar
luna:%40holiday.calendar.google.com/public/basic.ics
holiday:
%40group.calendar.google.com/public/basic.ics
----------------------------------------------------------------------------------------------------------------------------------------
27. screen shot:
shift+cmd+3 full screen
shift+cmd+4 select area
----------------------------------------------------------------------------------------------------------------------------------------
28. dvi viewer and eps viewer
xdvi and preview
----------------------------------------------------------------------------------------------------------------------------------------
29. bash
get 1.f :basename /var/1.f
get /var: dirname
----------------------------------------------------------------------------------------------------------------------------------------
30.Changing the position of a pin on a Places map
You can change the position of a marker pin for a photo, even if the photo was taken with a GPS-enabled camera.
To change a pin’s position:
Select a photo that has a pin in the wrong position on the Places map.
Click the Information button in the lower-right corner.
This “flips” the photo so that you can enter information about it on the “back.”
Click the location name, and choose “Find on map” from the pop-up menu.
The Add New Place dialog appears.
Do one of the following:
Drag the pin on the map. You can click the plus and minus signs to zoom in or out, drag the map to center on the area you want, and then drag the marker pin to the right location. To place the pin more accurately, zoom in and drag it as needed.
Once the marker pin is in the right place, you can drag the circle arrow to adjust the vicinity.
In the search field, type as much of the full name and address as you can (for example, “123 Oak St., Lincoln, NE” or “The White House”), and then press the Return key.
The pin appears in that location. If you want to fine-tune the location, you can drag the marker pin to a desired spot. Drag the arrow on the circle to increase or decrease the vicinity covered by this location.
Click the “Assign to photo” button in the dialog when you’re finished.
Click Done in the dialog.
To see your photo in Places, select Places in the Source list.
----------------------------------------------------------------------------------------------------------------------------------------
31. connect to windows share folder
finder->go-->connect server
smb://ip
----------------------------------------------------------------------------------------------------------------------------------------
32. snippetsEmu : An attempt to emulate TextMate's snippet expansion
conflict with "set paste" in .vimrc
----------------------------------------------------------------------------------------------------------------------------------------
33. install xfig and dia by sudo port install xfig(dia)
----------------------------------------------------------------------------------------------------------------------------------------
34. vim: current row to n: :,+n balabala
----------------------------------------------------------------------------------------------------------------------------------------
35. move the icons on the taskbar by holding command key
----------------------------------------------------------------------------------------------------------------------------------------
36. Input equation in keynotes or other tools?
use Latexit installed from MacTex.
----------------------------------------------------------------------------------------------------------------------------------------
Quick look shortcut:
space open and close quicklook
----------------------------------------------------------------------------------------------------------------------------------------
37. 快捷键
在启动时按下 X: 强制使用 Mac OS X 启动电脑
在启动时按下 Option-Command-Shift-Delete: 不使用主要启动硬盘,并寻找使用外接磁盘与 CD
在启动时按下 C: 由具有系统文件夹的 CD 光盘启动
在启动时按下 N: 试图由兼容的网络服务器 (NetBoot) 启动
在启动时按下 T: 以火线目标磁盘方式启动
在启动时按下 Shift: Mac OS X 10.2 后,在「安全启动状态」启动,一切启动项目及不必要运行的核心扩展文件皆不运行
在启动时按下 Command-V: 以 Verbose 状态启动,将临时进入 UNIX 界面,短时不可使用鼠标
在启动时按下 Command-S: 以单一用户状态启动,将进入 UNIX 界面,不可使用鼠标
Finder 窗口
Command-W: 关闭窗口
Option-Command-W: 关闭一切窗口
Command-右方向箭头: 在列表中扩展文件夹内容
Option-Command-右方向箭头: 在列表中扩展此文件夹及一切下属文件夹内容
Command-左方向箭头: 在列表中缩闭文件夹内容
Option-Command-上方向箭头: 打开所述文件夹,并关闭现在窗口
菜单指令
Shift-Command-Q (苹果菜单): 登出用户
Shift-Option-Command-Q (苹果菜单): 立即登出用户
Shift-Command-Delete (Finder 菜单): 倾倒废纸篓
Option-Shift-Command-Delete (Finder 菜单): 倾倒废纸篓,而不需要经由确认对话框确定
Command-H (Finder 菜单): 菜单隐藏 Finder
Option-Command-H (Finder 菜单): 隐藏其他应用程序
Command-N: 在 Finder 中由文件菜单开启新 Finder 窗口
Shift-Command-N: 在 Finder 中由文件菜单创建新文件夹
Command-O (文件菜单): 打开文件
Command-S (文件菜单): 保存资料
Shift-Command-S (文件菜单): 保存资料,名称由用户输入
Command-P (文件菜单): 打印
Command-W (文件菜单): 关闭窗口
Option-Command-W (文件菜单): 关闭一切窗口
Command-I (文件菜单): 打开项目简介
Option-Command-I (文件菜单): 显示属性窗口
Command-D (文件菜单): 复制
Command-L (文件菜单): 在 Finder 中创建替身
Command-R (文件菜单): 显示原身
Command-T (文件菜单): 在 Finder 中,Mac OS X v10.2.8 或者更早操作系统软件版本将所选项目添加至喜好项目内,在 Mac OS X v10.3 及更新版本将所选项目添加至左侧工具条内;如果需要增加至喜好项目内,则须用 Shift-Command-T
Command-Delete (文件菜单): 在 Finder 中,移除至废纸篓
Command-E (文件菜单): 在 Finder 中,推出设备
Command-F (文件菜单): 查寻
Command-Z (编辑菜单): 还原
Command-X (编辑菜单): 剪切
Command-C (编辑菜单): 拷贝
Command-V (编辑菜单): 粘贴
Command-A (编辑菜单): 选定一切
Command-1 (显示菜单): 在 Finder 中,将显示方式设定为图标[BOTAnswer:怎么样改系统内的图标。]
Command-2 (显示菜单): 在 Finder 中,将显示方式设定为列表
Command-3 (显示菜单): 在 Finder 中,将显示方式设定为分栏
Command-B (显示菜单): 在 Finder 中隐藏工具栏
Command-J (显示菜单): 在 Finder 中查看显示
Command-[ (转到菜单): 在 Finder 中向最近查看的一个窗口显示内容后退
Command-] (转到菜单): 在 Finder 中向最近查看的一个窗口显示内容前进
Shift-Command-C (转到菜单): 在 Finder 中显示「电脑」窗口
Shift-Command-H (转到菜单): 在 Finder 中显示「个人」窗口
Shift-Command-I (转到菜单): 在 Finder 中显示 iDisk 内容
Shift-Command-A (转到菜单): 在 Finder 中显示应用程序文件夹
Shift-Command-F (转到菜单): 在 Finder 中显示「喜好项目」
Shift-Command-G (转到菜单): 在 Finder 中转至文件夹
Command-K (转到菜单): 在 Finder 中连接至服务器
Command-M (转到菜单): 缩小窗口至 Dock
Option-Command-M (转到菜单): 缩小一切窗口至 Dock
Command-? (帮助菜单): 打开帮助资料
Command-Space (Spotlight[Spotlight的更多高级技巧] 菜单): 激活并使用 Spotlight[Spotlight的更多高级技巧] (限 Mac OS X v10.4 及更新版本的操作系统软件)
万能辅助与 VoiceOver
Option-Command-8: 开启放大功能
Option-Command-+ (加号): 放大
Option-Command– (减号): 缩小
Control-Option-Command-8: 开启白底黑字
Control-F1: 开启全键盘控制 (可以使用再下列表的快捷键)
Control-F2: 全键盘控制: 选定菜单
Control-F3: 全键盘控制: 选定 Dock
Control-F4: 全键盘控制: 选定现在窗口或在其后面的下一个窗口
Control-F5: 全键盘控制: 选定工具栏
Control-F6: 全键盘控制: 选定辅助工具窗口
Command-F5 或 fn-Command-F5: 在 Mac OS X v10.4 或更新操作系统软件,开启或关闭 VoiceOver
Control-Option-F8 或 fn-Control-Option-F8: 在 Mac OS X v10.4 或更新版本,开启 VoiceOver 实用程序
Control-Option-F7 或 fn-Control-Option-F7: 在 Mac OS X v10.4 或更新版本,显示 VoiceOver 菜单
Control-Option-; 或 fn-Control-option-;: 在 Mac OS X v10.4 或更新版本,激活或关闭 VoiceOver Control-Option 锁定
当全键盘控制功能开启,可使用下列数码键盘按钮;如果无此键盘,则应同时按下 Fn 功能键:
8: 向上移动
2: 向下移动
4: 向左移动
6: 向右移动
1、3、7 与 9: 斜行方向移动
5: 点按鼠标按钮一次
0: 点按鼠标按钮一次,而保留按下
. (句号): 0 按下后,按此键解开鼠标按钮按下锁定
其他指令
Option-Command-D: 显示或隐藏 Dock
Command-Tab: 更换应用程序
Tab: 选定下一个项目
Command-上方向箭头: 转入向上的文件夹
Command-下方向箭头: 转入向下的文件夹
Page Up 或 Control-上方向箭头: 往上移动一页
Page Down 或 Control-下方向箭头: 往下移动一页
鼠标按键按下并拖项目时按下 Option: 在新位置中创建复件
鼠标按键按下并拖项目时按下 Option-Command: 在新位置中创建替身
鼠标按键按下并拖项目时按下 Command: 移至新位置,而不创建复件
Shift-Command-C: 在应用程序中显示彩色选项小窗口
Command-T: 在应用程序中显示字体选项小窗口
Command-Shift-3: 拍摄显示屏内容
Command-Shift-3 并选定时按下 Control: 拍摄显示屏内容,并将其图像内容置于夹纸板内 (此快捷键未出现在苹果英文原文内,由北麦自行所发现)
Command-Shift-4: 拍摄所选定的显示屏部分内容
Command-Shift-4 并选定时按下 Control: 拍摄所选定的显示屏部分内容,并将其图像内容置于夹纸板内
Command-Shift-4 并按下空格按键: 拍摄所选定的窗口的显示屏内容
Option-Command-esc: 强制退出
Control-Eject: 显示可以选定重新开启系统、睡眠与关机的选择对话框,在笔记本中按下 Power Button 电源开关按钮起同样作用
Control-Command-Eject: 关闭一切应用程序,并重新开启系统
Option-Command-Eject 或 Option-Command-电源开关按钮: 进入睡眠状态,在笔记本中关上盒子可起同样作用
在点按窗口工具栏按钮时按下 Command: 循环选定此窗口所提供的不同显示方式,根据 Finder 或应用程序可出现不同显示方式
Command-`: 在开启一个窗口以上的应用程序或 Finder 中,循环选定窗口
Function-Delete (限笔记本电脑即 PowerBook、iBook、MacBook 与 MacBook Pro): 前进删除字符,即删除在文字输入处以右而非以左的字符
----------------------------------------------------------------------------------------------------------------------------------------
38.install packages Mathworld for mathematica
cp the packge directory to /Applactions/Mathemaita/Addon*/Applation/Mathworld
----------------------------------------------------------------------------------------------------------------------------------------
39.plot figure in mathematica, then copy it to preview.
add text on figure?
click figure-->Graphics-->Drawing tools->texttool, you can add a space during input
pdf2eps? just open it in adobe reader then save as.
----------------------------------------------------------------------------------------------------------------------------------------
40.Airport can't get ip for both wireless and wire connection?
solution: systempref-->security-->select the first of 2nd item. If choose the 3rd, sometimes macbook can't get ipaddress(169.*.*.*).
----------------------------------------------------------------------------------------------------------------------------------------
41.open files with default app?
solution: get info-->all
----------------------------------------------------------------------------------------------------------------------------------------
42.rington for iphone?
in iTunes: select part song less than 30', create AAC, then show in finder, and mv name.m4r
----------------------------------------------------------------------------------------------------------------------------------------
43.rsync sync files for local and remote
----------------------------------------------------------------------------------------------------------------------------------------
44.add printers shared from windows samba
system preference->printer&fax->add printer->Advanced(if none, right click toolbar, add advanced)
->type:windows, ....
Ref:
sometimes stop when print? just reset printing system and add printer again.
----------------------------------------------------------------------------------------------------------------------------------------
45.shared the ethnet by airport with windows computer.
In windows, add the ssid of aiport and make sure disable the IEEE 802 1.x confirmation in the
properties of wireless airport.
无线网络属性->关联->共享式网络链接,并输入密码
By the way, if share the connection with non-apple computer, use 5 character password for 40bit wep-key
----------------------------------------------------------------------------------------------------------------------------------------
46.中文复制搜索问题:
dvipdfmx 直接默认使用ttf字体,所以可以中文正常复制;
pdflatex 只要在导演区里加上\usepackage{ccmap} 即可实现在用type1字体情况下实现中文复制;
以上同时适用于gbk/utf8两种编码;
.中文书签问题:
GBK编码:我们只要利用cct提供的gbk2uni程序来解决即可;同时适用latex和pdflatex;
使用方法:latex foo; gbk2uni foo; latex foo ;三步即可;当然,用ctex一步即可;
UTF-8编码:现在有比较好的解决方法
全部使用CJKutf8宏包来替代CJK宏包,对utf8编码支持更加完善,并且直接支持中文书签,不需要额外处理;
注:要同时使用CJKutf8和unicode的hyperref;
\usepackage{CJKutf8}
\usepackage[unicode]{hyperref}
gbk2uni下载地址:
----------------------------------------------------------------------------------------------------------------------------------------
47.beamer顶端导航中文无法显示?
\documentclass[CJK]{beamer}
----------------------------------------------------------------------------------------------------------------------------------------
48.create eps file from pdf file
1.copy the selected figure from adobe reader
2.create new file in preview, and save as pdf file
3. open pdf file with adobereader, save as eps file
----------------------------------------------------------------------------------------------------------------------------------------
49.fonts directory:
/System/Libray/Fonts or Library/Fonts,
----------------------------------------------------------------------------------------------------------------------------------------
50.go back and forward in firefox 3.5 by multitouch
1.about:configure
2.search "browser.gesture.twist"
“browser.gesture.twist.left”=“Browser:PrevTab”
“browser.gesture.twist.right”=“Browser:NextTab”
-------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------
51. Places problem in iphoto?
update java
----------------------------------------------------------------
52.merge many pdf files in one ?
sudo port install pdftk
pdftk 1.pdf 2.pdf output m.pdf
---------------------------------------------------------------------
53. 通过ssh登录mac乱码?
locale查看 LANG=C
解决 export LANG=en.US.UTF-8
------------------------------------------------------------
54. install g95
sudo port install g95
------------------------------------------
55.ifort error: ipo: warning #11009: file format not recognized for ../../Commons/env/liblinux//libnetcdf.a
ld warning: in ../../Commons/env/liblinux//libnetcdf.a, file is not of required architecture
solution:install netcdf
FC= ./configure
----------------------------------------
57. enable firefox bookmarks in QuickSilver
Open about:config in Firefox Location bar, agree that you won't mess
anything up.
Search for "browser.bookmarks.autoExportHTML"
Double click it to enable it (Or right click it and hit toggle)
Restart Firefox & Quicksilver...
"browser.bookmarks.autoExportHTML" makes firefox generate a new
bookmarks.html at a certain point (don't know when).
Haven't found a way to do this with History, but I don't use that and
thus don't care...
---------------------------------------
can't login at startup window?
try click the touchpad instead of tap
---------------------------------------
add powerword dictionary in stardict or Dict in macbook
use DictUnifier convert
-------------------------------
problems after updating to snow leopard
手写: ctrl+shift+space
64bit kernel: 4+6 during start
gcc compiler error
solution: upgrade xcode using the snow leopard disk
darwin port doesn't work any more?
solution: download the lastest darwin version(Macports-1.8.0), install
--------------------------------------------------------------------------------
problem: ld: warning: in main.o, file is not of required architecture
Undefined symbols:
"_MAIN__", referenced from:
_main in libgfortranbegin.a(fmain.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [main] Error 1
---------------------------------------------------------------------------
latex
newcommand中注意不能有全角空格
在幻灯片形式的pdf中常常需要跳转,这时可以用frame环境的label选项配合\hyperlink命令来实现。具体的就是 \begin{frame}[label=xxxx] ..... \end{frame} 之后就可以用\hyperlink{xxxx}{\beamergotobutton{按钮显示的名字}}来指向它,其中 \beamergotobutton可以用\beamerbutton, \beamerreturnbutton来替换
----------------------------------------------------------------------------
9/6/2009
离线wikipedia for mac osX
参考:MAC OS X离线版Wikipedia部署教程
1.环境:MAC OS X 10.6(Snow Leopard),必须安装Xcode,和Xcode中包含的UnixDev Tools这个环境
需要的开发包:PHP5(5.2.9-7)、xapian-core-1.0.15、Django-1.1、mediawiki_sa
2.下载安装Django
下载:
安装: sudo python setup.py install
3. 下载安装xapian-core
下载:
修改common里的gnu_getopt.h文件,61行到66行修改如下
extern "C" {
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
}
安装: ./configure&& make && make install
4.下载主程序包offlinewikipedia和mediawiki_sa包,分别解压,并把mediawiki_sa解压文件移动到主程序包目录下,
~ttsiod/offline.wikipedia.tar.bz2
~ttsiod/mediawiki_sa.tar.7z
修改主目录中的show.pl,修改第64行为:
system("cd ../mediawiki_sa/ && /usr/local/php5/bin/php testparser.php /var/tmp/result > /var/tmp/result.tmp");
将下载的wiki镜像文件(很大)放到主目录的wiki-splits目录下
修改Makefile中的第一行为下载的wiki镜像文件名
运行: make mediawiki 进行分割、索引、写文件,时间比较长,最后提示:
-----------
To run your local wikipedia, just
cd mywiki
python manage.py runserver
and point your browser to
------------
5.使用
打开主目录下的mywiki目录,执行
python manage.py runserver
地址栏输入
---------------------------------------
can't use gnome-terminal in remote X11 by ssh?
solution: downgrading gnome-terminal 2.24.x-x
---------------------------------------
using ctags in vim
ctl+} to subroutine
ctrl+t back to main program
---------------------------------------
macbook airport无法搜到无线路由?
将路由channel设为6, 若channel 13, 经常无法搜到
--------------------------------------
vista下adobe acrobat professional 打开几秒后自动退出?
不要把FLEXnet Licensing service禁掉
-----------------------------------------
如何用ssh挂载远程目录
当我们需要管理一台远程的linux服务器的时候经常使用的是比较安全的ssh。这里提供一个使用sshfs来挂载远程目录的方法。
当你准备好开始做的时候请打开一个中端并按照下面的步骤进行操作:
1、 sudo apt-get install sshfs
2、 sudo modprobe fuse
3、 sudo adduser
4、 sudo chown root:fuse /dev/fuse
5、 sudo chmod +x /dev/fusermount
6、 mkdir ~/remoteserv
7、 sshfs
8.umount: fusemount -u mount_point
9.如果想每次开机都自动挂载,可以在/etc/fstab中加入:
sshfs#user@hostname:path mount_point fuse defaults,auto,allow_other 0 0
这就要求必须先把ssh自动登录配置好了,让root用户能够使用user身份登录远程主机,另外allow_other这个参数很重要,没有这个参数的话,挂载过来的目录只有root能够访问。
---------------------------------------------
grep -n keywords *.f
-------------------------------------------------------
更改mac登陆界面语言
sudo /System/Library/CoreServices/Language\ Chooser.app/Contents/MacOS/Language\ Chooser
restart and relogin
-------------------------
serial number software: KCNscrew
-------------------------
10/18/2009
set locale for iTerm: add "export LANG=en_US.UTF-8" in ~/.profile
iTerm will read file .profile rather than .bashrc
----------------------------
10/18/2009
no high search with vim in terminal
solution: set hlsearch
----------------------------
10/18/2009
给不同的目录设置不同的颜色:
修改~/.bash_profile or .bashrc文件,在文件中加入下面两行配置。
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
那么应该怎样来配置成我喜欢的颜色呢?下面我们就来详细说一些这些配置。
~/.bash_profile是bash shell中当前登录用户的配置文件。bash是“终端”中默认的shell。
alias ls=”ls -G”是给”ls -G”起了一个别名,当执行ls时,就相当于执行了ls -G。
CLICOLOR是用来设置是否进行颜色的显示。CLI是Command Line Interface的缩写。
LSCOLORS是用来设置当CLICOLOR被启用后,各种文件类型的颜色。LSCOLORS的值中每两个字母为一组,分别设置某个文件类型的文字颜色和背景颜色。LSCOLORS中一共11组颜色设置,按照先后顺序,分别对以下的文件类型进行设置:
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
LSCOLORS中,字母代表的颜色如下:
* a 黑色
* b 红色
* c 绿色
* d 棕色
* e 蓝色
* f 洋红色
* g 青色
* h 浅灰色
* A 黑色粗体
* B 红色粗体
* C 绿色粗体
* D 棕色粗体
* E 蓝色粗体
* F 洋红色粗体
* G 青色粗体
* H 浅灰色粗体
* x 系统默认颜色
----------------------------------------------
final cut studio 3 播放剪辑显示未渲染
解决:设置中-回放控制-实时:无限
---------------------------------------------
多个文件搜索
find . -name "*.txt" -exec grep "hello" {} -nH \;
-------------------------------------------
install sed 4.2
download the source code of sed-4.2
./configure --prefix=/usr
make
sudo make install
-----------------------------------------
批量更改文件名,如将该目录下所有文件加前缀
for i in `ls *.pdf`;do mv ${i} "pre_"${i}; done
vim 配色方案
vim配色脚本位于/usr/share/vim/vim71/colors/*,复制到 ~/.vim/colors/
vim中使用:colorscheme morning命令即可使用morning配色,该命令自动读取/usr/share/vim72/colors/ or ~/.vim/colors/
linux默认的配色使用的是peachpuff.vim,而自己不满意的就是默认中的折叠的颜色,虽然为灰白色,时间
长了,仍感觉很刺眼。而desert.vim中的注释行的颜色很不错,是darkyan,即为暗青色,很养眼,颜色行为desert.vim的96行:
hi Comment ctermfg=darkcyan
既然找到了养眼的颜色,那就把这个darkyan放到peachpuff.vim中吧。
在peachpuff.vim中的40行是折叠的配色:
hi Folded term=standout ctermfg=4 ctermbg=7 guifg=Black guibg=#e3c1a5
改为如下:
hi Folded term=standout ctermfg=darkcyan ctermbg=NONE guifg=Black guibg=#e3c1a5
最后想要默认使用这个配色,需要在.vimrc中使用如下命令:
colorscheme peachpuff
-------------------------------------------------------------
使用adobe pdf professional 拆分pdf文件
通过左侧选择要提取的页面,点击右键-提取即可
-------------------------------------------------------------
KCN序列号大全
------------------------------------------------------------
date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S"
DATE: 1987-11-21
TIME: 13:36:16
------------------------------------------------------------
final cut 导入音频嘟嘟响
solution:渲染(cmd+R) 或者 sequence-render selection(audio)
final cut 全屏预览
view-external video(all frame) or cmd+F12
final cut 变速:左下角key frame 然后选取即可
----------------------------------------------------
rar解压乱码
使用Ez7Z解压
-----------------------------------------------
4/1/2010
add ttf chinese fonts for mac texlive 2009
1.downloads cmactex.tar.gz from
2.copy chinese fonts (simsun.ttf, simkai.ttf, simhei.ttf, simfs.ttf, simli.ttf, simyou.ttf) to /usr/local/texlive/2008/texmf-dist/fonts/truetype/Chinese
3. cd ~/.texlive2008/bin
4. ./mkexpfonts (see this script for details)
5. mktexlsr
updmap --syncwithtrees
updmap
cfonts installed: kai sthei stxi
7/20/2011
TERM environment variable not set?
solution: TERM=linux; export TERM
------------------------------------------------------------
7/21/2011snow leopard升级到 mac lionsnow leopard下直接双击lion包即可,macosx安装还是很人性化的。同时也将imac通过time machine导入的方法,复制系统。
-------------------------------------------------------------
macosx qq提示音太难听?修改声音文件
/Applications/QQ.app/Contents/Resources/msg.aif
-----------------------------------------------------------
macosx mail没有声音?
system-preference->sound->play user interface...
----------------------------------------------------------
安全起见,mac lion finder中默认隐藏了Library,/usr, /opt, /private, /etc 文件夹,通过如下命令将其显示
solution: chflags nohidden ~/Library/-------------------------------------------------------------------------------------------
terminal下ls 可以看到文件属性最后有个@符号的是隐藏文件
-----------------------------------------------------------------
diskutil list分区信息
diskutil eraseVolume
diskutil mergePartitions
---------------------------------------------------------------------
macosx下 tar压缩中文文件名,在windows下解压乱码?
solution: 7za a -t7z name.7z folder
---------------------------------------------------
cp -v 显示复制明细
---------------------------------------------------------
指定时间运行脚本:
iCal,新建事件,指定“重复”频率(比如每周或每月),在“提醒”部分,选择“打开文件”,点击下拉菜单中的“其它...”,在弹出的对话框中选择用于备份的脚本文件。今后,每当指定时间到来时,系统就会自动执行备份命令。
------------------------------------------------------------
查看文件建立时间等信息: stat
指定时间运行脚本:
iCal,新建事件,指定“重复”频率(比如每周或每月),在“提醒”部分,选择“打开文件”,点击下拉菜单中的“其它...”,在弹出的对话框中选择用于备份的脚本文件。今后,每当指定时间到来时,系统就会自动执行备份命令。
----------------------------------------------------------
fedora、vista双系统删除fedora
xp:
MbrFix /drive
Vista/win7:
MbrFix /drive
---------------------------------------------------------
mac光盘启动:
重启按住option(atl)
--------------------------------------------------------
通过time machine 复制系统到另外一台电脑 (一般要求同类型的)
1. 将time machine 硬盘挂到电脑上,安装盘放入,重启
2. 按住option,选择安装盘启动
3.到安装界面,mac osx installer->utilities->restore from
backup
如果不是同型号
可以使用 migration assistant
1. 注意在目标机器上建立一个临时管理员账户,保证目标机器里的账户名与time machine中的不同
-----------------------------------------------------------
1. 不要将照片直接拖入aperture,这样会将照片复制到aperture库中,应该使用import
2. 删除项目并不能删除aperture库中的一些preview等,可以考虑过一段时间删除所有项目及aperture库(在导出所有照片的情况下)
3.删除项目后,在aperture要晴空垃圾箱
4.人脸发黄:aperture-color-选中脸色->sat值
----------------------------------------------------------
terminal中 ctrl+r 搜索最近的命令
-------------------------------------------------------
电源适配器灯不亮,冲不上电?
原因: 因为线路上的电流干扰,引发了电源的过载保护。把充电器从插座拔下,放60秒以上,再插上。这样可以重置充电器状态>。
---------------------------------------------------------------------------------------
查看文件建立时间等信息: stat
------------------------------------------------------------
取消export设置的环境变量?
unset
--------------------------------------------------------------
finder 中按照日期搜索?
输入数字,如8或者yesterday,然后选择日期即可,按照文件格式搜索,类似
--------------------------------------------------------------
mac双击运行脚本?
重命名为name.command即
-------------------------------------------------------------------------------
8/9/2011
chrome同步信息查看:
----------------------------------------------------------------------------
cp -v: verbose mode
cp -u: update mode
-----------------------------------------------------------------------------
rsync -avz source target
-R fullpath
rsync 本地full path备份?
rsync -R `pwd`/file .
-------------------------------------------------------------------------------
shell读取文件
while read a
do echo $a
done <
-------------------------------------------------------------------------------
8/10/2011
添加/Users/XX/myscript到path,建立cluster配置文件备份程序,目标:~/backup/cluster
----------------------------------------------------------------------------------------------------------------------------------------
port install unison 双向同步工具
------------------------------------------------------------------------------
usermod 修改用户命令,可以通过usermod 来修改登录名、用户的家目录,群组等
usermod -d newhome -m username
usermod -G newgroup username
groupmod 修改群组信息
查看user信息: id username
或者使用如下命令关闭用户账号:
passwd peter –l
重新释放:
passwd peter –u
apache文件列表设置密码:
touch .htpasswd
chmod600.htpasswd
htpasswd .htpasswd jun (htpasswd-n jun查看)
创建好用户后,他们就可以访问这个目录及其子目录了,但我们还需要在要保护的文件夹下添加一个.htaccess文件,内容如下:
AuthName "Please authenticate in order to access the contents of this folder"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
Require valid-user
http.conf中:
Options FollowSymLinks
AllowOverride All
------------------------------------------------------
8/20/2011
maclion默认会保存应用程序的状态,但是有时出错后,再打开还是报错。
解决:可以考虑在generalpref不要保存状态
同时,删除保存在~/Library/Saved Application State/中相应状态文件
------------------------------------------------------
8/22/2011
final cut 导入dv中mts文件?
解决:1.将dv连接到mac,并设置到观看视频、照片模式,选择usb连接
2. 打开finalcut-》file->log and transfer, 等待一会儿就会出现所有视频了
3.这时候选择你想要的片段 单击Add Clip To Queue就可以批量转码了...注意不可以选择出入点 多声道的自动被Mix为立体声 容量扩大10倍
4. 可以导入整个片段,或者设置出点、入点,具体mov存放位置: /Final cut Document/caperture stratch/project name下
dv中视频保存方法:
final cut专成mov文件比mts文件大好几倍,可以将mts文件保存到电脑,需要视频编辑的时候final cut log and transfer,剪辑完后,删除相应的mov文件。这样可以节省很多空间
mplyerx可以播放mts文件
照片位置:dcim下
-----------------------------------------------------------------------------
8/28/2011
同步照片文件夹到外置硬盘,备份
rsync -avz photo /Volumes/photo\ backup/
或者 photobak ,脚本见myscript/photobak
----------------------------------------------------------------------------
su -
yum -y update
yum -y install gcc make kernel-headers kernel-devel
shutdown -r now
# wait some secs...
# login as root
/usr/bin/vmware-config-tools.pl
-----------------------------------------------------------------------------
9/1/2011
final cut截屏,导出图片文件
选好出点入点,截图输出,在文件-导出—quicktime变化-选择静态图像,就可以了
-----------------------------------------------------------------------------
9/2/2011
eject/mountDisk, umount/mount from terminal?
1. diskutil list 查看磁盘情况
2. diskutil eject /dev/disk1 退出整个磁盘
diskutil umount /Volumes/name 退出某个分区
diskutil mountDisk /dev/disk1 挂载整个磁盘
diskutil mount /dev/disk1s1 挂载分区
-----------------------------------------------------------------------------
9/2/2011
mac下英文界面,更改某些软件的语言界面?
language switcher软件
----------------------------------------------------------------------------------------
Fortran: A specification statement cannot appear in the executable section?
solution: 声明变量需在执行语句前面
--------------------------------------------------------------------------------------
from f77 to f90?
换行符:$-->&
注释行: c or C to !
=------------------------------------------------------------------------------
9/17/2011
xcode fortran?
Launch Xcode-->create new Xcode project--> Mac OS X Application,Command Line Tool-->Name for the project(C type)--> select the locaion for the project--> Create.
Delete the main.c file that has been created by default and select File-->New--> New file-->Other-->Empty--> Name the file with a fortran extension(for example Main.f90).
Write something(hello world program), then select Product--> Build(or press cmd+B), it should build fine,then select Product --> Run(or press cmd+R) to maka it run.
--------------------------------------------------
9/23/2011
find 按照修改时间搜索?
-amin n
查找系统中最后N分钟访问的文件
-atime n
查找系统中最后n*24小时访问的文件
-cmin n
查找系统中最后N分钟被改变文件状态的文件
-ctime n
查找系统中最后n*24小时被改变文件状态的文件
-mmin n
查找系统中最后N分钟被改变文件数据的文件
-mtime n
查找系统中最后n*24小时被改变文件数据的文件
-------------------------------------------------------------
only backup files latest modified using my script:
for i in `find . -mtime -3d -type f`;do bak "`pwd`/$i" ; done
----------------------------------------------------------
for i in `find . -mtime -3d -type f`; do rsync -avz -R "$i" ~/path/; done
-------------------------------------------------------------------------------
10/13/2011
经常需要实时查看最近的日志文件?
写了如下的bash脚本,简单实用,并将其命名为tl,即tail last modified file
#!/bin/sh
# using tail to show the last modified file, such as a.log.
echo "------------------\n"
echo "show last modified file dynamically"
FileName=`ls -ltrh | tail -n1 | awk '{print $NF}'`
if [ ! -f $FileName ]
then
echo "ERROR: \"$FileName\" Not a file last modified"
exit
else
tail -f `ls -ltrh | tail -n1 | awk '{print $NF}' `
------------------------------------------
10/14/2011
使用adobe acrobat pro文本编辑(touch up text tool)出现如下错误
"All or part of the selection has no available system font. You cannot add or delete text using the currently selected font."
解决:
- Choose Tools > Advanced Editing > TouchUp Text Tool.
- Select the text(仅仅选中要编辑同一字体的几个文字,否则会出错) that you want to edit with this tool and right-click (Windows) or Command+Click (Mac OS), and then choose Properties.
- In the TouchUp Properties dialog box, select the Text tab.
- In the Font pop-up menu, select a Font consistent with the current font you are using. (The fonts listed are the fonts that are available on your system.) You can choose to embed the font into the document by checking the Embed checkbox. Or, you can choose a subset of only the characters you want to add by checking the Subset checkbox (which keeps the file smaller).
------------------------------------------------------------------------------------
10/29/2011
Final cut Pro X格式导出
可以直接导出为dvd格式的img文件,然后再刻录
或者导出movie,然后使用视频格式转换软件压缩成mp4
导出apple device会非常慢,尽量少用
--------------------------------------------------------------------------------
10/30/2011
mac lion比较慢优化!
1。 打开用户偏好设置,去掉用户不需要的登陆项
2. 去掉不必要的加载项
系统级的可以在/Libaray/LaunchAgents和/Libray/LaunchDeamons文件夹下面找到,都是plist属性描述文件。
当前用户级别的可以在~/Libaray/LaunchAgents和~/Libray/LaunchDeamons文件夹下面找到 。
找到你不需要的,将其删除即可。或者是在其下面建立一个子目录,将描述文件放到子目录里面,这样就不会加载了
------------------------------------------------
11/3/2011
lion下剪切:
cmd+c and then cmd+option+v
------------------------------------------------------------------------------------------
11/4/2011
修改hosts,icloud完美显示地图
将如下内容复制到/etc/hosts即可
#apple Google Map
203.208.46.147
203.208.46.147
203.208.46.147
203.208.46.147
203.208.46.147
203.208.46.147
--------------------------------------------------------------------------------------------------------
11/10/2011
mac ssh登陆服务器中文乱码?
mac中LANG=en_US.UTF-8
远程 LANG=en_US,将其改为en_US.UTF-8,并加到.bashrc中即可
---------------------------------------------------------------------------------------------------------
11/11/2011
查看ip对应的mac地址
ping 1.1.1.1
arp -a
-----------------------------------------------------------------------------------------------------------
11/12/2011
papers修改设置,导入pdf文件时,修改文件名
-----------------------------------------------------------------------------------------------------------
11/12/2011
使用iCloud同步文档
~/Library/Mobile Documents
------------------------------------------------------------------------------------------------------------
安装MaME OSX游戏模拟器
rom文件放到~/Library/application support - mame os x - roms
---------------------------------------------------------------------------------------
11/13/2011
将大文件分卷压缩?
betterzip
---------------------------------------------------------------------------------------
11/14/2011
查看linux版本号
cat /etc/issue 或者 lsb_release -a
uname -a 查看其他信息
-------------------------------------------------------------------------------------------
11/16/2011
copy 为链接,而不是复制文件
cp -l
复制链接时直接复制即可
----------------------------------------------------------------------------------------------
----------------------------------------------------
beamer latex使用verbatim
\usepackage{verbatim}
\begin{frame}[fragile]
\begin{verbatim}
code goes here...
\end{verbatim}
\end{frame}
---------------------------------------------------
查看uid,gid
id
--------------------------------------
安装netcdf需要hdf5?
安装hdf5,设置export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/hdf5-1.8.7/include/
-----------------------
install lapack and blasé on mac at /usr/local/lib
--------------------------------------------------
1/22/2012
final cut pro x强制关闭重新打开工程没有了?autosave文件也打不开,重启final cut也不行。
解决:试一下重启机器
final cut pro x 到处dvd要差不多2个小时,可以尝试在导出的时候选择后台提交到compressor
--------------------------------------------------------
endnote word参考文献前面添加序号?
endnote-style文件-->bibliorgraphy->layout->start reference with->[bibliorgraph number]
------------------------------------------------------------
2/11/2012
将视频导出为gif?
cinegif
----------------------------------------------------------
显示文件file奇数行的内容:
sed -n '1,$p;n' file
awk 'NR%2!=0' file
显示文件file偶数行的内容:
sed -n '1,$n;p' file
awk 'NR%2==0' file
------------------------------------------------------------------------------------------------------------
2/13/2012
windows下word2010使用endnote后,编辑特别慢?
解决:word选项->校对->在word中更正拼写和语法时->将“键入时标记语法错误”不选中
-----------------------------------------------------------------
2/24/2012
iphone导入照片视频到mac osx
image capture
--------------------------------------------
3/2/2012
mac finder隐藏、显示特定的文件及文件夹
隐藏及反隐藏的命令
隐藏命令
sudo chflags hidden 加完全路径
例如:sudo chflags hidden /Applications/FaceTime.app
翻隐藏命令
sudo chflags nohidden 加完全路径
例如:sudo chflags nohidden /Applications/FaceTime.app
-----------------------------------------------------
3/20/2012
科技论文中矢量图的使用
1.如果原始图片是pdf、eps等矢量图格式,可以使用illustrator等软件编辑
2. 在word或者ppt中修改的方法
a. 使用preview将pdf文件存为tiff格式(使用lzw压缩,500dpi,甚至300dpi足够了)
b.将tiff图片放到ppt或者word中编辑,然后另存为emf等矢量图格式,也可存为tiff位图格式
c.用illustrator将emf格式转存为pdf格式,
d.使用preview裁边,然后存储pdf,及导出tiff格式
注:在ppt中另存为图片为tiff或者png时,分辨率为实际的屏幕分辨率,可以通过设定页面大尺寸来提高另存图片的质量
---------------------------------------------------------------------
3/21/2012
升级到texlive 2011
1.复制自己定制的beamertheme
2. 添加中文字体
add ttf chinese fonts for mac texlive 2009
1.downloads cmactex.tar.gz from
2.copy chinese fonts (simsun.ttf, simkai.ttf, simhei.ttf, simfs.ttf, simli.ttf, simyou.ttf) to /usr/local/texlive/2008/texmf-dist/fonts/truetype/Chinese
3. cd ~/.texlive2008/bin
4. ./mkexpfonts (see this script for details)
5. mktexlsr
updmap --syncwithtrees
updmap
3.将ctex中的cct目录复制到/usr/local/texlive/2011//texmf/tex/latex/cct
---------------------------------------
Endnote如何去掉域代码生成纯文本文件
现在很多杂志都要求作者提供电子文稿。格式化后的文稿含有大量域代码,有可能与杂志社的软件不兼容,因此提交前需要去掉文稿里的域代码。方法是从Word的工具栏里进入“EndNote 7.0”子菜单选择点击“Remove Field Codes”,出现一个提示框告诉你“该操作将创建一个新的去掉了所有域代码的Word文档,原文件仍然打开且无改动”,点击“确定”将新文件存到指定地点。新文件内容和原文件完全相同,只是无域代码,因此不能再对引文进行格式化。
----------------------------------------------
4/5/2012
macfuse+macfusion,无法成功挂载远程服务器?
sshfs产生错误no kext?
解决:卸载macfuse,安装fuse4x
---------------------------------------------------------
4/5/2012
mac finder中选中文件按一下空格可以预览文件,但是切换到其他软件的时候,预览窗口会消失。
解决:
-------------------------------------------------------------------------------------------------------------
4/6/2012
date +%Y%d
-------------------------------------------------------------------------------------------------------
运行cesm run出现如下错误:
ls: No match.
Model did not complete - no cpl.log file present - exiting
解决:这是由于cesm默认是64个进程,run脚本中设置的进程数不是64引起的。
法一:将run脚本中使用mpirun -np 64
法二:修改case下的env_mach_pes.xml,将进程数改为需要的数值
-------------------------------------------------------------------------------
4/10/2012
EvoCam监视
打开EvoCam,然后选择打开配置文件,actions中选择检测sensor并发送邮件
或者streaming enable server
------------------------------------------------------------------------------------------
4/12/2012
将当前目录添加到path,可以直接运行可执行文件,不需要./
export PATH=$PATH:.
--------------------------------------------------------------------------------------------
4/16/2012
在 Aurora 中如何使用中文
对于CTeX 2.8/2.9 而言,在 Aurora中使用中文需要重新配置字体,在默认为TrueType字体下是不能正确输出中文的。
1) 开始菜单—CTeX—FontSetup—勾选上“生成Type1字库”和“使用Type1字库”这两个选项,重新配置字体,完成安装。
2) 在打开的 Aurora 对话框中选“Properties——>Packages”,添加宏包“\usepackge{ctex}”。
3) 在数学环境中使用“\text{中文}”输入中文。
即可正确输出中文。
--------------------------------------------------------------
4/18/2012
mac下acrobat打印机打印后文件位置?
选择最下面的printer,然后save as pdf
---------------------------------------------------------
4/19/2012 word某页横向?
在一篇WORD文档中,如何使其中的一页页面设置成横向?
您首先打开要编辑的文档,或者新建文档也行。
把鼠标插入点停在要变成横向页面的前一页,比如你要把第4页变成横向的,就要把鼠标放在第3页上,任何位置都行。
然后点“文件”---“页面设置”---“页边距”栏目下面有页面纵横选项,选择“横向”,在“应用于”选项中选择“插入点之后”,然后点确定。
这时第4页之后的所有页都变成横向的了。然后再把鼠标插入点放在第4页上。
点“文件”---“页面设置”---“页边距”栏目下面选择“纵向”,在“应用于”选项中选择“插入点之后”。
这样整个文档只有第4页是横向的了。
---------------------------------------------------------------
4/27/2012
word中插入图片
1.png, tiff等位图格式效果稍差,如果有矢量图最好
2. ncl输出为eps,可以直接插入word,但是对于使用adobe acrobat输出的eps则无法插入word,只是在word显示为一个图标,可以
考虑使用illustrator打开pdf或者eps文件,然后另存为eps文件,就可以插入word了
3. 如果eps还是无法导入word,可以考虑用adobe acrobat打开pdf文件或者eps文件,打印成pdf,然后导出为eps,如果eps文件有空白,
使用gsview打开,pstoeps,保存可
4.ncl输出多张图片存为ps,使用psselcet -p4 a.ps选取第四张保存为ps,然后使用gsview处理,pstoeps,转为eps、并去掉空白
步骤四4可能会导致图片可以显示,但是打印不出来。如果不行,可以尝试直接使用gsview打开ps文件,选取相应的图片,存为eps,看能否插入word打印,如果不行,就用ai打开
得到的eps文件,另存为eps即可。
ncl输出多张pdf图片,可以使用adobe pdf打开,只选择相应的页面,然后另存为eps也可
注意: R输出为pdf文件,可以使用acrobat 打印成pdf,然后用illustrator打开pdf文件,导出为eps文件,就可以插入word了,此时eps文件比较大、可能还会有空白,可以使用gostview打开eps文件,pstoeps,另存为eps就没问题了。
-------------------------------------------
文本格式的数据导入word表格?
excel中数据-》来自于文本-,然后复制到word表格即可
--------------------------------------------------------------------------------
%s/