Monday, March 5, 2018

Disable bouncing scroll in Safari on touch device.

Add next code in your main page.
document.ontouchmove = function(event){
  event.preventDefault();
}
Or use this solution.
https://github.com/timbartsch/no-bounce

Tuesday, January 16, 2018

Install pip on macOS

Run next command.
sudo easy_install pip

Tuesday, January 2, 2018

Solve problem double click not working on macOS High Sierra

In short this problem occur from double click speed.
Go to "Accessibility" in System Preference.
Down double click speed to half value in Mouse & Trackpad.
I can't understand why that value was maximum as default.

Get screenshot without drop shadow on macOS High Sierra

Press the next keys.
CMD + SHIFT + 4
And press space key.
You can see capture frame for getting screenshot of specific windows.
Now, click left mouse on the capture frame with press hold ALT key.
Then you can get screenshot without drop shadow like next picture.

Wednesday, December 20, 2017

Downgrade npm to v4 for developing React Native

Run next command.
npm install -g npm@4

Friday, December 15, 2017

Bluetooth keyboard shortcut on iOS 11

Spotlight search.
CMD + Space

Change keyboard language.
CTRL + Space

Go to home.
CMD + H

Volume up/down.
F12/F13

Mute Volume.
F11

Wednesday, December 13, 2017

Align center tab in Ant Design

Add next style option to the tab component.
tabBarStyle={{textAlign: 'center'}}

100% height in Ant Design

In ant design you want to 100% height of some component.
Add next style option.
style={{height:"100vh"}}

Thursday, December 7, 2017

Add permanently ssh key on macOS

Run next command.
ssh-add -K ~/.ssh/[YOUR_PRIVATE_KEY]

Add config file in "~/.ssh/" with next contents.
Host github.com
    HostName github.com
    User enzinier
    PreferredAuthentications publickey
    IdentityFile /Users/jason/.ssh/enzinier-GitHub
    AddKeysToAgent yes
    UseKeychain yes

Key option is AddKeysToAgent, UseKeychain.

Monday, September 18, 2017

Debugging react app with Jetbrain WebStorm

If you try debugging react app with JetBrains WebStorm, you nothing to do.
For debugging you must install JetBrains IDE Support chrome extension.
JetBrains IDE Support

Tuesday, April 4, 2017

Get parameter from url

function getUrlParameter(paramName) {
    var currentUrl = window.location.search.substring(1);
    var urlParams = currentUrl.split("&");
    for (var i = 0; i < urlParams.length; i++) {
        var paramNames = urlParams[i].split("=");
        if (paramNames[0] == paramName) {
            return paramNames[1];
        }
    }
}

Wednesday, March 29, 2017

Permission denied issue on yarn global package

Unlike npm, location of global package on yarn is "/usr/bin" as default.
Therefore running yarn command without sudo occur to deny permission.
Avoid this situation, follow next instruction.

Check your default bin location of yarn.
yarn global bin
Create new directory in your favorite location.
mkdir ~/.yarn/global
Change default bin location of yarn.
yarn config set prefix ~/.yarn/global
And add path as environment variable in "~/.bashrc".
export PATH=${PATH}:`yarn global bin`

Saturday, March 25, 2017

Ubuntu | "/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link"

Run next commands.
sudo mv /usr/lib/nvidia-375/libEGL.so.1 /usr/lib/nvidia-375/libEGL.so.1.org
sudo mv /usr/lib32/nvidia-375/libEGL.so.1 /usr/lib32/nvidia-375/libEGL.so.1.org
sudo ln -s /usr/lib/nvidia-375/libEGL.so.375.39 /usr/lib/nvidia-375/libEGL.so.1
sudo ln -s /usr/lib32/nvidia-375/libEGL.so.375.39 /usr/lib32/nvidia-375/libEGL.so.1

Sunday, March 5, 2017

"The user limit on the total number of inotify watches was reached"

This error reach a system limit on the number of files you can monitor.
See your current system limit.
cat /proc/sys/fs/inotify/max_user_watches
You can temporarily change limit with next command.
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p
Also you can permanently change limit with next command.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Create shortcut for running specific android virtual device.

Saturday, March 4, 2017

copy and paste to other file in neovim

Open source file and press A key for select range.
Then press "+yy.
Open destination file and press "+p at your favorite location.

How to add shortcut in launcher on Ubuntu 16.04 LTS

Shortcut files of launcher are placed in ~/.local/share/applications.
Create .desktop file to reference next code.

Friday, February 24, 2017

Sunday, February 19, 2017

How to setup GKE?

I'm usually manage google cloud command in Postman.
Follow next orders.
  1. Create own network.
    curl -X POST -H "Content-Type: application/json" -H "Authorization: {{Your Access Token}}" -H "Cache-Control: no-cache" -d '{
      "name": "{{Your Network Name}}",
      "description": "{{Your Network Description}}",
      "autoCreateSubnetworks": false
    }' "https://www.googleapis.com/compute/v1/projects/{{Your Project ID}}/global/networks"
  2. Create subnetwork.
    curl -X POST -H "Content-Type: application/json" -H "Authorization: {{Your Access Token}}" -H "Cache-Control: no-cache" -d '{
      "ipCidrRange": "10.10.0.0/20",
      "name": "asia-east1",
      "network": "https://www.googleapis.com/compute/v1/projects/{{Your Project ID}}/global/networks/{{Your Network Name}}"
    }' "https://www.googleapis.com/compute/v1/projects/{{Your Project ID}}/regions/asia-east1/subnetworks"
  3. Create cluster in GKE.
    curl -X POST -H "Content-Type: application/json" -H "Authorization: {{Your Access Token}}" -H "Cache-Control: no-cache" -H "Postman-Token: bc7eddb2-be25-29f6-9af4-be948e1519b6" -d '{
      "cluster": {
        "name": "{{Your Cluster Name}}",
        "zone": "asia-east1-a",
        "network": "{{Your Network Name}},
        "loggingService": "logging.googleapis.com",
        "monitoringService": "none",
        "description": "{{Your Cluster Description}}",
        "subnetwork": "asia-east1",
        "nodePools": [
          {
            "initialNodeCount": 1,
            "config": {
              "machineType": "n1-standard-2",
              "imageType": "GCI",
              "diskSizeGb": 100,
              "localSsdCount": 1,
              "oauthScopes": [
                "https://www.googleapis.com/auth/compute",
                "https://www.googleapis.com/auth/devstorage.read_write",
                "https://www.googleapis.com/auth/bigquery",
                "https://www.googleapis.com/auth/sqlservice.admin",
                "https://www.googleapis.com/auth/datastore",
                "https://www.googleapis.com/auth/logging.write",
                "https://www.googleapis.com/auth/monitoring.write",
                "https://www.googleapis.com/auth/bigtable.data",
                "https://www.googleapis.com/auth/servicecontrol",
                "https://www.googleapis.com/auth/service.management.readonly",
                "https://www.googleapis.com/auth/trace.append"
              ]
            },
            "autoscaling": {
              "enabled": false
            },
            "management": {
              "autoUpgrade": false,
              "autoRepair": false,
              "upgradeOptions": {}
            },
            "name": "{{Your Pool Name}}"
          }
        ],
        "masterAuth": {
          "username": "admin"
        }
      }
    }' "https://container.googleapis.com/v1/projects/{{Your Project ID}}/zones/asia-east1-a/clusters"
  4. Get credential of cluster.
    gcloud container clusters list
    gcloud config set container/cluster {{Your Cluster Name}}
    gcloud config set compute/zone {{Your Zone ID}}
    echo "export GOOGLE_APPLICATION_CREDENTIALS={{Your Key File Address}}" >> ~/.bash_profile
    gcloud container clusters get-credentials {{Your Cluster Name}}

Wednesday, February 15, 2017

mysql data directory error on kubernetes.

If you meet next error...
[ERROR] --initialize specified but the data directory has files in it. Aborting.
You should add next argument in recipe.
spec:
  containers:
  - name: db-mysql
    image: mysql:5.7
    args: ["--ignore-db-dir=lost+found"]