Soliloquy


  • Home

  • Categories

  • Archives

  • Tags

  • Search

daydream

Posted on 2016-11-12   |   In Uncategorized   |  

白日梦想家,看得我热泪盈眶。有白日梦的人生,才有行动,才有对自己的最大挑战。
连想都不敢想的事情,怎么可能会实现。

那些从来不曾想过可以看到的风光,已经用足迹去探寻。
那些只在画报杂志上窥见的绮丽色彩,也一一见证。
还有多少土地没有一寸寸去膜拜,靠自己的双手双脚,走出最真实的人生。

世界那么大,没有任何人和事可以束缚你的梦想。

思想和身体,总有一个在路上。

decision trees

Posted on 2016-10-06   |   In Uncategorized   |  

My colleagues is a genius. He shared a grand picture with me, and prompted me to think of the following.

Life is essentially full of decision trees. We make so many decisions a day.

  • What are we going to eat for breakfast/lunch/dinner?
  • Do I want to have supper?
  • I feel thirsty now. Should I continue finishing this email, or should I take a break to get more water?
  • There are tasks 1, 2, 3, 4. Which one should I prioritise?
  • I have two appointments clash. Which one should I go to?

Each decision making point, we go through a few stages.

Define evalution criteria

  • At the current stage, what are the factors to consider?
  • What are the requirements for my options?
    • For example, for food, I want it to be filling, simple, affordable, easy to access?
    • It is even better to define quantitative requirements.
      • filling - 3k calories?
      • simple - 3 different types of food items?
      • affordable - budget $10?
      • easy to access - within 10 minutes of reach / preparation time?
  • We could even give weightage to each option, and derive a single formula that takes into account all the requirements to calculate a single score for final ranking of the options. This will become our evaluation matrix.

Gathering information

We next gather information to fill in the matrix.

  • What resources do I have and am willing to spend on meeting the requirments?
    • This is usually time, money, energy level, and mood
    • emotional attachment / requirement is the hardest to quantify, justified
  • What are the available options that will meet my requirements?
  • What are the costs (time, $$) for each of these available options?

Evaluate options

  • Put the requirements and available options side by side, and then fill in our evaluation matrix with the scoring. If the evaluation formula is well-designed, the option that scores the highest should be our desired choice.

Make a judgement

  • Pick the top choice should be simple now, since the decision making is already engineered in the entired process. There should not be any more wavering, feeling uncertained, or unsure.

Decision making is so important that every minute we live is a result of the decision made previously, be it by others or ourselves. Making it a science, instead of an art, may simplify things for ourselves.

I shall be more conscious with my decision making points and give this process a try.

how to install npm packages offline

Posted on 2016-09-20   |   In Uncategorized   |  

In the rare times when we need npm packages to be installed without internet for development or build environment, I found the following works.

Requirements

  • access to locally hosted git repository (I set up Phabricator for my workplace)
  • access to internet on a machine that can run ‘npm’ command

Steps

On the computer with internet

  • copy out the package.json file to a separate folder, run ‘npm install’ and wait for all the packages to download nicely
  • transfer the folder to a computer that can connect to your internal git repo server
  • if some files failed to copy due to file name too long, we can tar or zip the folder first.

On the computer with access to internal git repo server

  • Create a fresh repository on the local git repo server
  • $ cd node_modules && git init && git add remote origin “your git repo url”
  • $ git config –global core.longpaths true
    • this solves the path too long issue for nested node_modules in Windows
  • $ git push origin master
  • Tada, now you should have all the node modules sitting nicely in a repo to download

On the actual environment that you need the npm packages

  • go to the directory, git clone “your node_modules git repo url”
  • Tada! everything is nicely downloaded now!

.gitignore file

  • To avoid having issues with the .gitignore file, we need to add node_modules/ so the dependencies live as a separate git repo. This will prevent any updates on this one time installed dependencies folder.
  • Also, installing the npm packages outside of the main project and creating a separate npm node_modules repo to host these files will prevent the main project .gitignore from messing up our node_modules repo (i.e. accidentally ignoring some files that comes with npm install without checking them in for dependencies transfer)

Conclusion

Installing npm packages is no longer so straightforward when there is no internet. This solution at least help make our lives easier without frowning at every new fresh installation.

Of course the ultimate solution is to clone a local npm package server. But I heard that’s about 1TB and it’s probably overkill for now.

From Wordpress to Hexo

Posted on 2016-09-12   |   In Uncategorized   |  

Managed to finish the first cut of migration of wordpress.

Issue resolved
The main issue lies in having an error while migrating wordpress posts. After some debugging, I realised that the npm package “hexo-migrator-wordpress” is actually different from the version found on github.

After checking the last updated date on both the npm package site and github, I found out that the npm package was outdated. Resolved this issue by replacting the content in “/node_modules/hexo-migrator-wordpress” with a fresh copy downloaded from github. Also I checked the pull requests and downloaded the version with the latest code commits, instead of the official master copy.

Dev environment setup

  • iTerm pane 1: hexo s –debug
  • iTerm pane 2: hexo generate –watch
  • iTerm pane 3: vim

TODO

  • Archives grouped by year with nicer display
    • auto achieved by changing to next pisces theme
  • add in comments feature from disque
    • userful link for setup issues https://help.disqus.com/customer/portal/articles/472007-i-m-receiving-the-message-%22we-were-unable-to-load-disqus-%22
    • the disque short name is not my username. Need to configure a site name and the shortname will be generated automatically.
    • also, need to add the site into the trusted domain lists
    • https://help.disqus.com/customer/portal/articles/1261429
    • https://github.com/iissnan/hexo-theme-next/issues/117
  • add in RSS / Subscription feature
    • https://github.com/hexojs/hexo-generator-feed
  • add in extra markdown support
    • https://github.com/hexojs/hexo-renderer-marked
  • add in wechat public ID subscript qrcode and wechat pay qrcode
  • add site map
  • add local search
    • https://github.com/LouisBarranqueiro/hexo-algoliasearch
    • http://www.kuwoku.com/2016/05/30/Hexo%E9%9B%86%E6%88%90Algolia%E6%90%9C%E7%B4%A2%E6%8F%92%E4%BB%B6/#
    • http://blog.niices.com/Hexo-Next-Algolia-Search/
  • add google analytics
  • publish migration note on wordpress
  • learn how to use markdown
  • about page [postponed - consider migrate yangfan.fi-de.net]
  • test blog post photo display
  • record wechat posts & long facebook posts

My new mechanical keyboard

Posted on 2016-09-09   |   In Uncategorized   |  

今天买了一个新键盘。超级开心。很好打啊。打字感觉超级爽。我觉得我重新爱上打字的感觉了。

不过声音有点大。所以不知道能不能带回办公室用。也许可以贿赂一下同事,让他们试用,然后把他们也带上这条不归路哈哈哈哈。

开心。玩具多多的!

12…129
Yangfan 扬帆

Yangfan 扬帆

微信ID miss_yangfanzhang

645 posts
10 categories
2 tags
RSS
GitHub LinkedIn
© 2016 Yangfan 扬帆
Powered by Hexo
Theme - NexT.Pisces