罗技 Logi MX 系列键盘布局切换方法

本方法适用于所有 MX 系列键盘,非 MX 系列没有尝试,不保证可用。

罗技的 MX 系列键盘通常有两个布局模式,最主要的区别就在于底部的 start 按键和 alt 按键。

通过按键的标记可以看到,start 键(即 Windows 徽标键)在 mac 布局下是 opt 键,而 alt 键在 mac 布局下是 cmd 键。

但是这里的按键布局,翻遍了说明都没有找到如何切换。通过搜索发现,跟键盘第一次连接的设备有关。如果键盘第一次连接 mac,则使用左侧的 mac 布局。如果连接的是 Windows,则使用右侧的 Windows 布局。

这导致对双系统用户极度不友好。切换系统时,会出现按键标记与实际功能不符的情况。于是经过多方搜索,找到了手动切换布局的方法:

切换到 Windows 布局:按住 FN + P 键 3 秒(Hold FN+P for 3 (更多…)

新版 Mac U 盘重装系统的注意事项

由于苹果在新版的 Mac 中内置了 T2 安全芯片,因此当我们在下面这些版本的 Mac 上尝试使用 U 盘重装系统的时候,需要额外注意。

本文章适用的 Mac 型号包括:

主要注意的核心点是:

  1. 不要先格式化硬盘
  2. 不要先删除原系统中的管理员用户
  3. 切记先进 Recovery 模式修改安全芯片选项,再开始重装
  4. 最好先升级到最新的系统再重装

说说原因:

  1. 如果先格式化硬盘,Recovery 模式无法找到有效的管理员账号,不允许修改 T2 芯片的选项
  2. 同 1,删除所有管理员账户会导致无法修改选项
  3. (更多…)

减少 Mac – Office365 网络请求和流量

在功能和使计算机保持最新状态这两个方面,Office 2016 for Mac 的默认配置提供了最佳用户体验。

在某些情况下,可能希望阻止应用程序联系网络终结点。

若要防止应用程序发送“使用情况”遥测可从终端手动设置:

defaults write com.microsoft.WordSendAllTelemetryEnabled -bool FALSE
defaults write com.microsoft.WordSendAllTelemetryEnabled -bool FALSE
defaults write com.microsoft.ExcelSendAllTelemetryEnabled -bool FALSE
defaults write com.microsoft.PowerpointSendAllTelemetryEnabled -bool FALSE
defaults (更多…)

修复 Mac OS X 新版 Terminal 在 SSH 时候出现的 LANGUAGE WARNING

自从升级了新版的 Mac OS X 之后,使用 Terminal SSH 到别的机器上总是能看到这样的警告:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

在执行 perl 脚本的时候还能看到这样的警告:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: (更多…)

Git 统计代码量

最近有一个需求是要统计 Git 仓库里每个人的代码量,于是上网搜了一下,找了一些相关命令:

指定用户名版

git log --author="_Your_Name_Here_" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -

这句话可以输出当前项目内指定用户名的用户的代码量统计,结果如下:

added lines: 30400 removed lines: 21317 total lines: 9083

使用 ls-file 实现不指定用户版统计行数版

git ls-files -z | xargs (更多…)

How to Start the Mac Screen Saver with a Keyboard Shortcut in OS X

start-screen-saver-keystroke-mac

Have you ever wanted to initiate the screen saver of your Mac by hitting a keystroke combination? You’re not alone, and that’s what we’re going to show you how to do here. While OS X does not include this feature by default, we’ll demonstrate how to create an Automator system service that will accomplish the same feat, activating the screen saver by a keyboard shortcut of your choosing.


To (更多…)

How to Change the Profile Picture of a Mac User Account

The first time you set up a Mac or new user account, you’re asked to pick a profile picture for that account. Most of us set this image once and don’t think much about it, but that profile picture follows us around in OS X and is visible at each boot login menu, in the Fast User Switching menu, visible to other users with AirDrop, and plenty of other places in Mac OS X.

If you decide you want to change (更多…)

Maintain & Recall Command Line Clipboard History with iTerm 2

iterm2-icon

Mac users who spend a lot of time at the command line have yet another reason to use iTerm 2 as their default terminal client; clipboard history. Added in the most recent version of iTerm, a running history of OS X clipboard activity can be natively stored, recalled, and summoned directly in iTerm2, accessible through a handy new feature panel called Toolbelt.


You’ll need the latest version (更多…)

Ctrl与Caps Lock键的交换

Emacs和VIM之所以这样受程序员的喜爱,是因为两者都有高度的可定制性,以及丰富的快捷键组合。利用这些快捷键组合,让你能够手不离键盘,就能完成大多数的工作。其实,用鼠标操作神马的,效率是极其低下的……

话说Emacs中,用到最多的两个快捷键组合,就是Meta键和Ctrl键。对于我们普通的键盘,Meta键还好,离手很近。不过,对于Ctrl键,就离得比较远了…… 网上有网友推荐的做法,是用手掌去按Ctrl键,不过,这样的方法,对于普通键盘还不错,但是对于笔记本来说,也不太实用。

正规的Unix键盘的键位布局,Ctrl键应该是在现在标准键盘的Caps Lock位置的。这样,按起Ctrl键,就方便多了。

那要怎么交换这两个键的键位呢?重新买一个键盘? No!! 其实,也不用换键盘,我们完全可以用软件的方式来实现两个键位的交换。
下面是我从网上整理来的方法:

Win7下交换键位的设置

其实Win7下面,方法还比较多,一种是直接修改注册表,实现全局的替换,另外一种,是让两个键的交换,只在Emacs窗口激活的时候生效。至于哪个更好,完全根据你自己的需要。

局部替换大法

这种方法,需要用到一个辅助软件,那就是大名鼎鼎的Auto (更多…)

git commit 出现There was a problem with the editor ‘vi’

今天在Mac OS X 10.9.3上使用git的时候遇到这么一个问题,执行git commit操作会显示如下错误:
There was a problem with the editor ‘vi’

搜寻了一下相关的解决方案,发现好多人遇到了这个问题。似乎是因为vim的返回值有问题导致的。
所以执行一下下面这条命令:
$ git config –global core.editor /usr/bin/vim
将git使用的编辑器强制指定一下,就可以正常使用了。具体的错误分析就不翻译了,贴在下面:

I have had an annoying problem with git and vi. I like to use vim to edit my commit messages, but I’ve been hit with this annoying message (更多…)