Please add your recipient's email address to authorized recipents if you are using free accounts of Mailgun

I setup mailgun with my ghost blog.
but I found I cann't send any mails out exception the mails send to errong.leng@gmail.com which is registered to create an account in mailgun.

I checked my mailgun's account's log, and I found:
Rejected: 'Errong Leng has invited you to join ACM Problem Resolving&Report' Free accounts are for test purposes only. Please upgrade or add the address to authorized recipients in Account Settings.:

reject

Ok. I do not like to upgrade since it will require your credit card info.
I have to add the address to authorized recipients in Account Settings.

invite_new_recipient

Input your recipient's address

invite2

Check your email and click "I Agree"

verified

Confirm and clicked "Yes"
ve2

You will found the recipient verified

v3

Ok, every thing is fine now.
Perphas I will upgrade later since you have to add each recipient one by one and wait it verified.

Hack Ghost core and release it


if you want to hack Ghost core you need to follow
https://docs.ghost.org/docs/working-with-ghost and
https://docs.ghost.org/docs/working-with-the-admin-client

Once you done all your hack job, just run grunt release command under your ghost folder.

grunt release 

Once it completed, you will get a zip file:
./.dist/release/Ghost-1.16.1.zip

Then run your hacked ghost under a new empty folder:
ghost install --zip /path/to/.dist/release/Ghost-1.16.1.zip 

 --zip              Path to Ghost release zip to install         [string]


House Robber III

Question:
http://www.lintcode.com/en/problem/house-robber-iii/
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that "all houses in this place forms a binary tree". It will automatically contact the police if two directly-linked houses were broken into on the same night.

Determine the maximum amount of money the thief can rob tonight without alerting the police.

Answer:
~~~c++
class Solution {
public:
    int houseRobber3(TreeNode* root) {
        unordered_map<TreeNode*, int> m;
        return dfs(root, m);
    }
    int dfs(TreeNode *root, unordered_map<TreeNode*, int> &m) {
        if (!root) return 0;
        if (m.count(root)) return m[root];
        int val = 0;
        if (root->left) {
            val += dfs(root->left->left, m) + dfs(root->left->right, m);
        }
        if (root->right) {
            val += dfs(root->right->left, m) + dfs(root->right->right, m);
        }
        val = max(val + root->val, dfs(root->left, m) + dfs(root->right, m));
        m[root] = val;
        return val;
    }
};
~~~

House Robber II

Question:
http://www.lintcode.com/en/problem/house-robber-ii/
After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, the security system for these houses remain the same as for those in the previous street.

Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.
Answer:
~~~c++
class Solution {
public:
     /*
     * @param nums: An array of non-negative integers.
     * @return: The maximum amount of money you can rob tonight
     */
    int houseRobber2(vector<int> nums) {
        if (nums.size() <= 1)
            return nums.empty() ? 0 : nums[0];
        vector<int> nums_inf = nums;
        vector<int> nums_inl = nums;
        nums_inf.pop_back();
        nums_inl.erase(nums_inl.begin());
        return max(houseRobber(nums_inf), houseRobber(nums_inl));
    }

    /*
     * @param A: An array of non-negative integers
     * @return: The maximum amount of money you can rob tonight
     */
    long long houseRobber(vector<int> &A) {
        size_t as = A.size();
        if (as == 0)
          return 0;
        if (as == 1)
          return A[0];
        if (as == 2)
          return max(A[0], A[1]);
        vector<long long> dp(as);
        dp[0] = A[0];
        dp[1] = max(A[0], A[1]);
        for (size_t i = 2; i < as; i++)
          dp[i] = max(dp[i-1], dp[i-2] + A[i]);
        return dp[as-1];
    }
};
~~~

PS:
if houseRobber(vector<int> &A) use memory O(1) method in [house-robber](http://acm.errong.win/house-robber/),
   
~~~c++
    long long houseRobber(vector<int> &A) {
        size_t as = A.size();
        long long odd, even;
        odd = even = 0;
        for (size_t i = 0; i < as; i++)
          if (i % 2)
            odd = max(odd+A[i], even);
          else
            even = max(even + A[i], odd);
        return max(odd, even);
    }
~~~

houseRobber2 will exceed the time limit.
it seems like i%2 operation will take more time.

House Robber

Question:
http://www.lintcode.com/en/problem/house-robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night.

Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.

Answer:
time:O(N)
~~~c++
class Solution {
public:
    /*
     * @param A: An array of non-negative integers
     * @return: The maximum amount of money you can rob tonight
     */
    long long houseRobber(vector<int> &A) {
        size_t as = A.size();
        if (as == 0)
          return 0;
        if (as == 1)
          return A[0];
        if (as == 2)
          return max(A[0], A[1]);
        vector<long long> dp(as);
        dp[0] = A[0];
        dp[1] = max(A[0], A[1]);
        for (size_t i = 2; i < as; i++)
          dp[i] = max(dp[i-1], dp[i-2] + A[i]);
        return dp[as-1];
    }
};
~~~
  
time:O(N)
memory:O(1)
~~~c++
class Solution {
public:
    /*
     * @param A: An array of non-negative integers
     * @return: The maximum amount of money you can rob tonight
     */
    long long houseRobber(vector<int> &A) {
        size_t as = A.size();
        long long odd, even;
        odd = even = 0;
        for (size_t i = 0; i < as; i++)
          if (i % 2)
            odd = max(odd+A[i], even);
          else
            even = max(even + A[i], odd);
        return max(odd, even);
    }
};
~~~
                                 
                                 

Developer install & setup with Ghost, step by step

# Install Pre-requisites: node.js yarn grunt
install node.js lts version
wget https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.tar.xz
tar -xvf node-v8.9.0-linux-x64.tar.xz
vim ~/.bashrc
export PATH="$HOME/node-v8.9.0-linux-x64/bin:$PATH"
source ~/.bashrc
check node version
node -v
v8.9.0

install yarn
curl -o- -L https://yarnpkg.com/install.sh | bash

install grunt
npm install -g grunt-cli

# Initial Setup
git clone https://github.com/TryGhost/Ghost.git  && cd Ghost
yarn run init

Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.9.0  # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

knex-migrator init

# Develop Ghost
grunt dev
grunt dev --server
grunt prod
.....

# Refers
https://docs.ghost.org/v1/docs/working-with-ghost

Fix up watchman issue with Ghost

# Issue
>>     >>     at BunserBuf.<anonymous> (/home/errong_leng/Ghost/core/client/node_modules/fb-watchman/index.js:95:23)
>>     at emitOne (events.js:116:13)
>>     at BunserBuf.emit (events.js:211:7)
>>     at BunserBuf.process (/home/errong_leng/Ghost/core/client/node_modules/bser/index.js:292:10)
>>     at /home/errong_leng/Ghost/core/client/node_modules/bser/index.js:247:12
>>     at _combinedTickCallback (internal/process/next_tick.js:131:7)
>>     at process._tickCallback (internal/process/next_tick.js:180:9)
>> A non-recoverable condition has triggered.  Watchman needs your help!
>> The triggering condition was at timestamp=1509698956: inotify-add-watch(/home/errong_leng/Ghost/core/client/node_modules/ember-cli-node-assets/node_modules/broccoli-funnel/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
>> All requests will continue to fail with this message until you resolve
>> the underlying problem.  You will find more information on fixing this at
>> https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
>> Error: A non-recoverable condition has triggered.  Watchman needs your help!
>> The triggering condition was at timestamp=1509698956: inotify-add-watch(/home/errong_leng/Ghost/core/client/node_modules/ember-cli-node-assets/node_modules/broccoli-funnel/node_modules/.bin) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
>> All requests will continue to fail with this message until you resolve
>> the underlying problem.  You will find more information on fixing this at
>> https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
>>

# Solution
sudo su -
echo 8192000 > /proc/sys/fs/inotify/max_user_watches

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...