Skip to main content

Posts

杂记 20111116 | Misc Notes 20111116

1.SingleCompile 是一个不错的 vim 插件,用于快速编译运行单个文件 2.vim 命令 :cope 查看所有编译错误 3.tsocks 从网络库层面给程序包装一个透明socks代理 4.删除 Messaging Menu 不需要的条目: mkdir -p ~/.config/indicators/messages/applications-blacklist/ 从 /usr/share/indicators/messages/applications 找到不需要的文件,在上面那个目录里创建链接 5.vim 的 wildmode 和 wildemenu 可以定制 vim 自动匹配(例如文件名)的模式 6.easytags 可以让vim根据tags进行语法高亮 7.让vim可以像Visual Studio一样在输入行末的分号或者右大括号时可以自动格式化代码 function! WL_auto_format() let curline = getline('.') let curcol = col('.') if match(curline[curcol :], '\S') == -1 " current char is curline[curcol-1] let c = curline[curcol-1] if c == ';' execute "normal \ =$" elseif c == '}' execute "normal =%%" endif endif endfunction autocmd Filetype c imap ; ; :call WL_auto_format() a autocmd Filetype c imap } } :call WL_auto_format() a autocmd Filetype cpp imap ; ; :call WL_auto_format() a autocmd Filetype cpp imap }...

杂记 20110803 | Misc notes 20110803

1. Linux 查看程序访问的文件(类似filemon/processexplorer): strace -e trace=file foo 2. mod_python 编译出错: 参考 http://blogold.chinaunix.net/u/19834/showart_2127433.html connobject.c142行 !(b == APR_BRIGADE_SENTINEL(b) 改为!(b == APR_BRIGADE_SENTINEL(bb) 3. virtualbox 修改 host key: file -> preferences -> input 4. live meseenger 显示所有好友离线: 去控制面板->添加删除程序->修复live meseenger 也有说删除appdata的 5. linux 手动添加dns: 修改/etc/dhcp/dhclient.conf (可能还需要/etc/dhcp3/dhclient.conf),加入 prepend domain-name-servers 8.8.8.8; 6. Windows 7 godmode 建立文件夹,改名为GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} 1. Monitor files accessed by a process on Linux (like filemon/processexplorer) strace -e trace=file foo 2. cannot compile mod_python from http://blogold.chinaunix.net/u/19834/showart_2127433.html at connobject.c line 142 change !(b == APR_BRIGADE_SENTINEL(b) to !(b == APR_BRIGADE_SENTINEL(bb) 3. Change host key in virtualbox: file -> preferences -> input 4. All contacts in live messenger appear offline:...

VirtualBox 在副屏上全屏显示 | Show VirtualBox in fullscreen on a secondary screen

链接: http://tipstank.com/2010/06/04/virtualbox-full-screen-second-monitor/ 全屏后点下方自动隐藏菜单的View -> Virtual Screen 1 -> Use Host Screen 2 Link: http://tipstank.com/2010/06/04/virtualbox-full-screen-second-monitor/ Turn on fullscreen mode, in the auto-hide menu at the bottom, follow View -> Virtual Screen 1 -> Use Host Screen 2

杂记 | Misc Notes

1. fontregister: Windows 下没有管理员权限时安装字体的小工具 2. 在Windows下Putty用Linux字体时可能需要选上Cleartype选项 3. x11vnc: 可以在终端开一个vnc server连接到一个已有的X会话上去 4. pomodoro: 工作25分钟,休息5分钟。一个有趣的工作模式 5. network-manager的共享网络模式(shared to other computers)似乎变的好用了(以前我这完全不能用) 6. Firefox添加书签时没有“在边栏显示”的选项,但是去书签管理看属性还是有的。 1. fontregister: a tool that allows you to register new fonts in Windows without admin privilege. 2. In putty on Windows, you may need to choose the "Cleartype" option when using Linux fonts 3. x11vnc: to create a vnc server that connects to a existing X session 4. pomodoro: work for 25 minutes, then rest for 5 minutes. A good way of time managing. 5. The "shared to other computers" mode in network-manager works well now. 6. In recent Firefox, there's no "load this bookmark in the sidebar" option when you add a new bookmark. However you can still find it, by checking the properties of an existing bookmark in the bookmark manager.

杂记 | Misc Notes

1.gnome-shell 默认按一下winkey会出main menu, 这问题不大,但是其他我设的winkey+..的快捷键很多不能用了。比如f和空格都不行,但是t可以,很诡异。 解决办法是 system settings -> region and language -> layouts -> options -> alt/win key behaior -> meta is mapped to win keys 2.python的urllib记得是直接直接支持https的,但是不能验证证书(据说以后会实现的)。于是我找到了m2cypto这个模块,里面包装了urllib,证书有问题时会抛异常,但是证书没问题时会卡死。。。后来想了想,还是调用wget比较靠谱 3.gnome 3的控制面板里找不到startup applications了,但是可以直接运行gnome-session-properties 4.maximus:一个小软件,可以去掉最大化窗口的标题栏,配合gnome shell很不错。 5./usr/share/gnome-shell/js/ui/dateMenu.js还有panel.js可以对gnome shell顶部条进行hack,比如我把Activities改了名,自定义了时钟格式,去掉了accessibility图标。 1. By deault press the winkey once in gnome-shell will call up the main menu, this is not a big problem, but some shortcuts 'winkey + somekey' I set are not functional. For example 'f' and 'space' do not work, however 't' works, weird. To solve it: system settings -> region and language -> layouts -> options -> alt/win key behaior -> meta is mapped to win ...

路径环境变量中的陷阱 | Traps in path related environment variables

最近需要在没有root的机器上配一个自己的编译环境,于是需要改一些环境变量,比如 CFLAGS="-I#/include" LDFLAGS="-L#/lib" PATH="#/bin" LD_LIBRARY_PATH="#/lib" LIBRARY_PATH="#/lib" MANPATH="#/man" C_INCLUDE_PATH="#/include" CPLUS_INCLUDE_PATH="#/include" PKG_CONFIG_PATH="#/lib/pkgconfig" 当然可能还需要其他的。 如果就按这么写明显有问题,比如PATH原先可能不是空的,所以应该写成PATH="#/bin:$PATH",其他变量也类似。但是这样会有个更严重的问题,困扰了我一天。 问题出在C_INCLUDE_PATH,一般这个变量都是空的,所以按上面的方法添加自定义路径后变成了"#/include:",而这个末尾的":"会被理解为末尾有个当前目录,即'.',开头的':'以及中间的'::'会有同样情况。 另一方面,在使用automake编译的程序中,经常会出现-I.的编译参数,而且通常出现在最开始以保证当前目录是第一个被搜寻的路径。但是如果'.'出现了C_INCLUDE_PATH中,gcc会认为它是系统标准路径,于是命令行中的-I.会被忽略掉。这样搜索路径的顺序就改变了,就会出问题。 我是在编译binutils时发现的问题,很多目录里都有config.h,于是搜索路径的顺序很重要。 解决方法当然也很简单,就是麻烦一些,即判断一下原来的路径是否为空,避免添加多余的分隔符':'。 Recently I need to set up a development environment without root privilege, therefore I need to tweak several environment variables, for example:...

杂记 | Misc Notes

1. tidy, csstidy,两个小工具,可以优化html和css 2. perl安装模块: perl -MCPAN -e shell 3. python安装模块: easy_install 或 pip 4. gcc 查看本机CPU类型 gcc -v -mtune=native 5. bash 里面二重替换变量: eval B="$"$A, 举例来说如果A=X,X=100,那么这个语句之后B=100 6. Linux From Scratch: 详解从无到有编译一套Linux,值得一看 1. tidy & csstidy: 2 small tools for optimizing html and css files 2. to install perl modules: perl -MCPAN -e shell 3. to install python modules: use easy_install or pip 4. to view how gcc detects local cpu: gcc -v -mutune=native 5. to recursively substitute variables in bash: eval B="$"$A, for example when A=X and X=100, then the previous statement results in B=100 6. Linux From Scratch: describing how to build a complete Linux from nothing, worth reading.