Fix abnormally slow in Mac OS X Finder

There is one problem when using Finder is that, it behaves pretty slow when opening, listing and traversing directories.

The problem happens because for some reason the cloudd service’s database is corrupted. To fix this, just stop the cloudd service,

That’s it, now it should behave as normal.

Config Carbon locale for the Laravel project

In order to config locale for Carbon, you probably have to call this line:

So, where to set it in a typical Laravel project?

The answer is to create a ServiceProvider to do this job, because it is the best place to do it.

Create a new service provider, called LocaleServiceProvider, in the boot() method, call the config line.

Don’t forget to add the LocaleServiceProvider to the config/app.php

Update the provider cache

So it should work, for example, if you call diffForHumans(), it should return the expected locale from configuration.

Reduce the CPU usage on Parallel Desktop 11

I am currently using the Parallel Desktop version 11 to run Windows 10 virtually. However, it often get high on CPU usage, the fan keeps running very hard. After several hours to test and trial, I have figured out the way to fix this.

It looks like Parallel doesn’t utilize well when configuring Windows to run multiple cores, and I reduce the RAM amount to fit the number of cores. For example, with two cores, I will select to use 2GB of RAM, with 4 cores, 4GB of RAM is appropriate.

Config the CPU option in Parallel Desktop

Config the CPU option in Parallel Desktop

I don’t know why, but this works well for me. I’m running a MacBook Pro Retina Late 2013 with 8GB of RAM and 256GB SSD.

How to install and uninstall Ubuntu bash shell on Windows 10 from commandline

In order to install or uninstall Ubuntu bash shell on Windows 10 from command line, you will need to enable the Developer Mode on System Features. It’s essential!

Developer Mode on Windows 10

Developer Mode on Windows 10

Open the Command Prompt, now you can issue the command to utilize the installation process.

To install,

It will download the package from Windows Store, then install. At final step, it will prompt user to create an username along with the password to use on the shell.

Additionally, you can add option /y to automatically create a new root user with no pre-configured password.

To uninstall completely,

Just remove the /full option to preserve the environment, app data and user data on the shell.

That’s all about it!

Config for X-Frame-Options for the web

Because of security reasons, so some web servers or web frameworks will make request/response headers to be rejected, which is DENY, which means it doesn’t allow the embeded iframe on to the web.

However, in some case, we still need to use iframe, ex. from the same domain, with image uploading on TinyMCE (this is very popular on WordPress anyway).

We need to config the web server to allow from SAMEORIGIN or ALLOW_URL instead of DENY.

On nginx server, check the config file /etc/nginx/nginx.conf and all the files that it includes, remove or update this part

It could be in the file /etc/nginx/snippets/ssl-params.conf if you setup the SSL.

Restart the server.

Ensuring that web server config has updated for the part, but problem persists, then it should be the web frameworks, check out any place that it can send this header and update.

Easy way to upload image to TinyMCE in Laravel

There are many TinyMCE image uploader and file manager plugins but, to tell you the truth, they are quite complicated for use, yeah I know that they provide a lot of functionalities. But while writing content, I just want to pick one image to upload and add it directly to the editor.

So I create a simple package to do this job, petehouston/laravel-tinymce-simple-imageupload

To use the package, issue this command

To test how simple it is, add a test route for the package,

Now click on the Insert Image button and upload the image, it will be put directly into the editor.

For more information about the package, visit the repo at

Find what is listening on a given port

To find out what application is listening on a given port on Linux, issue following command,

with Mac OS X, the netstat command behaves differently, and you need to provide the protocol via -p option.

Besides, there is another command you can use, lsof.

where $PORT_LIST is a list of ports in comma-separated format.

For example,

Have fun :)

Check package information installed by Homebrew

After installing a package using Homebrew, you can see the package information right away, it prints out to the stdout, such as: caveats, configuration, dependencies… Somehow, if you forget them, and want to look up the package information, what would you do?

Luckily, Homebrew provides an option to look up the information of installed packages, and just like this,

detail of the package will be shown on terminal screen. I personally don’t remember much of configuration of many packages that I install on my machine, like nginx…and with this command, I can easily find out the nginx config file and start working without the need to remember anything.

Config to launch Sublime Text from command-line on Mac OS X

If you are a developer and use Sublime Text frequently, you might want to add Sublime Text to launch from command-line. It depends on your Sublime Text version (2, or 3) to config the symbol alias,

With Sublime Text 2,

With Sublime Text 3,

Make sure to have /usr/local/bin in the PATH variable, if not, append the following line to the .bashrc, .bash_profile if using Bash, or .zshrc if using ZShell.

Just another very basic tip for command line users :)

Fix Docker push authorization required

When pushing Docker images to the registry, you might fail and see this error

So the question is, how to authenticate into Docker from this command line? and why doesn’t it prompt for authentication?

Well, I don’t know, but I find out that you need to authenticate in different command.

Prompt your password, then you will be able to push images to registry. There is an –email option, but it will soon be deprecated, so don’t mind about that if you see it appearing in any other articles on Internet.