Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac自用软件 #88

Open
bingoohuang opened this issue Apr 24, 2019 · 18 comments
Open

Mac自用软件 #88

bingoohuang opened this issue Apr 24, 2019 · 18 comments
Labels

Comments

@bingoohuang
Copy link
Owner

bingoohuang commented Apr 24, 2019

MAC 自用软件一览

  1. mac 剪贴板增强 Maccy
  2. iShot是Mac上一款免费优秀、功能全面的区域截图、窗口截图、多窗口截图、长截图、延时截图、快速标注、贴图、取色、屏幕录制工具。
  3. Kantu良心Mac图片浏览工具,腾讯最新出品。
  4. keka压缩(7Z ZIP TAR GZIP BZIP2 XZ LZIP DMG ISO),解压(7Z ZIP ZIPX RAR TAR GZIP BZIP2 XZ LZIP DMG ISO LZMA EXE CAB WIM PAX JAR WAR IPA APK APPX XPI CPGZ CPIO)
  5. Sip是一款位于菜单栏上的Mac测色计应用工具
  6. SSHPASS 非交互SSH密码验证
  7. Termius适用于桌面和手机的 SSH 客户端,可以登录服务器。
  8. Awesome Mac
  9. Display macOS Dock in Touch Bar It's free and open source!
  10. hstr: bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
  11. 录屏好帮手,实时显示按键操作的小工具:KeyCastr, Mac 系统实时显示键位操作软件:KeyCastr, 录屏好帮手,实时显示按键操作的小工具:KeyCastr | App+1
@bingoohuang
Copy link
Owner Author

bingoohuang commented Apr 25, 2019

Oh my zsh

安装 oh-my-zsh

  1. zsh --version 看版本 brew install zsh zsh-completions
  2. sudo vi /etc/shells 添加 /usr/local/bin/zsh
  3. chsh -s /usr/local/bin/zsh
  4. sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  5. vi ~/.zshrc修改plugins,plugins=(git z zsh-autosuggestions zsh-syntax-highlighting urltools encode64 wd last-working-dir)
  6. git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  7. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  8. iterm2显示时间线command + shift + e

image

zsh-autosuggestions 黏贴时反应慢问题解决c

在 ~/.zshrc中添加以下代码,重启终端。

# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
  OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
  zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}

pastefinish() {
  zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish

终止自动补全

You could use ctrl+k to cancel the auto-completion. however i can not find any information from zsh guide either, but it does cancel auto-completion.

@bingoohuang
Copy link
Owner Author

bingoohuang commented Apr 29, 2019

ssh免密码登录

lssh/lscp/lsftp,可以比sshpass更加方便地ssh,scp,sftp

image

sshpass命令使用

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

# 直接远程连接某主机
$ sshpass -p {密码} ssh {用户名}@{主机IP}
# 远程连接指定ssh的端口
$ sshpass -p {密码} ssh -p ${端口} {用户名}@{主机IP} 
# 从密码文件读取文件内容作为密码去远程连接主机
$ sshpass -f ${密码文本文件} ssh {用户名}@{主机IP} 
# 从远程主机上拉取文件到本地
$ sshpass -p {密码} scp {用户名}@{主机IP}:${远程主机目录} ${本地主机目录}
# 将主机目录文件拷贝至远程主机目录
$ sshpass -p {密码} scp ${本地主机目录} {用户名}@{主机IP}:${远程主机目录} 
# 远程连接主机并执行命令
$ sshpass -p {密码} ssh -o StrictHostKeyChecking=no {用户名}@{主机IP} 'rm -rf /tmp/test'
# -o StrictHostKeyChecking=no :忽略密码提示

@bingoohuang
Copy link
Owner Author

bingoohuang commented May 2, 2019

IDEA 自用插件

  1. Rainbow Brackets

  2. Key Promoter X

  3. String Manipulation

  4. Save Actions

    image

  5. ...

@bingoohuang
Copy link
Owner Author

SFTP on curl

# Login using curl on SFTP
curl  -k "sftp://83.46.38.23:22/" --user "testuser:testpassword"

# Upload using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/" --user "testuser:testpassword" -T "C:\test\testfile.xml" --ftp-create-dirs
 
# Download using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/testfile.xml" --user "testuser:testpassword" -o "C:\test\testfile.xml" --ftp-create-dirs
 
# Rename using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/" --user "testuser:testpassword" -Q "-RENAME
  ‘/CurlPutTest/testfile.xml’  ‘/CurlPutTest/testfile.xml.tmp’"   --ftp-create-dirs
 
# Delete using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/ " --user "testuser:testpassword" -Q "–RM /CurlPutTest/testfile.xml" --ftp-create-dirs
 
# Make directory using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/test " --user "testuser:testpassword" -Q "–MKDIR /CurlPutTest/Test" --ftp-create-dirs
 
# Remove directory using curl on SFTP
curl  -k "sftp://83.46.38.23:22/CurlPutTest/test " --user "testuser:testpassword" -Q "–RMDIR /CurlPutTest/Test" --ftp-create-dirs

@bingoohuang
Copy link
Owner Author

显式隐藏文件

  1. CMD + SHIFT + . (above macOS Sierra)
  2. Show defaults write com.apple.finder AppleShowAllFiles YES
  3. Hide defaults write com.apple.finder AppleShowAllFiles NO
  4. alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
  5. alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'

@bingoohuang
Copy link
Owner Author

mvn clean install -DskipTests时报错gpg: signing failed: Inappropriate ioctl for device,解决办法:export GPG_TTY=$(tty)

@bingoohuang
Copy link
Owner Author

using python -m json.tool to pretty json output of curl

echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool

@bingoohuang
Copy link
Owner Author

bingoohuang commented Jun 13, 2019

BurntSushi/ripgrep,出自Best Homebrew Packages for Mac

$ rg 🔥
notify/qcloudvoice.go
41:		"appName":     gou.Decode(m.State, "🔥", "告警啦,", "告警解除啦,").(string) + m.AppName,

model/msg.go
23:	State        string `json:"state"`        // 🔥/❄️
45:		State:        "🔥",
86:		State:        "🔥",

# bingoo @ 192 in ~/github/rig on git:master o [22:21:26]
$ rg ❄
model/state.go
83:		msg.State = "❄️"
84:		logrus.Infof("❄️,消息:%+v, 配置:%+v", msg, w)

model/msg.go
23:	State        string `json:"state"`        // 🔥/❄️

@bingoohuang
Copy link
Owner Author

Mac 环境下的Ruby

  1. 官方推荐安装RVM方式
// 离线包
curl -sSL https://github.com/rvm/rvm/tarball/stable -o rvm-stable.tar.gz
// 创建文件夹
mkdir rvm && cd rvm
// 解包
tar --strip-components=1 -xzf ../rvm-stable.tar.gz
// 安装 
./install --auto-dotfiles
// 加载
source ~/.rvm/scripts/rvm
// if --path was specified when instaling rvm, use the specified path rather than '~/.rvm'
  1. 安装 ruby
// 查询 ruby的版本
rvm list known
// 下载指定的版本
rvm install 2.4.0
// 将系统的ruby切换为下载的版本
rvm use 2.4.0  --default
  1. 参考 Mac 环境下的Ruby

@bingoohuang
Copy link
Owner Author

bingoohuang commented Nov 7, 2019

命令行翻墙

alias setproxy="export http_proxy=http://127.0.0.1:9999; export https_proxy=http://127.0.0.1:9999; export ALL_PROXY=socks5://127.0.0.1:10000"
alias unsetproxy="unset ALL_PROXY"
alias ip="curl -i http://ip.cn"

wget curl 这类网络命令都会经过socks代理

端口9999,怎么看 到的?系统偏好设置->网络->高级->代理

image

image

让终端走代理的几种方法

@bingoohuang
Copy link
Owner Author

@bingoohuang
Copy link
Owner Author

Mac上往U盘拷贝,推出U盘命令

$ cp ~/go/bin/linux_amd64/mci /Volumes/Untitled
$ hdiutil eject  /Volumes/Untitled
"disk2" ejected.
$ diskutil info /Volumes/Untitled


   Device Identifier:         disk2s1
   Device Node:               /dev/disk2s1
   Whole:                     No
   Part of Whole:             disk2

   Volume Name:
   Mounted:                   Yes
   Mount Point:               /Volumes/Untitled

   Partition Type:            Windows_FAT_32
   File System Personality:   MS-DOS FAT32
   Type (Bundle):             msdos
   Name (User Visible):       MS-DOS (FAT32)

   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported
   Partition Offset:          16384 Bytes (32 512-Byte-Device-Blocks)

   Disk Size:                 31.2 GB (31237062656 Bytes) (exactly 61009888 512-Byte-Units)
   Device Block Size:         512 Bytes

   Volume Total Space:        31.2 GB (31221792768 Bytes) (exactly 60980064 512-Byte-Units)
   Volume Used Space:         14.9 GB (14892433408 Bytes) (exactly 29086784 512-Byte-Units) (47.7%)
   Volume Free Space:         16.3 GB (16329359360 Bytes) (exactly 31893280 512-Byte-Units) (52.3%)
   Allocation Block Size:     16384 Bytes

   Read-Only Media:           No
   Read-Only Volume:          No

   Device Location:           External
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available

image

Thanks MAC挂载NTFS硬盘或U盘

@bingoohuang
Copy link
Owner Author

Shortcuts to move faster in Bash command line

Basic moves

  • Move back one character. Ctrl + b
  • Move forward one character. Ctrl + f
  • Delete current character. Ctrl + d
  • Delete previous character. Backspace
  • Undo. Ctrl + -

Moving faster

  • Move to the start of line. Ctrl + a
  • Move to the end of line. Ctrl + e
  • Move forward a word. Meta + f (a word contains alphabets and digits, no symbols)
  • Move backward a word. Meta + b
  • Clear the screen. Ctrl + l

What is Meta? Meta is your Alt key, normally. For Mac OSX user, you need to enable it yourself. Open Terminal > Preferences > Settings > Keyboard, and enable Use option as meta key. Meta key, by convention, is used for operations on word.

Cut and paste (‘Kill and yank’ for old schoolers)

  • Cut from cursor to the end of line. Ctrl + k
  • Cut from cursor to the end of word. Meta + d
  • Cut from cursor to the start of word. Meta + Backspace
  • Cut from cursor to previous whitespace. Ctrl + w
  • Paste the last cut text. Ctrl + y
  • Loop through and paste previously cut text. Meta + y (use it after Ctrl + y)
  • Loop through and paste the last argument of previous commands. Meta + .

Search the command history

  • Search as you type. Ctrl + r and type the search term; Repeat Ctrl + r to loop through results.
  • Search the last remembered search term. Ctrl + r twice.
  • End the search at current history entry. Ctrl + j
  • Cancel the search and restore original line. Ctrl + g

How do I clear/delete the current line in terminal?

  • You can use Ctrl+U to clear up to the beginning.
  • You can use Ctrl+W to delete just a word.
  • You can also use Ctrl+C to cancel.
  • If you want to keep the history, you can use Alt+Shift+# to make it a comment.

Just to summarise all the answers:

  • Clean up the line: You can use Ctrl+U to clear up to the beginning.
  • Clean up the line: Ctrl+E Ctrl+U to wipe the current line in the terminal
  • Clean up the line: Ctrl+A Ctrl+K to wipe the current line in the terminal
  • Cancel the current command/line: Ctrl+C.
  • Recall the deleted command: Ctrl+Y (then Alt+Y)
  • Go to beginning of the line: Ctrl+A
  • Go to end of the line: Ctrl+E
  • Remove the forward words for example, if you are middle of the command: Ctrl+K
  • Remove characters on the left, until the beginning of the word: Ctrl+W
  • To clear your entire command prompt: Ctrl + L
  • Toggle between the start of line and current cursor position: Ctrl + XX

@bingoohuang
Copy link
Owner Author

  1. 关闭菜单栏效果, 减少资源占用和产生的热量

    系统偏好设置/辅助功能/显示, 勾选 (减弱动态效果、减少透明度)

  2. 配置睡眠保护

    系统偏好设置/安全性与隐私/通用, 勾选(进入睡眠或开始保护程序 立即 要求输入密码)

  3. 配置触发角

    系统偏好设置/屏幕保护程序/触发角, 选择(右上桌面,左下启动台,右下启动屏幕保护)

  4. Xcode Command Line Tools

    xcode-select --install

  5. Homebrew

    # 这里必须设置 代理地址,否则无法安装brew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install

还在用 Win?教你从零把 Mac 打造成开发利器

@bingoohuang
Copy link
Owner Author

@bingoohuang
Copy link
Owner Author

MAC版本TC Marta

image

@bingoohuang
Copy link
Owner Author

Fig Your terminal, reimagined

image

@bingoohuang
Copy link
Owner Author

Chameleon

Chameleon is web application (blog engine) that reflects content from markdown files from a git repository. Powers articles.orsinium.dev.

Features:

  • Markdown (full support for CommonMark and GitHub Flavored Markdown)
  • Minimalistic UI
  • Easy to use, no CI or a special repo structure required
  • Zero configuration
  • Single binary
  • Automatically pull the repo by schedule
  • Built-in prose linter (Vale)
  • Syntax highlighting (Prism)
  • Formulas (MathJax)
  • Emoji (enescakir/emoji)
  • Views count
  • Great performance and server-side caching
  • Optional password protection
  • Search
  • Minification (minify)

Usage

Build:

git clone https://github.com/life4/chameleon.git
cd chameleon
go build -o chameleon.bin .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant