Android with root Git for version control Lircd with Raspberry Pi for IR receiver and sender Tips for Windows Depolying your own password management tool -- KeeWeb Depoly your flask app into Heroku Fix shit IE code manually ISBN to Book Category by Scraping DangDang A Generic Makefile for C/C++ Program Configure Raspberry pi Remove watermark with PyPDF2 tips for docker Anaconda+TensorFlow+CUDA Snippets Configure Remote Mathematica Kernel Build your own ngrok server Access Array SSL VPN 使用Rstudio制作html5幻灯片 tips for Mac OS X system Tips for ipython notebook 配置Ubuntu server + Openbox (Obuntu) tips for Vimperator tips for Vim 安装CUDA My First Jekyll Blog rsync常见选项 在Linux中读取Ipod touch的文件 tip for texmacs 在VPS上建站的一些tip Gnuplot绘图札记 Samba系统和autofs自动挂载 Linux中alsamixer声卡无法录音 搭建自己的RSS订阅器——Tiny Tiny RSS Grub2引导安装Ubuntu awk tips 将Ubuntu系统装入U盘 The Great Rtorrent 编译GCC 再这样剁手!!!该死的libgd 使用ulimit进行资源限制 使用SSH代理上IPV6 使用RCurl抓取网页数据 修复Ubuntu Grub记 openbox中的文件关联 在Ubuntu 12.04下编译qtiplot 处理BCM4312网卡驱动纪实 配置我的Ubuntu Server记 Cygwin杂记 Linux 使普通用户具有以超级权限执行脚本 让firefox自定义地处理文件类型 WordPress优秀主题及插件 在phpcloud上搭建wordpress UBUNTU下用pptpd做VPN server ubuntu升级内核过后的一些问题 安装telnet服务 kubuntu札记 64位kubuntu札记 统计软件R Virtualbox stardict星际译王 Ubuntu重装windows系统后的grub引导修复 SSH服务及花生壳域名解析 采用cbp2make工具由code::blocks工程创建makefile文件 UBUNTU 札记

tips for Mac OS X system

2015年09月22日

Here are some tips for my macbook pro.

  1. using Command+Shift+. to toggle hidden files in file dialog, this shortcut will not work in Finder.

  2. use hdiutil attach -nomount ram://$((2 * 1024 * SIZE_IN_MB)) to create a ramdisk and diskutil eraseVolume HFS+ RAMDisk NAME_OF_DISK to format and mount it.

  3. To use X11 forword in OS X server, you need to do the following steps:

     #edit '/etc/sshd_config' as following
     X11Forwarding yes
     XauthLocation /where/is/your/xauth # default /opt/X11/bin/xauth
     X11DisplayOffset 10
     X11UseLocalhost no
    
     # then reload the daemons
     cd /System/Library/LaunchDaemons
     launchctl unload ssh.plist
     launchctl load ssh.plist
    
     # test whether it works
     ssh -Y ssh.server
     xeye #a test X11 program show two eyes
    
  4. Itunes keep running itself when Fn+F8 pressed. To disable this, just open quicktime(which consume less cpu) and then close it or more easily, run command launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist, which learned from this post. Another very neat way is to disable iTunes with sudo chmod -x /Applications/iTunes.app/.

  5. Add mount_name -fstype=afp afp://username:password@server_address/share_name to file /etc/auto_home and then sudo automount -vc to enable the automount AFP filesystem at /home/mount_name. Add mount_name -fstype=smbfs ://user:passwd@samba.server/share.name to enable SAMBA file system.

  6. use command textutil -convert html file.webarchive to extract all figures in a web archive generated by Safari.

  7. The cp command have a GNU version gcp provided by MacPorts which support -l option. Using command gcp -v -P -R -l -n src/ dst/ can create a hard link(-l) for every destination not exist file(-n) while not following symlink(-P) in verbose(-v) mode, this can be very useful to merge files in multiple folder together, especially when you want to have all the newest historical files exist in your time machine backup.

  8. To run a program inside sandbox to restrict resource access permission (like forbiden network access):

     /Applications/Beyond Compare.app/Contents/MacOS/$ cat BCompare
     #!/bin/bash
        
     CWD=$(dirname "$0")
     exec sandbox-exec -n no-network "${CWD}/BCompare.bin" "$@"
    

The following are some good softwares:

  • ncdu CLI du to show the disk usage.
  • iTerm a very cool terminal like terminator. An nice configure file.