Luminoid's Site

OK Computer

Official Site: https://hexo.io/
Version: 6.3.0

Workflow

With Git deployment

$ hexo new "My New Article"
# Edit source/_posts/My-New-Article.md
$ hexo clean
$ hexo generate
$ git add -A
$ git commit -m <msg>
$ git push

Maintenance

Update outdated npm packages:

Using npm: With npm-check-updates. Run the following commands under the blog directory (./).

$ ncu -u
$ npm install

Configuration

Site config is stored in ./_config.yml

Read more »

Mac Usage

Mac Usage

Awesome Mac

Package Manager

Homebrew

Installation

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Commands

brew install <formula>      # Install formula.
brew install --cask <cask>  # Install cask.
brew update                 # Fetch the newest version of Homebrew and all formulae from GitHub.
brew upgrade                # Upgrade outdated casks and outdated, unpinned formulae.
brew leaves                 # List installed formulae that are not dependencies of another installed formula.
brew tap                    # Tap a formula repository.
brew doctor                 # Check your system for potential problems.
brew cleanup                # Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae.

npm

Installation

brew install node

Yarn

Installation

brew install yarn

CocoaPods

Installation

sudo gem install cocoapods
Read more »

Amend a commit

git commit --amend

Git pull till a particular commit

git fetch remote <branch_name>
git merge <commit_hash>

Your branch and ‘origin/master’ have diverged

git fetch origin
git reset --hard origin/master

Remove all unreachable objects

Warning

This command would remove all stashed objects.

git reflog expire --expire-unreachable=now --all
git gc --prune=now
Read more »

Packages Upgrade and Check

$ bubu          # brew update && brew outdated && brew upgrade && brew cleanup
$ brew doctor

$ ncu -g
$ npm doctor

$ gem update
$ gem cleanup

Keyboard Shortcuts

Mac keyboard shortcuts

Common Shortcuts

Command-,: Open preferences for the front app
Shift-Command-T: Reopen the last closed tab
Shift-Command-[: Switch to previous tab
Shift-Command-]: Switch to next tab

Finder Shortcuts

Shift-Command-.: Toggle show hidden files

System Shortcuts

Option–Volume Up / Option–Volume Down: Open Sound preferences.
Option–Shift–Volume Up / Option–Shift–Volume Down: Adjust the sound volume in smaller steps.
Option–Brightness Up / Option–Brightness Down: Open Displays preferences.
Option–Shift–Brightness Up / Option–Shift–Brightness Down: Adjust the display brightness in smaller steps.
Control-Command-Q: Immediately lock your screen.

Document Shortcuts

Option–Left: Move the insertion point to the beginning of the previous word
Option–Right: Move the insertion point to the end of the next word
Option-Delete: Delete the word to the left of the insertion point
Control-A: Move to the beginning of the line or paragraph
Control-E: Move to the end of the line or paragraph

Programs for getting the nth Fibonacci number in different programming languages.

C (1972)

fibonacci.cview raw
#include <stdio.h> #include <stdlib.h> int fib(int n) { if(n <= 1) { return n; } int a = 0; int b = 1; for(int i = 2; i <= n; i++) { int c = a + b; a = b; b = c; } return b; } int main(int argc, char *argv[]) { int n = atoi(argv[1]); printf("fib(%d) = %d\n", n, fib(n)); return 0; }
$ gcc fibonacci.c
$ ./a.out 1
fib(1) = 1
Read more »

Usage

Start REPL.

node

Check current supported ES6 features.

node --v8-options | grep harmony

Version Management

n

Installation

brew install n

Usage

n               # Display downloaded Node.js versions and install selection
sudo n latest   # Install the latest Node.js release (downloading if necessary)
sudo n lts      # Install the latest LTS Node.js release (downloading if necessary)
0%