Category Archives: Mac

Razer Synapse showing “PLEASE CONNECT A RAZER SYNAPSE ENABLED DEVICE”

What we’ll need to do is add Razer to the allowed developers for kernel extensions — we’ll basically add the Razer ID (R2H967U8J8) to the list of allowed kernel extension developers. Boot into recovery mode (Restart your mac and hold … Continue reading

Posted in Mac | Tagged | 1 Comment

HOW TO RUN VISUAL STUDIO CODE FROM ZSH ON MAC OSX

Adding the codefunction to .zshrc file: function code { if [[ $# = 0 ]] then open -a "Visual Studio Code" else local argPath="$1" [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}" open -a "Visual Studio Code" "$argPath" fi … Continue reading

Posted in Mac | Tagged , | Leave a comment

CommentPlus for Swift Func

Usage reference: https://zhihuitang.github.io/2019/01/13/CommentPlus-for-Swift-Func.html Download the Xcode extension from here Unzip and double click the extension CommentPlus.app to install the extension In Xcode, put the cursor on the upper line of func, then select Xcode menu bar: Editor -> CommentGenerator -> … Continue reading

Posted in iOS, Mac | Tagged | Leave a comment

How to generate **.cer** and **.p12** file for iOS push notification

Every time I created a new app with push notifications, iOS, I'm sure I've got everything right and then something refused to work. So this time I'm writing it down so I can't possibly get it wrong again.  Generally, … Continue reading

Posted in iOS, Mac, Mobile | Tagged , , , | 1 Comment

How to use Android Battery Historian

1. Install Docker: https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac 2. Run Docker docker run -p 5001:9999 gcr.io/android-battery-historian/stable:3.0 –port 9999 3. Fetch battery report To obtain a bug report from your development device running Android 7.0 and higher: $ adb bugreport bugreport.zip For devices 6.0 and … Continue reading

Posted in Android, Mac, Mobile | 2 Comments

Calculate LOC by shell script

Navigating to you project folder, run(python project) find . -name “*.py” |xargs grep -v “^$”|wc -l If it is a Objective-C project, the the script should look like this: find . -name “*.m” -or -name “*.h” |xargs grep -v “^$”|wc … Continue reading

Posted in Mac, Mobile | Leave a comment

Adding an existing project to GitHub using the command line

Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Open Terminal. Change the current working … Continue reading

Posted in git, Mac, Mobile | Leave a comment

RAM Disk on Mac

原文链接:http://www.toutiao.com/a6412375956519403778/?tt_from=weixin&utm_campaign=client_share&app=news_article&utm_source=weixin&iid=9729151087&utm_medium=toutiao_ios&wxshare_count=1 实现方法 方法的思路很简单,大概可以分两步: 1.配置 RAM。在内存中专门开出一块让 Xcode 使用。 2.连接 Xcode。让 Xcode 连接到我们开辟出来的专属内存空间。 下面就是见证奇迹的时刻。 第一步, 创建 .sh 文件。代码如下 #!/bin/bash RAMDISK=”ramdisk” SIZE=1024 #size in MB for ramdisk.· diskutil erasevolume HFS+ $RAMDISK `hdiutil attach -nomount ram://$[SIZE*2048]` 第二步, 运行 .sh 文件。在命令行中敲下 之后你会发现你会多出一个叫 ramdisk 的内存空间,有大概 1 … Continue reading

Posted in Mac | Leave a comment

git squash

1. Add a global “squash” alias from bash git config –global alias.squash ‘!f(){ git reset –soft HEAD~${1} && git commit –edit -m”$(git log –format=%B –reverse HEAD..HEAD@{1})”; };f’ 2. ~/.gitconfig should now contain this alias: [alias] squash = “!f(){ git reset … Continue reading

Posted in git, Mac | Tagged | Leave a comment