||
1,安装 Gedit
下载安装,gedit-2.30.2.dmg https://nl.softonic.com/download/gedit/mac/post-download?sl=1
vim~/.bash_profile
添加 alias gedit="open -a gedit"
然后 source ~/.bash_profile
2,解决错误 xgterm Xt error: Can't open display: localhost:19.0
在mac上用
ssh -X name@machine
连接服务器的时候总会过一段时间就报错xgterm Xt error: Can't open display: localhost:19.0,localhost后面的数值也一直在变。解决办法:
ssh -Y user@machine
改用上面的命令连接服务器
3, scp 报错 zsh: no matches found:
https://superuser.com/questions/420525/scp-with-zsh-no-matches-found
在~/.zshrc里面添加:
alias scp='noglob scp'
4,在mac下实现linux的高亮(highlight)复制,中间黏贴(middle click)
linux下的这个设计很赞,mac下面竟然没有。。。 不开心。不过找到了一篇教程完美解决。
�里面大神子写程序实现了这个功能,具体实现过程如下:
1,将几个文件下载下来,一起放到某个目录下面:
1)�.gitignore。文件(内容如下)
# Object files | |
*.o | |
*.ko | |
*.obj | |
*.elf | |
# Precompiled Headers | |
*.gch | |
*.pch | |
# Libraries | |
*.lib | |
*.a | |
*.la | |
*.lo | |
# Shared objects (inc. Windows DLLs) | |
*.dll | |
*.so | |
*.so.* | |
*.dylib | |
# Executables | |
*.exe | |
*.out | |
*.app | |
*.i*86 | |
*.x86_64 | |
*.hex | |
# Debug files | |
*.dSYM/ |
2)Makefile 文件(内容如下)
.PHONEY: clean run | |
all: help | |
help: | |
@echo make [ clean macpaste run ] | |
clean: | |
-rm -f macpaste | |
macpaste: macpaste.c | |
gcc -O2 -framework ApplicationServices -o macpaste macpaste.c | |
run: | |
./macpaste |
3)macpaste.c 文件(内容如下)
// Public Domain License 2016 | |
// | |
// Simulate right-handed unix/linux X11 middle-mouse-click copy and paste. | |
// | |
// References: | |
// http://stackoverflow.com/questions/3134901/mouse-tracking-daemon | |
// http://stackoverflow.com/questions/2379867/simulating-key-press-events-in-mac-os-x#2380280 | |
// | |
// Compile with: | |
// gcc -framework ApplicationServices -o macpaste macpaste.c | |
// | |
// Start with: | |
// ./macpaste | |
// | |
// Terminate with Ctrl+C | |
#include <ApplicationServices/ApplicationServices.h> | |
#include <Carbon/Carbon.h> // kVK_ANSI_* | |
#include <sys/time.h> // gettimeofday | |
char isDragging = 0; | |
long long prevClickTime = 0; | |
long long curClickTime = 0; | |
CGEventTapLocation tapA = kCGAnnotatedSessionEventTap; | |
CGEventTapLocation tapH = kCGHIDEventTap; | |
#define DOUBLE_CLICK_MILLIS 500 | |
long long now() { | |
struct timeval te; | |
gettimeofday( & te, NULL ); | |
long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; // caculate milliseconds | |
return milliseconds; | |
} | |
static void paste(CGEventRef event) { | |
// Mouse click to focus and position insertion cursor. | |
CGPoint mouseLocation = CGEventGetLocation( event ); | |
CGEventRef mouseClickDown = CGEventCreateMouseEvent( | |
NULL, kCGEventLeftMouseDown, mouseLocation, kCGMouseButtonLeft ); | |
CGEventRef mouseClickUp = CGEventCreateMouseEvent( | |
NULL, kCGEventLeftMouseUp, mouseLocation, kCGMouseButtonLeft ); | |
CGEventPost( tapH, mouseClickDown ); | |
CGEventPost( tapH, mouseClickUp ); | |
CFRelease( mouseClickDown ); | |
CFRelease( mouseClickUp ); | |
// Allow click events time to position cursor before pasting. | |
usleep( 1000 ); | |
// Paste. | |
CGEventSourceRef source = CGEventSourceCreate( kCGEventSourceStateCombinedSessionState ); | |
CGEventRef kbdEventPasteDown = CGEventCreateKeyboardEvent( source, kVK_ANSI_V, 1 ); | |
CGEventRef kbdEventPasteUp = CGEventCreateKeyboardEvent( source, kVK_ANSI_V, 0 ); | |
CGEventSetFlags( kbdEventPasteDown, kCGEventFlagMaskCommand ); | |
CGEventPost( tapA, kbdEventPasteDown ); | |
CGEventPost( tapA, kbdEventPasteUp ); | |
CFRelease( kbdEventPasteDown ); | |
CFRelease( kbdEventPasteUp ); | |
CFRelease( source ); | |
} | |
static void copy() { | |
CGEventSourceRef source = CGEventSourceCreate( kCGEventSourceStateCombinedSessionState ); | |
CGEventRef kbdEventDown = CGEventCreateKeyboardEvent( source, kVK_ANSI_C, 1 ); | |
CGEventRef kbdEventUp = CGEventCreateKeyboardEvent( source, kVK_ANSI_C, 0 ); | |
CGEventSetFlags( kbdEventDown, kCGEventFlagMaskCommand ); | |
CGEventPost( tapA, kbdEventDown ); | |
CGEventPost( tapA, kbdEventUp ); | |
CFRelease( kbdEventDown ); | |
CFRelease( kbdEventUp ); | |
CFRelease( source ); | |
} | |
static void recordClickTime() { | |
prevClickTime = curClickTime; | |
curClickTime = now(); | |
} | |
static char isDoubleClickSpeed() { | |
return ( curClickTime - prevClickTime ) < DOUBLE_CLICK_MILLIS; | |
} | |
static char isDoubleClick() { | |
return isDoubleClickSpeed(); | |
} | |
static CGEventRef mouseCallback ( | |
CGEventTapProxy proxy, | |
CGEventType type, | |
CGEventRef event, | |
void * refcon | |
) { | |
switch ( type ) | |
{ | |
case kCGEventOtherMouseDown: | |
paste( event ); | |
break; | |
case kCGEventLeftMouseDown: | |
recordClickTime(); | |
break; | |
case kCGEventLeftMouseUp: | |
if ( isDoubleClick() || isDragging ) { | |
copy(); | |
} | |
isDragging = 0; | |
break; | |
case kCGEventLeftMouseDragged: | |
isDragging = 1; | |
break; | |
default: | |
break; | |
} | |
// Pass on the event, we must not modify it anyway, we are a listener | |
return event; | |
} | |
int main ( | |
int argc, | |
char ** argv | |
) { | |
CGEventMask emask; | |
CFMachPortRef myEventTap; | |
CFRunLoopSourceRef eventTapRLSrc; | |
printf("Quit from command-line foreground with Ctrl+C\n"); | |
// We want "other" mouse button click-release, such as middle or exotic. | |
emask = CGEventMaskBit( kCGEventOtherMouseDown ) | | |
CGEventMaskBit( kCGEventLeftMouseDown ) | | |
CGEventMaskBit( kCGEventLeftMouseUp ) | | |
CGEventMaskBit( kCGEventLeftMouseDragged ); | |
// Create the Tap | |
myEventTap = CGEventTapCreate ( | |
kCGSessionEventTap, // Catch all events for current user session | |
kCGTailAppendEventTap, // Append to end of EventTap list | |
kCGEventTapOptionListenOnly, // We only listen, we don't modify | |
emask, | |
& mouseCallback, | |
NULL // We need no extra data in the callback | |
); | |
// Create a RunLoop Source for it | |
eventTapRLSrc = CFMachPortCreateRunLoopSource( | |
kCFAllocatorDefault, | |
myEventTap, | |
0 | |
); | |
// Add the source to the current RunLoop | |
CFRunLoopAddSource( | |
CFRunLoopGetCurrent(), | |
eventTapRLSrc, | |
kCFRunLoopDefaultMode | |
); | |
// Keep the RunLoop running forever | |
CFRunLoopRun(); | |
// Not reached (RunLoop above never stops running) | |
return 0; | |
} |
2,然后执行下面命令:
make macpaste
./macpaste &
3,最后如果你用iterm2的话,要把iterm2的中键复制关掉,不然的话在iterm2中会复制两次,具体关掉方法参考如下:
https://stackoverflow.com/questions/32339726/iterm2-disable-middle-click-paste
5,终端打开网页
MAC: open -a Safari http://stackoverflow.com
linux:gnome-open http://www.baidu.com
6,R 统计软件的安装
�https://download.cnet.com/R-for-Mac-OS-X/3000-2053_4-7831.html
解决warning
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_PAPER failed, using "C"
[R.app GUI 1.50 (6126) x86_64-apple-darwin9.8.0]
WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work. Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly. [History restored from /Users/nemo/.Rapp.history]
Open Terminal
Write or paste in: defaults write org.R-project.R force.LANG en_US.UTF-8
Close Terminal
Start R
7,office for mac的破解安装
http://dditblog.com/blog_408.html
文中提到的两个文件直接点开就好啦~
8, 一些天文软件的安装
http://geha.yale.edu/resources/installing-photometry-tools-on-a-recent-mac/
https://osxastrotricks.wordpress.com/2010/07/19/new-mac-setup/
9,eps 转 pdf
1 idl中eps转pdf
spawn,'/Users/jjj/sh_jjj/idlpdf.sh h_chi2s.eps'
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-10-20 09:49
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社